You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2020/11/24 16:14:08 UTC

[sling-org-apache-sling-servlets-annotations] branch master updated: SLING-9930 - use BeforeClass for waiting on Sling, and make that a bit more robust

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

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git


The following commit(s) were added to refs/heads/master by this push:
     new 03a4db4  SLING-9930 - use BeforeClass for waiting on Sling, and make that a bit more robust
03a4db4 is described below

commit 03a4db43f35edc1350abf57010cb4c40206761e0
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Nov 24 17:13:53 2020 +0100

    SLING-9930 - use BeforeClass for waiting on Sling, and make that a bit more robust
---
 .../sling/servlets/annotations/AnnotationsTestSupport.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/servlets/annotations/AnnotationsTestSupport.java b/src/it/annotations-it/src/test/java/org/apache/sling/servlets/annotations/AnnotationsTestSupport.java
index 5042ac8..49137b9 100644
--- a/src/it/annotations-it/src/test/java/org/apache/sling/servlets/annotations/AnnotationsTestSupport.java
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/servlets/annotations/AnnotationsTestSupport.java
@@ -20,7 +20,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.servlets.annotations.services.PathBoundService;
 import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
 import org.apache.sling.testing.paxexam.TestSupport;
-import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
@@ -41,7 +41,7 @@ public class AnnotationsTestSupport extends TestSupport {
 
     private final static int STARTUP_WAIT_SECONDS = 30;
 
-    protected OsgiConsoleClient CLIENT;
+    protected static OsgiConsoleClient CLIENT;
     protected static int httpPort;
 
     @ClassRule
@@ -107,11 +107,17 @@ public class AnnotationsTestSupport extends TestSupport {
         ).getOptions();
     }
 
-    @Before
-    public void waitForSling() throws Exception {
+    @BeforeClass
+    public static void waitForSling() throws Exception {
         final URI url = new URI(String.format("http://localhost:%d", httpPort));
         CLIENT = new OsgiConsoleClient(url, "admin", "admin");
         CLIENT.waitExists("/", STARTUP_WAIT_SECONDS * 1000, 500);
         CLIENT.waitComponentRegistered(PathBoundService.class.getName(), 10 * 1000, 500);
+
+        // Verify stable status for a bit
+        for(int i=0; i < 10 ; i++) {
+            CLIENT.waitComponentRegistered(PathBoundService.class.getName(), 1000, 100);
+            Thread.sleep(100);
+        }
     }
 }