Search in sources :

Example 16 with PrivateWebserverForTest

use of org.webpieces.webserver.PrivateWebserverForTest 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 17 with PrivateWebserverForTest

use of org.webpieces.webserver.PrivateWebserverForTest in project webpieces by deanhiller.

the class TestSynchronousErrors method setUp.

@Before
public void setUp() throws InterruptedException, ClassNotFoundException, ExecutionException, TimeoutException {
    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 single threaded(tradeoffs, tradeoffs)
    // This is however pretty fast to do in many systems...
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(getOverrides(false, new SimpleMeterRegistry()), new AppOverridesModule(), false, null);
    webserver.start();
    http11Socket = connectHttp(false, webserver.getUnderlyingHttpChannel().getLocalAddress());
}
Also used : PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Example 18 with PrivateWebserverForTest

use of org.webpieces.webserver.PrivateWebserverForTest in project webpieces by deanhiller.

the class TestBeansAndSplit method setUp.

@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
    VirtualFileClasspath metaFile = new VirtualFileClasspath("beansMeta.txt", PrivateWebserverForTest.class.getClassLoader());
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(getOverrides(false, new SimpleMeterRegistry()), new AppOverridesModule(), false, metaFile);
    webserver.start();
    channel.setDataListener(new DataReceiver());
    ConnectionListener listener = mgr.getHttpConnection();
    XFuture<DataListener> future = listener.connected(channel, true);
    dataListener = future.get(2, TimeUnit.SECONDS);
}
Also used : PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) DataListener(org.webpieces.nio.api.handlers.DataListener) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener) Before(org.junit.Before)

Example 19 with PrivateWebserverForTest

use of org.webpieces.webserver.PrivateWebserverForTest in project webpieces by deanhiller.

the class TestUrlHtmlEncoding method setUp.

@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
    VirtualFileClasspath metaFile = new VirtualFileClasspath("beansMeta.txt", PrivateWebserverForTest.class.getClassLoader());
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(getOverrides(false, new SimpleMeterRegistry()), null, false, metaFile);
    webserver.start();
    http11Socket = connectHttp(false, webserver.getUnderlyingHttpChannel().getLocalAddress());
}
Also used : PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) Before(org.junit.Before)

Example 20 with PrivateWebserverForTest

use of org.webpieces.webserver.PrivateWebserverForTest in project webpieces by deanhiller.

the class TestI18n method setUp.

@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
    Context.clear();
    VirtualFileClasspath metaFile = new VirtualFileClasspath("i18nMeta.txt", PrivateWebserverForTest.class.getClassLoader());
    PrivateWebserverForTest webserver = new PrivateWebserverForTest(getOverrides(false, new SimpleMeterRegistry()), null, false, metaFile);
    webserver.start();
    http11Socket = connectHttp(false, webserver.getUnderlyingHttpChannel().getLocalAddress());
}
Also used : PrivateWebserverForTest(org.webpieces.webserver.PrivateWebserverForTest) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) Before(org.junit.Before)

Aggregations

SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)43 PrivateWebserverForTest (org.webpieces.webserver.PrivateWebserverForTest)43 Before (org.junit.Before)42 VirtualFileClasspath (org.webpieces.util.file.VirtualFileClasspath)37 Module (com.google.inject.Module)4 JdbcApi (org.webpieces.ddl.api.JdbcApi)4 PrivateTestConfig (org.webpieces.webserver.PrivateTestConfig)4 OverridesForTestRealServer (org.webpieces.webserver.test.OverridesForTestRealServer)4 ArrayList (java.util.ArrayList)2 TemplateCompileConfig (org.webpieces.templatingdev.api.TemplateCompileConfig)2 VirtualFile (org.webpieces.util.file.VirtualFile)2 OverridesForEmbeddedSvrWithParsing (org.webpieces.webserver.test.OverridesForEmbeddedSvrWithParsing)2 File (java.io.File)1 Test (org.junit.Test)1 CompileConfig (org.webpieces.compiler.api.CompileConfig)1 TwoPools (org.webpieces.data.api.TwoPools)1 DevRouterModule (org.webpieces.devrouter.api.DevRouterModule)1 HttpSocket (org.webpieces.httpclient11.api.HttpSocket)1 ConnectionListener (org.webpieces.nio.api.handlers.ConnectionListener)1 DataListener (org.webpieces.nio.api.handlers.DataListener)1