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