From bdff1bca64da881e33b5bf832508536abfdf1e60 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Wed, 12 Feb 2014 09:24:13 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud) 59891: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 59686: Merged PATCHES/V4.2.1 (4.2.1) to V4.2-BUG-FIX (4.2.2) 59685 : Merged DEV to PATCHES/V4.2.1 (4.2.1) 59669 : MNT-10257 : Error during synchronization: java.lang.Integer cannot be cast to java.lang.Long - New fix for this issue was implemented. - Unit test was added. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62210 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../ChainingUserRegistrySynchronizer.java | 2 +- .../ChainingUserRegistrySynchronizerTest.java | 26 +++++++++++++++++++ source/test-resources/sync-test-context.xml | 4 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java b/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java index 938f622df9..f716e53d3e 100644 --- a/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java +++ b/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java @@ -2101,7 +2101,7 @@ public class ChainingUserRegistrySynchronizer extends AbstractLifecycleBean ChainingUserRegistrySynchronizer.ROOT_ATTRIBUTE_PATH, ChainingUserRegistrySynchronizer.START_TIME_ATTRIBUTE); ChainingUserRegistrySynchronizer.this.attributeService.setAttribute( - -1, + -1L, ChainingUserRegistrySynchronizer.ROOT_ATTRIBUTE_PATH, ChainingUserRegistrySynchronizer.END_TIME_ATTRIBUTE); ChainingUserRegistrySynchronizer.this.attributeService.setAttribute( diff --git a/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java b/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java index 47fffe907d..4e1fca3523 100644 --- a/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java +++ b/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java @@ -41,6 +41,8 @@ import org.alfresco.service.namespace.QName; import org.alfresco.util.GUID; import org.alfresco.util.PropertyMap; import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.StaticApplicationContext; @@ -901,6 +903,30 @@ public class ChainingUserRegistrySynchronizerTest extends TestCase : AuthorityType.USER, shortName); } + /** + * A Test {@link ApplicationListener} that checks SyncEndTime before the SynchronizeEndEvent and SynchronizeDirectoryEndEvent events. + */ + public static class TestSynchronizeEventListener implements ApplicationListener + { + private ChainingUserRegistrySynchronizer synchronizer; + + public void setSynchronizer(ChainingUserRegistrySynchronizer synchronizer) + { + this.synchronizer = synchronizer; + } + + @Override + public void onApplicationEvent(ApplicationEvent event) + { + if (SynchronizeEndEvent.class.isAssignableFrom(event.getClass()) + || SynchronizeDirectoryEndEvent.class.isAssignableFrom(event.getClass())) + { + assertEquals(null, this.synchronizer.getSyncEndTime()); + } + } + + } + /** * A Mock {@link UserRegistry} that returns a fixed set of users and groups. */ diff --git a/source/test-resources/sync-test-context.xml b/source/test-resources/sync-test-context.xml index 67be04f180..47bec0188d 100644 --- a/source/test-resources/sync-test-context.xml +++ b/source/test-resources/sync-test-context.xml @@ -73,4 +73,8 @@ + + + + \ No newline at end of file