Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

60607: Fixed generics, unused code and and some minor formatting - found during investigations.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62340 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 14:17:51 +00:00
parent f68b048cbf
commit 38efc4c619
4 changed files with 1006 additions and 1000 deletions

View File

@@ -61,7 +61,7 @@ public class SubsystemChainingFtpAuthenticator extends AbstractChainingFtpAuthen
@Override @Override
protected List<FTPAuthenticatorBase> getUsableFtpAuthenticators() protected List<FTPAuthenticatorBase> getUsableFtpAuthenticators()
{ {
List<FTPAuthenticatorBase> result = new LinkedList<>(); List<FTPAuthenticatorBase> result = new LinkedList<FTPAuthenticatorBase>();
for (String instance : this.applicationContextManager.getInstanceIds()) for (String instance : this.applicationContextManager.getInstanceIds())
{ {
try try

View File

@@ -57,10 +57,6 @@ public class CalendarRecurrenceHelper
public static final Map<String,Integer> DAY_NAMES_TO_CALENDAR_DAYS = public static final Map<String,Integer> DAY_NAMES_TO_CALENDAR_DAYS =
Collections.unmodifiableMap(d2cd); Collections.unmodifiableMap(d2cd);
private final static long DAY_IN_MS = 24 * 60 * 60 * 1000L;
private final static long WEEK_IN_MS = DAY_IN_MS * 7L;
private final static long MONTH_IN_MS = DAY_IN_MS * 31L;
private final static long YEAR_IN_MS = MONTH_IN_MS * 12L;
/** /**
* Returns a lookup from recurrence rule days of the week, to * Returns a lookup from recurrence rule days of the week, to
* the proper days of the week in the specified locale * the proper days of the week in the specified locale
@@ -739,7 +735,7 @@ public class CalendarRecurrenceHelper
private static List<Integer> getDaysOfWeek(Map<String, String> params, String dayWeekType) private static List<Integer> getDaysOfWeek(Map<String, String> params, String dayWeekType)
{ {
String[] weekDays = params.get(dayWeekType).split(","); String[] weekDays = params.get(dayWeekType).split(",");
List<Integer> daysOfWeek = new ArrayList<>(); List<Integer> daysOfWeek = new ArrayList<Integer>();
for (String day : weekDays) for (String day : weekDays)
{ {

View File

@@ -18,18 +18,27 @@
*/ */
package org.alfresco.repo.calendar; package org.alfresco.repo.calendar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import org.alfresco.service.cmr.calendar.CalendarEntryDTO; import org.alfresco.service.cmr.calendar.CalendarEntryDTO;
import org.alfresco.service.cmr.calendar.CalendarRecurrenceHelper; import org.alfresco.service.cmr.calendar.CalendarRecurrenceHelper;
import org.alfresco.service.cmr.calendar.CalendarService; import org.alfresco.service.cmr.calendar.CalendarService;
import org.alfresco.service.cmr.calendar.CalendarTimezoneHelper; import org.alfresco.service.cmr.calendar.CalendarTimezoneHelper;
import org.junit.Test; import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.*;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/** /**
* Test cases for the helpers relating to the {@link CalendarService}, * Test cases for the helpers relating to the {@link CalendarService},
* but which don't need a full repo * but which don't need a full repo
@@ -899,6 +908,7 @@ public class CalendarHelpersTest
/** /**
* eg the last Tuesday of the month * eg the last Tuesday of the month
*/ */
@SuppressWarnings("unused")
@Test public void monthlyRecurrenceByLastDayOfWeek() @Test public void monthlyRecurrenceByLastDayOfWeek()
{ {
List<Date> dates = new ArrayList<Date>(); List<Date> dates = new ArrayList<Date>();
@@ -921,12 +931,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceByFirstDayOfEveryFirstMonth() public void monthlyRecurrenceByFirstDayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the first day of every 1 month // Setting the recurrence rule fo the first day of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,MO,TU,WE,TH,FR,SU;BYSETPOS=1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,MO,TU,WE,TH,FR,SU;BYSETPOS=1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "SA,MO,TU,WE,TH,FR,SU"); params.put("BYDAY", "SA,MO,TU,WE,TH,FR,SU");
@@ -961,12 +971,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceByFirstWeekdayEveryFirstMonth() public void monthlyRecurrenceByFirstWeekdayEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the first weekday of every 1 month // Setting the recurrence rule fo the first weekday of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "MO,TU,WE,TH,FR"); params.put("BYDAY", "MO,TU,WE,TH,FR");
@@ -1003,12 +1013,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceByFirstWeekendDayEveryFirstMonth() public void monthlyRecurrenceByFirstWeekendDayEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the last day of every 1 month // Setting the recurrence rule fo the last day of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,SU;BYSETPOS=1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,SU;BYSETPOS=1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "SA,SU"); params.put("BYDAY", "SA,SU");
@@ -1045,12 +1055,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceBySecondDayOfEveryFirstMonth() public void monthlyRecurrenceBySecondDayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the second day of every 1 month // Setting the recurrence rule fo the second day of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,MO,TU,WE,TH,FR,SU;BYSETPOS=-1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,MO,TU,WE,TH,FR,SU;BYSETPOS=-1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "SA,MO,TU,WE,TH,FR,SU"); params.put("BYDAY", "SA,MO,TU,WE,TH,FR,SU");
@@ -1087,12 +1097,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceBySecondWeekdayOfEveryFirstMonth() public void monthlyRecurrenceBySecondWeekdayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the second weekday of every 1 month // Setting the recurrence rule fo the second weekday of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "MO,TU,WE,TH,FR"); params.put("BYDAY", "MO,TU,WE,TH,FR");
@@ -1136,12 +1146,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceBySecondWeekendDayOfEveryFirstMonth() public void monthlyRecurrenceBySecondWeekendDayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the second weekday of every 1 month // Setting the recurrence rule fo the second weekday of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=SU,SA;BYSETPOS=-1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=SU,SA;BYSETPOS=-1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "SU,SA"); params.put("BYDAY", "SU,SA");
@@ -1185,12 +1195,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceByLastDayOfEveryFirstMonth() public void monthlyRecurrenceByLastDayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the last day of every 1 month // Setting the recurrence rule fo the last day of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,MO,TU,WE,TH,FR,SU;BYSETPOS=-1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=SA,MO,TU,WE,TH,FR,SU;BYSETPOS=-1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA"); params.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA");
@@ -1227,12 +1237,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceByLastWeekdayOfEveryFirstMonth() public void monthlyRecurrenceByLastWeekdayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the last day of every 1 month // Setting the recurrence rule fo the last day of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "MO,TU,WE,TH,FR"); params.put("BYDAY", "MO,TU,WE,TH,FR");
@@ -1269,12 +1279,12 @@ public class CalendarHelpersTest
@Test @Test
public void monthlyRecurrenceByLastWeekendDayOfEveryFirstMonth() public void monthlyRecurrenceByLastWeekendDayOfEveryFirstMonth()
{ {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Setting the recurrence rule fo the last day of every 1 month // Setting the recurrence rule fo the last day of every 1 month
// FREQ=MONTHLY;INTERVAL=1;BYDAY=SU,SA;BYSETPOS=-1 // FREQ=MONTHLY;INTERVAL=1;BYDAY=SU,SA;BYSETPOS=-1
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("INTERVAL", "1"); params.put("INTERVAL", "1");
params.put("BYDAY", "SU,SA"); params.put("BYDAY", "SU,SA");
@@ -1313,11 +1323,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the first day of every January // Setting the yearly recurrence rule fo the first day of every January
//FREQ=MONTHLY;BYDAY=SU,MO,TU,WE,TH,FR,SA;BYMONTH=1;BYSETPOS=1;INTERVAL=12 //FREQ=MONTHLY;BYDAY=SU,MO,TU,WE,TH,FR,SA;BYMONTH=1;BYSETPOS=1;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String,String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA"); params.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1360,11 +1370,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the first weekday of every January // Setting the yearly recurrence rule fo the first weekday of every January
//FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=1;INTERVAL=12 //FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=1;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "MO,TU,WE,TH,FR"); params.put("BYDAY", "MO,TU,WE,TH,FR");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1408,11 +1418,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the first weekend day of every January // Setting the yearly recurrence rule fo the first weekend day of every January
//FREQ=MONTHLY;BYDAY=SU,SA;BYMONTH=1;BYSETPOS=1;INTERVAL=12 //FREQ=MONTHLY;BYDAY=SU,SA;BYMONTH=1;BYSETPOS=1;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "SU,SA"); params.put("BYDAY", "SU,SA");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1456,11 +1466,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the second weekend day of every January // Setting the yearly recurrence rule fo the second weekend day of every January
//FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=2;INTERVAL=12 //FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=2;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "MO,TU,WE,TH,FR"); params.put("BYDAY", "MO,TU,WE,TH,FR");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1510,11 +1520,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the second weekend day of every January // Setting the yearly recurrence rule fo the second weekend day of every January
//FREQ=MONTHLY;BYDAY=SU,SA;BYMONTH=1;BYSETPOS=2;INTERVAL=12 //FREQ=MONTHLY;BYDAY=SU,SA;BYMONTH=1;BYSETPOS=2;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "SU,SA"); params.put("BYDAY", "SU,SA");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1564,11 +1574,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the last day of every January // Setting the yearly recurrence rule fo the last day of every January
//FREQ=MONTHLY;BYDAY=SU,MO,TU,WE,TH,FR,SA;BYMONTH=1;BYSETPOS=-1;INTERVAL=12 //FREQ=MONTHLY;BYDAY=SU,MO,TU,WE,TH,FR,SA;BYMONTH=1;BYSETPOS=-1;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA"); params.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1611,11 +1621,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the last weekday of every January // Setting the yearly recurrence rule fo the last weekday of every January
//FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=-1;INTERVAL=12 //FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=-1;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "MO,TU,WE,TH,FR"); params.put("BYDAY", "MO,TU,WE,TH,FR");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");
@@ -1665,11 +1675,11 @@ public class CalendarHelpersTest
{ {
// Setting the yearly recurrence rule fo the last weekday of every January // Setting the yearly recurrence rule fo the last weekday of every January
//FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=-1;INTERVAL=12 //FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTH=1;BYSETPOS=-1;INTERVAL=12
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
// Recurrecne rule // Recurrecne rule
Map<String,String> params = new HashMap<>(); Map<String, String> params = new HashMap<String, String>();
params.put("FREQ", "MONTHLY"); params.put("FREQ", "MONTHLY");
params.put("BYDAY", "SU,SA"); params.put("BYDAY", "SU,SA");
params.put("BYMONTH", "1"); params.put("BYMONTH", "1");

View File

@@ -109,7 +109,7 @@ public class StandardQuotaStrategyTest
// Quota is 20MB. The quota manager will... // Quota is 20MB. The quota manager will...
// * start the cleaner at 16MB (80% of 20MB) // * start the cleaner at 16MB (80% of 20MB)
// * refuse to cache any more files at 18MB (90% of 20MB) // * refuse to cache any more files at 18MB (90% of 20MB)
List<String> contentURLs = new ArrayList<>(); List<String> contentURLs = new ArrayList<String>();
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++)
{ {
String url = writeSingleFileInMB(1); String url = writeSingleFileInMB(1);