Make HttpResourceExampleTest more robust
@@ -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();
