This is an automated email from the ASF dual-hosted git repository.

stefanegli pushed a commit to branch SLING-11805
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-oak.git

commit c7bd05e2d1991bf6f150c919198118ebf7d190d1
Author: Stefan Egli <[email protected]>
AuthorDate: Thu Mar 16 12:12:12 2023 +0100

    SLING-11805 : added test to reproduce the current restricted behaviour
---
 .../discovery/oak/TestSlingIdCleanupTask.java      | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git 
a/src/test/java/org/apache/sling/discovery/oak/TestSlingIdCleanupTask.java 
b/src/test/java/org/apache/sling/discovery/oak/TestSlingIdCleanupTask.java
index 01ed7b9..b5d59cd 100644
--- a/src/test/java/org/apache/sling/discovery/oak/TestSlingIdCleanupTask.java
+++ b/src/test/java/org/apache/sling/discovery/oak/TestSlingIdCleanupTask.java
@@ -61,6 +61,7 @@ import org.apache.sling.discovery.oak.its.setup.OakTestConfig;
 import org.apache.sling.discovery.oak.its.setup.OakVirtualInstanceBuilder;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.osgi.framework.BundleContext;
@@ -426,6 +427,28 @@ public class TestSlingIdCleanupTask {
         assertEquals(10, cleanupTask.getDeleteCount());
     }
 
+    @Test
+    @Ignore(value = "currently fails")
+    public void testTopologyThenPropertiesChanged() throws Exception {
+        createCleanupTask(1000, 86400000);
+        assertEquals(0, cleanupTask.getDeleteCount());
+        createSlingIds(5, 10, 0);
+
+        TopologyView view1 = newView();
+        cleanupTask.handleTopologyEvent(newInitEvent(view1));
+        cleanupTask.handleTopologyEvent(newChangingEvent(view1));
+        assertEquals(0, cleanupTask.getDeleteCount());
+
+        TopologyView view2 = newView();
+        cleanupTask.handleTopologyEvent(newChangedEvent(view1, view2));
+        // below properties changed event must not stop the cleanup
+        cleanupTask.handleTopologyEvent(newPropertiesChangedEvent(view1, 
view2));
+        Thread.sleep(500);
+        assertEquals(0, cleanupTask.getDeleteCount());
+        waitForRunCount(cleanupTask, 1, 5000);
+        assertEquals(10, cleanupTask.getDeleteCount());
+    }
+
     @Test
     public void testRepetitionDelay() throws Exception {
         createCleanupTask(1000, 86400000);

Reply via email to