You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2020/05/19 08:25:41 UTC

[karaf] branch karaf-4.2.x updated: Make HttpResourceExampleTest more robust

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

jbonofre pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
     new ce22014  Make HttpResourceExampleTest more robust
ce22014 is described below

commit ce22014831e4db84b83ff83885236fb584c56bdb
Author: jbonofre <jb...@apache.org>
AuthorDate: Tue May 19 10:26:21 2020 +0200

    Make HttpResourceExampleTest more robust
---
 .../karaf/itests/examples/HttpResourceExampleTest.java       | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/itests/test/src/test/java/org/apache/karaf/itests/examples/HttpResourceExampleTest.java b/itests/test/src/test/java/org/apache/karaf/itests/examples/HttpResourceExampleTest.java
index cfe76eb..3ed7a11 100644
--- a/itests/test/src/test/java/org/apache/karaf/itests/examples/HttpResourceExampleTest.java
+++ b/itests/test/src/test/java/org/apache/karaf/itests/examples/HttpResourceExampleTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
@@ -29,18 +29,22 @@ import java.net.HttpURLConnection;
 import java.net.URL;
 
 @RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
+@ExamReactorStrategy(PerClass.class)
 public class HttpResourceExampleTest extends BaseTest {
 
-    @Test
+    @Test(timeout = 60000L)
     public void test() throws Exception {
         addFeaturesRepository("mvn:org.apache.karaf.examples/karaf-http-resource-example-features/" + System.getProperty("karaf.version") + "/xml");
 
         installAndAssertFeature("karaf-http-resource-example-whiteboard");
 
         String command = executeCommand("http:list");
-        System.out.println(command);
+        while (!command.contains("Deployed")) {
+            Thread.sleep(200);
+            command = executeCommand("http:list");
+        }
         assertContains("ResourceServlet", command);
+        assertContains("Deployed", command);
 
         URL url = new URL("http://localhost:" + getHttpPort() + "/example/index.html");
         HttpURLConnection connection = (HttpURLConnection) url.openConnection();