Search in sources :

Example 1 with ExamSystem

use of org.ops4j.pax.exam.ExamSystem in project sling by apache.

the class ITWebConsoleRemote method setUp.

@Before
public void setUp() throws IOException {
    // static method
    if (testContainer == null) {
        ExamSystem system = DefaultExamSystem.create(config());
        testContainer = PaxExamRuntime.createContainer(system);
        testContainer.start();
    }
}
Also used : ExamSystem(org.ops4j.pax.exam.ExamSystem) DefaultExamSystem(org.ops4j.pax.exam.spi.DefaultExamSystem) Before(org.junit.Before)

Example 2 with ExamSystem

use of org.ops4j.pax.exam.ExamSystem in project sling by apache.

the class ITMDCFilter method startContainer.

@Before
public void startContainer() throws Exception {
    if (testContainer == null) {
        ServerConfiguration sc = new ServerConfiguration();
        ExamSystem system = DefaultExamSystem.create(sc.config());
        testContainer = PaxExamRuntime.createContainer(system);
        testContainer.start();
        new RetryLoop(new RetryLoop.Condition() {

            public String getDescription() {
                return "Check if MDCTestServlet is up";
            }

            public boolean isTrue() throws Exception {
                RequestBuilder rb = new RequestBuilder(ServerConfiguration.getServerUrl());
                executor.execute(rb.buildGetRequest("/mdc")).assertStatus(200);
                rb = new RequestBuilder(ServerConfiguration.getServerUrl());
                //Create test config via servlet
                executor.execute(rb.buildGetRequest("/mdc", "createTestConfig", "true"));
                TimeUnit.SECONDS.sleep(1);
                return true;
            }
        }, 5, 100);
    }
}
Also used : ExamSystem(org.ops4j.pax.exam.ExamSystem) DefaultExamSystem(org.ops4j.pax.exam.spi.DefaultExamSystem) RequestBuilder(org.apache.sling.testing.tools.http.RequestBuilder) RetryLoop(org.apache.sling.testing.tools.retry.RetryLoop) IOException(java.io.IOException) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 ExamSystem (org.ops4j.pax.exam.ExamSystem)2 DefaultExamSystem (org.ops4j.pax.exam.spi.DefaultExamSystem)2 IOException (java.io.IOException)1 RequestBuilder (org.apache.sling.testing.tools.http.RequestBuilder)1 RetryLoop (org.apache.sling.testing.tools.retry.RetryLoop)1