Merged V4.0-BUG-FIX to HEAD

33757: Merged BRANCHES/DEV/THOR1_SPRINTS to BRANCHES/DEV/V4.0-BUG-FIX
      33755: Latest Spring Surf libs:
             - Updates to convert FreeMarker directives for processing directives Spring Beans to allow their behaviour to be customized.
             - Changed Extensibility model objects to use a non-blocking GUID generator to avoid thread contention (small amount noticed with 1000 concurrent user test)
             - Removed old machine gun code to generate Object GUIDs, which weren't even valid GUIDs ironically.
             - Replaced with new non-blocking fast GUID generator in webscripts package.
             - Added Reentrant ReadWriteLock around resources in singleton Spring beans that are manipulated by multiple threads.
             - Added Reentrant ReadWriteLock around Advanced Component internal resources.
             - Surf performance improvements from Thor high load profiling in Jmeter/Jprofiler
             - Removed lock around ModelWriter (which is only used by a single request thread at a time)
             - Replaced StringBuffer with StringBuilder for Writer usage in extensibility framework to remove locking.
             - Performance improvements around retrieval of RemoteClient instance
             - avoid expensive Spring prototype bean retrieval, use a threadlocal clone of a base RemoteClient bean instead.
             - Concurrency fixes around CRUD operations on shared ModelObjects instances.
             - Surf ModelObjects are shared between all users in the model object caches - but the original machine gun code has no locking what-so-ever around CRUD operations - which meant that it was possible for incorrect property values to be received from a ModelObject in a heavily multi-threaded scenario on initialisation of a Surf application.
             - was causing nonsense warnings such as:
               WARN  [extensions.webscripts.WebTemplateProcessor] [http-8081-exec-10] Unable to find a valid template path for uri: freemarker
             - Modified default web-tier server response codes for read timeout and connect timeout to return more sensible codes to client browsers.
             - Fix for concurrency issue resolving SpringMVC View objects found during heavy thread testing on web-tier startup.
             - Improved caching strategy for WebScripts View Resolver - move techniques from Surf down to WebScripts layer.
             - Improved general View Resolver strategy by caching failed view requests.
             - WebScript resource bundle extension module application thread safety modifications   
   Merged BRANCHES/DEV/V3.4-BUG-FIX to BRANCHES/DEV/V4.0-BUG-FIX
      33684: Fixes for ALF-12628, ALF-12639 - timeout handling for READ_TIMEOUT from web-tier to Alfresco
   33771: ALF-12488 - CIFS error occurs if Hazelcast Config is enabled
   33773: ALF-12437 Switching from Lucene to Solr caused subsystems to be in inconsistent state and repository to hang
   - filter to include only updateable properties at persistence and start up time
   33775: ALF-11870 Handle the odd way that Outlook requests yearly repeating events, and add unit tests for the yearly recurrence cases
   33776: ALF-12569: org.postgresql.util.PSQLException Invalid ESCAPE on customizing alfresco share site dashboard   
      Added backwards compatible PostgreSQL-specific ESCAPE fragment - fixes for PostgreSQL 9.1.2.
   33784: Fixes: ALF-12111 - Publishing Error when authenticating Facebook channels using IE8. Required an update to stand-alone-auth-return.html.
   33787: Fix for ALF-12337 Remove patch.siteLoadPatch.swsdp from being run for upgrades
   - only add the sample site for new installs and not upgrades
   33794: ITALIAN: Translation updates based on EN r33523
   33807: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      33717: (RECORD ONLY) ALF-12632 Move the Site Service permissions to public-services-security-context.xml, to mirror the behaviour on 4.0, and add a (commented out) example of how to restrict site creation permissions with it
      33806: Merged V3.4 to V3.4-BUG-FIX
         33728: ALF-10976 Excel files bigger than 2mb cause soffice.exe to take 100% of one CPU for more than 2 minutes in previews.
            - Added configuration to limit older excel format 'xls' from Excel 5.0/95 and Excel 97-2003
              Already had configuration for xlsx Microsoft Office 2007
         33743: ALF-12724: Merge HEAD to V3.4 (3.4.8)
            Issue found while fixing ALF-9899 and again by QA when testing ALF-9899
            32941: ALF-11300:
              - fix locking issues
         33772: Merged DEV to V3.4
            33768: ALF-12685 : Search isn't working correctly
               Index delete events were not getting fired for the entire tree of affected nodes when a node was archive
               Added a deletion of child nodes from indexes in DbNodeServiceImpl.pullNodeChildrenToSameStore() method.
         33803: ALF-12724: Merged V4.0-BUG-FIX to V3.4 (Reverts previous revision and changes an error message to debug)
            33137: Activities feed generator: change info log messages to debug log messages
            33452: Fix for ALF-12536
            33536: Fix for ALF-12536: hopefully this will be the final fix.
         33805: ALF-12624: Fix regression introduced by ALF-9514


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33808 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-02-09 16:13:30 +00:00
parent c1da83b23d
commit 4e7a0f6ef0
19 changed files with 573 additions and 118 deletions

