stefan-egli commented on a change in pull request #4:
URL: 
https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/4#discussion_r708364823



##########
File path: 
src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java
##########
@@ -414,4 +428,352 @@ public void testPropertyProviderRegistrations() throws 
Exception{
         discoveryService.unbindPropertyProvider(p, m);
         discoveryService.updatedPropertyProvider(p, m);
     }
-}
+
+    @Test
+    public void simpleNewJoinerTest() throws Exception {
+        doSimpleNewJoinerTest(0);
+    }
+
+    @Test
+    public void simpleNewJoinerTestWithDelay() throws Exception {
+        doSimpleNewJoinerTest(2);
+    }
+
+    private void doSimpleNewJoinerTest(int joinerDelaySeconds) throws 
Exception {
+        OakVirtualInstanceBuilder builder1 =
+                (OakVirtualInstanceBuilder) new OakVirtualInstanceBuilder()
+                .setDebugName("instance1")
+                .newRepository("/foo/barrio/foo/", true)
+                .setConnectorPingInterval(999)
+                .setConnectorPingTimeout(999);
+        builder1.getConfig().setSyncTokenEnabled(true);
+        builder1.getConfig().setJoinerDelaySeconds(joinerDelaySeconds);
+        VirtualInstance instance1 = builder1.build();
+        DummyListener listener1 = new DummyListener();
+        OakDiscoveryService discoveryService1 = (OakDiscoveryService) 
instance1.getDiscoveryService();
+        discoveryService1.bindTopologyEventListener(listener1);
+
+        instance1.heartbeatsAndCheckView();
+        instance1.heartbeatsAndCheckView();
+
+        assertEquals(0, 
discoveryService1.getViewStateManager().waitForAsyncEvents(2000));
+        Thread.sleep(1000);

Review comment:
       Created SLING-10813 to follow-up. It would imply removing 
`Thread.sleep()` in many places - so ideally done outside of the scope of this 
PR, wdyt?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to