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

rombert pushed a commit to branch feature/SLING-7605
in repository https://gitbox.apache.org/repos/asf/sling-ide-tooling.git


The following commit(s) were added to refs/heads/feature/SLING-7605 by this 
push:
     new da3891b  SLING-7605 - ContentDeploymentTest sometimes fails on Jenkins
da3891b is described below

commit da3891b6a801ea6880992579612f41d060fc68e9
Author: Robert Munteanu <[email protected]>
AuthorDate: Mon Feb 25 15:27:19 2019 +0100

    SLING-7605 - ContentDeploymentTest sometimes fails on Jenkins
    
    Check for the JCR repository being available in ExternalSlingLaunchpad.
    It seems that the previous checks are not working after moving to Sling
    11, and hopefully this brings more stability.
---
 .../test/impl/helpers/ExternalSlingLaunchpad.java  | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
 
b/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
index b6f1376..11967b9 100644
--- 
a/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
+++ 
b/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
@@ -62,6 +62,7 @@ public class ExternalSlingLaunchpad extends ExternalResource {
         List<SlingReadyRule> rules = new ArrayList<>();
         rules.add(new StartLevelSlingReadyRule(client));
         rules.add(new ActiveBundlesSlingReadyRule(client));
+        rules.add(new RepositoryAvailableReadyRule(client));
 
         for (SlingReadyRule rule : rules) {
             while (true) {
@@ -173,4 +174,27 @@ public class ExternalSlingLaunchpad extends 
ExternalResource {
             return false;
         }
     }
+    
+    private class RepositoryAvailableReadyRule implements SlingReadyRule {
+        private final HttpClient client;
+
+        public RepositoryAvailableReadyRule(HttpClient client) {
+            this.client = client;
+        }
+        
+        @Override
+        public boolean evaluate() throws Exception {
+            
+            for ( String prefix: new String[] { "server", "crx/server"} ) {
+                GetMethod get = new GetMethod(config.getUrl() + prefix + 
"/default/jcr:root/content");
+                
+                int status = client.executeMethod(get);
+                debug("repository check call at entry point " + prefix + " got 
status " + status);
+                if ( status == 200 ) 
+                    return true;
+            }
+            
+            return false;
+        }
+    }
 }

Reply via email to