View File

@@ -782,6 +782,314 @@ public class CalendarHelpersTest
assertEquals("2011-10-21", dateFmt.format(dates.get(1)));
assertEquals("2012-01-20", dateFmt.format(dates.get(2)));
}
/**
* eg every 21st of February
*/
@Test public void yearlyRecurrenceByDateInMonth()
{
List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance();
// How Outlook ought to do it
Map<String,String> params = new HashMap<String, String>();
params.put("COUNT", "10");
params.put("BYMONTH", "2");
params.put("BYMONTHDAY", "21");
// How many Outlook versions do do it...
// FREQ=MONTHLY;COUNT=10;BYMONTH=2;INTERVAL=1;BYSETPOS=17;BYDAY=SU,MO,TU,WE,TH,FR,SA;
Map<String,String> paramsOUTLOOK = new HashMap<String, String>();
paramsOUTLOOK.put("FREQ", "MONTHLY");
paramsOUTLOOK.put("COUNT", "10");
paramsOUTLOOK.put("BYMONTH", "2");
paramsOUTLOOK.put("INTERVAL", "1");
paramsOUTLOOK.put("BYSETPOS", "21");
paramsOUTLOOK.put("BYDAY", "SU,MO,TU,WE,TH,FR,SA");
// Check that the outlook crazy version gets fixed
Map<String,String> paramsFIXED = RecurrenceHelper.fixOutlookRecurrenceQuirks(paramsOUTLOOK);
assertEquals("YEARLY", paramsFIXED.get("FREQ"));
assertEquals("2", paramsFIXED.get("BYMONTH"));
assertEquals("21", paramsFIXED.get("BYMONTHDAY"));
assertEquals("10", paramsFIXED.get("COUNT"));
assertEquals("1", paramsFIXED.get("INTERVAL"));
assertEquals(null, paramsFIXED.get("BYDAY"));
assertEquals(null, paramsFIXED.get("BYSETPOS"));
// Dates in the past, get nothing
dates.clear();
currentDate.set(2012,1-1,19,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,10), date(2012,2,15),
true, 1);
assertEquals(0, dates.size());
dates.clear();
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,10), date(2012,2,15),
false, 1);
assertEquals(0, dates.size());
// With the month that contains it
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2012,2,26),
true, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-21", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2012,2,26),
false, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-21", dateFmt.format(dates.get(0)));
// In the next month
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2012,3,26),
true, 1);
assertEquals(0, dates.size());
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2012,3,26),
false, 1);
assertEquals(0, dates.size());
// From before, into the next year
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2013,3,26),
true, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-21", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2013,3,26),
false, 1);
assertEquals(2, dates.size());
assertEquals("2012-02-21", dateFmt.format(dates.get(0)));
assertEquals("2013-02-21", dateFmt.format(dates.get(1)));
// From next month, into the next year
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2013,2,26),
true, 1);
assertEquals(1, dates.size());
assertEquals("2013-02-21", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2013,3,26),
false, 1);
assertEquals(1, dates.size());
assertEquals("2013-02-21", dateFmt.format(dates.get(0)));
// With no end date but only first, check it behaves
dates.clear();
currentDate.set(2011,7-1,2,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2011,7,1), null,
true, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-21", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,7-1,19,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2011,7,19), null,
true, 1);
assertEquals(1, dates.size());
assertEquals("2013-02-21", dateFmt.format(dates.get(0)));
}
/**
* eg the 2nd Thursday in every March
*/
@Test public void yearlyRecurrenceByDayOfWeekInMonth()
{
List<Date> dates = new ArrayList<Date>();
Calendar currentDate = Calendar.getInstance();
// How Outlook ought to do it
Map<String,String> params = new HashMap<String, String>();
params.put("COUNT", "7");
params.put("BYMONTH", "2");
params.put("BYDAY", "SA");
params.put("BYSETPOS", "2");
// 2nd Saturday in February is 11th Feb 2012, 9th Feb 2013
// Note - outlook seems to like to set these as monthly...
// FREQ=MONTHLY;COUNT=7;BYDAY=SA;BYMONTH=2;BYSETPOS=2;INTERVAL=1
// This is right except for the FREQ!
Map<String,String> paramsOUTLOOK = new HashMap<String, String>();
paramsOUTLOOK.put("FREQ", "MONTHLY");
paramsOUTLOOK.put("COUNT", "7");
paramsOUTLOOK.put("BYMONTH", "2");
paramsOUTLOOK.put("BYDAY", "SA");
paramsOUTLOOK.put("BYSETPOS", "2");
paramsOUTLOOK.put("INTERVAL", "1");
// Check that the outlook crazy version gets fixed
Map<String,String> paramsFIXED = RecurrenceHelper.fixOutlookRecurrenceQuirks(paramsOUTLOOK);
assertEquals("YEARLY", paramsFIXED.get("FREQ"));
assertEquals("2", paramsFIXED.get("BYMONTH"));
assertEquals("SA", paramsFIXED.get("BYDAY"));
assertEquals("2", paramsFIXED.get("BYSETPOS"));
assertEquals("7", paramsFIXED.get("COUNT"));
assertEquals("1", paramsFIXED.get("INTERVAL"));
assertEquals(null, paramsFIXED.get("BYMONTHDAY"));
// Dates in the past, get nothing
dates.clear();
currentDate.set(2012,1-1,19,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,4), date(2012,2,5),
true, 1);
assertEquals(0, dates.size());
dates.clear();
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,4), date(2012,2,5),
false, 1);
assertEquals(0, dates.size());
// With the month that contains it
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2012,2,26),
true, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-11", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2012,2,26),
false, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-11", dateFmt.format(dates.get(0)));
// In the next month
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2012,3,26),
true, 1);
assertEquals(0, dates.size());
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2012,3,26),
false, 1);
assertEquals(0, dates.size());
// From before, into the next year
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2013,3,26),
true, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-11", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,2-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,2,1), date(2013,3,26),
false, 1);
assertEquals(2, dates.size());
assertEquals("2012-02-11", dateFmt.format(dates.get(0)));
assertEquals("2013-02-09", dateFmt.format(dates.get(1)));
// From next month, into the next year
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2013,2,26),
true, 1);
assertEquals(1, dates.size());
assertEquals("2013-02-09", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,3-1,1,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2012,3,1), date(2013,3,26),
false, 1);
assertEquals(1, dates.size());
assertEquals("2013-02-09", dateFmt.format(dates.get(0)));
// With no end date but only first, check it behaves
dates.clear();
currentDate.set(2011,7-1,2,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2011,7,1), null,
true, 1);
assertEquals(1, dates.size());
assertEquals("2012-02-11", dateFmt.format(dates.get(0)));
dates.clear();
currentDate.set(2012,7-1,19,10,30);
RecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params,
date(2011,7,19), null,
true, 1);
assertEquals(1, dates.size());
assertEquals("2013-02-09", dateFmt.format(dates.get(0)));
}
/**
* Checks we correctly build the Timezone for somewhere
@@ -921,6 +1229,11 @@ public class CalendarHelpersTest
CalendarRecurrenceHelper.buildYearlyRecurrences(
currentDate, dates, params, onOrAfter, until, firstOnly, interval);
}
protected static Map<String,String> fixOutlookRecurrenceQuirks(Map<String,String> params)
{
return CalendarRecurrenceHelper.fixOutlookRecurrenceQuirks(params);
}
}
private static Date date(int year, int month, int day)