Search in sources :

Example 1 with OverridesForTestRealServer

use of org.webpieces.webserver.test.OverridesForTestRealServer in project webpieces by deanhiller.

the class SeleniumBasicTest method setUp.

@Before
public void setUp() throws InterruptedException, ClassNotFoundException {
    Asserts.assertWasCompiledWithParamNames("test");
    // you may want to create this server ONCE in a static method BUT if you do, also remember to clear out all your
    // mocks after every test AND you can no longer run multi-threaded(tradeoffs, tradeoffs)
    // This is however pretty fast to do in many systems...
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(new OverridesForTestRealServer(new SimpleMeterRegistry()), new AppOverridesModule(), true, null);
    webserver.start();
    port = webserver.getUnderlyingHttpChannel().getLocalAddress().getPort();
}
Also used : OverridesForTestRealServer(org.webpieces.webserver.test.OverridesForTestRealServer) PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Example 2 with OverridesForTestRealServer

use of org.webpieces.webserver.test.OverridesForTestRealServer in project webpieces by deanhiller.

the class TestPRGSelenium method setUp.

@Before
public void setUp() throws InterruptedException, ClassNotFoundException {
    Asserts.assertWasCompiledWithParamNames("test");
    VirtualFileClasspath metaFile = new VirtualFileClasspath("beansMeta.txt", PrivateWebserverForTest.class.getClassLoader());
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(new OverridesForTestRealServer(new SimpleMeterRegistry()), new AppOverridesModule(), true, metaFile);
    webserver.start();
    port = webserver.getUnderlyingHttpChannel().getLocalAddress().getPort();
}
Also used : OverridesForTestRealServer(org.webpieces.webserver.test.OverridesForTestRealServer) PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) Before(org.junit.Before)

Example 3 with OverridesForTestRealServer

use of org.webpieces.webserver.test.OverridesForTestRealServer in project webpieces by deanhiller.

the class TestStaticSelenium method setUp.

@Before
public void setUp() throws InterruptedException, ClassNotFoundException {
    Asserts.assertWasCompiledWithParamNames("test");
    VirtualFileClasspath metaFile = new VirtualFileClasspath("staticMeta.txt", PrivateWebserverForTest.class.getClassLoader());
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(new OverridesForTestRealServer(new SimpleMeterRegistry()), null, true, metaFile);
    webserver.start();
    port = webserver.getUnderlyingHttpChannel().getLocalAddress().getPort();
}
Also used : OverridesForTestRealServer(org.webpieces.webserver.test.OverridesForTestRealServer) PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) Before(org.junit.Before)

Example 4 with OverridesForTestRealServer

use of org.webpieces.webserver.test.OverridesForTestRealServer in project webpieces by deanhiller.

the class TestScopesSelenium method setUp.

@Before
public void setUp() throws InterruptedException, ClassNotFoundException {
    Asserts.assertWasCompiledWithParamNames("test");
    VirtualFileClasspath metaFile = new VirtualFileClasspath("scopesMeta.txt", PrivateWebserverForTest.class.getClassLoader());
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(new OverridesForTestRealServer(new SimpleMeterRegistry()), null, true, metaFile);
    webserver.start();
    port = webserver.getUnderlyingHttpChannel().getLocalAddress().getPort();
}
Also used : OverridesForTestRealServer(org.webpieces.webserver.test.OverridesForTestRealServer) PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) Before(org.junit.Before)

Example 5 with OverridesForTestRealServer

use of org.webpieces.webserver.test.OverridesForTestRealServer in project webpieces by deanhiller.

the class TestLesson5WithSelenium method setUp.

@Before
public void setUp() throws InterruptedException, ClassNotFoundException {
    driver = new FirefoxDriver();
    Asserts.assertWasCompiledWithParamNames("test");
    jdbc.dropAllTablesFromDatabase();
    metrics = new SimpleMeterRegistry();
    // you may want to create this server ONCE in a static method BUT if you do, also remember to clear out all your
    // mocks after every test and NOT drop tables but clear and re-populate
    Server webserver = new Server(new OverridesForTestRealServer(metrics), new AppOverridesModule(), new ServerConfig(JavaCache.getCacheLocation()), args);
    webserver.start();
    httpPort = webserver.getUnderlyingHttpChannel().getLocalAddress().getPort();
    httpsPort = webserver.getUnderlyingHttpsChannel().getLocalAddress().getPort();
}
Also used : ServerConfig(org.webpieces.webserver.api.ServerConfig) OverridesForTestRealServer(org.webpieces.webserver.test.OverridesForTestRealServer) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) OverridesForTestRealServer(org.webpieces.webserver.test.OverridesForTestRealServer) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Aggregations

SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)5 Before (org.junit.Before)5 OverridesForTestRealServer (org.webpieces.webserver.test.OverridesForTestRealServer)5 PrivateWebserverForTest (org.webpieces.webserver.PrivateWebserverForTest)4 VirtualFileClasspath (org.webpieces.util.file.VirtualFileClasspath)3 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)1 ServerConfig (org.webpieces.webserver.api.ServerConfig)1