Search in sources :

Example 1 with WebserverForTest

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

the class TestAjaxHibernate method setUp.

@Before
public void setUp() {
    //clear in-memory database
    JdbcApi jdbc = JdbcFactory.create(JdbcConstants.jdbcUrl, JdbcConstants.jdbcUser, JdbcConstants.jdbcPassword);
    jdbc.dropAllTablesFromDatabase();
    VirtualFileClasspath metaFile = new VirtualFileClasspath("plugins/hibernateMeta.txt", WebserverForTest.class.getClassLoader());
    TestConfig config = new TestConfig();
    config.setPlatformOverrides(platformOverrides);
    config.setAppOverrides(new TestModule());
    config.setMetaFile(metaFile);
    WebserverForTest webserver = new WebserverForTest(config);
    webserver.start();
    http11Socket = http11Simulator.openHttp();
}
Also used : TestConfig(org.webpieces.webserver.TestConfig) WebserverForTest(org.webpieces.webserver.WebserverForTest) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) JdbcApi(org.webpieces.ddl.api.JdbcApi) Before(org.junit.Before)

Example 2 with WebserverForTest

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

the class TestAsyncHibernate method setUp.

@Before
public void setUp() {
    //clear in-memory database
    JdbcApi jdbc = JdbcFactory.create(JdbcConstants.jdbcUrl, JdbcConstants.jdbcUser, JdbcConstants.jdbcPassword);
    jdbc.dropAllTablesFromDatabase();
    mockExecutor.clear();
    VirtualFileClasspath metaFile = new VirtualFileClasspath("plugins/hibernateMeta.txt", WebserverForTest.class.getClassLoader());
    TestConfig config = new TestConfig();
    config.setPlatformOverrides(platformOverrides);
    config.setAppOverrides(new TestOverrides());
    config.setMetaFile(metaFile);
    WebserverForTest webserver = new WebserverForTest(config);
    webserver.start();
    http11Socket = http11Simulator.openHttp();
}
Also used : TestConfig(org.webpieces.webserver.TestConfig) WebserverForTest(org.webpieces.webserver.WebserverForTest) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) JdbcApi(org.webpieces.ddl.api.JdbcApi) Before(org.junit.Before)

Example 3 with WebserverForTest

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

the class TestFlashAndSelect method setUp.

@Before
public void setUp() {
    //clear in-memory database
    JdbcApi jdbc = JdbcFactory.create(JdbcConstants.jdbcUrl, JdbcConstants.jdbcUser, JdbcConstants.jdbcPassword);
    jdbc.dropAllTablesFromDatabase();
    user = loadDataInDb();
    VirtualFileClasspath metaFile = new VirtualFileClasspath("plugins/hibernateMeta.txt", WebserverForTest.class.getClassLoader());
    TestConfig config = new TestConfig();
    config.setPlatformOverrides(platformOverrides);
    config.setMetaFile(metaFile);
    config.setAppOverrides(new TestModule(mock));
    WebserverForTest webserver = new WebserverForTest(config);
    webserver.start();
    http11Socket = http11Simulator.openHttp();
}
Also used : TestConfig(org.webpieces.webserver.TestConfig) WebserverForTest(org.webpieces.webserver.WebserverForTest) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) JdbcApi(org.webpieces.ddl.api.JdbcApi) Before(org.junit.Before)

Example 4 with WebserverForTest

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

the class TestUrlHtmlEncoding method setUp.

@Before
public void setUp() {
    VirtualFileClasspath metaFile = new VirtualFileClasspath("beansMeta.txt", WebserverForTest.class.getClassLoader());
    WebserverForTest webserver = new WebserverForTest(platformOverrides, null, false, metaFile);
    webserver.start();
    http11Socket = http11Simulator.openHttp();
}
Also used : WebserverForTest(org.webpieces.webserver.WebserverForTest) VirtualFileClasspath(org.webpieces.util.file.VirtualFileClasspath) Before(org.junit.Before)

Example 5 with WebserverForTest

use of org.webpieces.webserver.WebserverForTest 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...
    WebserverForTest webserver = new WebserverForTest(new SeleniumOverridesForTest(), new AppOverridesModule(), true, null);
    webserver.start();
    port = webserver.getUnderlyingHttpChannel().getLocalAddress().getPort();
}
Also used : WebserverForTest(org.webpieces.webserver.WebserverForTest) SeleniumOverridesForTest(org.webpieces.webserver.test.SeleniumOverridesForTest) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)34 WebserverForTest (org.webpieces.webserver.WebserverForTest)34 VirtualFileClasspath (org.webpieces.util.file.VirtualFileClasspath)29 JdbcApi (org.webpieces.ddl.api.JdbcApi)4 TestConfig (org.webpieces.webserver.TestConfig)4 SeleniumOverridesForTest (org.webpieces.webserver.test.SeleniumOverridesForTest)4 Module (com.google.inject.Module)3 ArrayList (java.util.ArrayList)2 TemplateCompileConfig (org.webpieces.templatingdev.api.TemplateCompileConfig)2 VirtualFile (org.webpieces.util.file.VirtualFile)2 VirtualFileImpl (org.webpieces.util.file.VirtualFileImpl)2 PlatformOverridesForTest (org.webpieces.webserver.test.PlatformOverridesForTest)2 File (java.io.File)1 Ignore (org.junit.Ignore)1 CompileConfig (org.webpieces.compiler.api.CompileConfig)1 DevRouterModule (org.webpieces.devrouter.api.DevRouterModule)1 TagOverridesModule (org.webpieces.webserver.api.TagOverridesModule)1