Search in sources :

Example 1 with TestServer

use of io.divolte.server.ServerTestUtils.TestServer in project divolte-collector by divolte.

the class JsonSourceTest method startRequest.

private HttpURLConnection startRequest() throws IOException {
    final TestServer testServer = this.testServer.orElseThrow(() -> new IllegalStateException("No test server available"));
    final String url = String.format(urlTemplate.orElseThrow(() -> new IllegalStateException("No URL template available")), testServer.host, testServer.port);
    return (HttpURLConnection) new URL(url).openConnection();
}
Also used : HttpURLConnection(java.net.HttpURLConnection) URL(java.net.URL) TestServer(io.divolte.server.ServerTestUtils.TestServer)

Example 2 with TestServer

use of io.divolte.server.ServerTestUtils.TestServer in project divolte-collector by divolte.

the class SeleniumTestBase method doSetUp.

private void doSetUp(final Optional<String> configFileName) throws Exception {
    final String driverName = System.getenv().getOrDefault(DRIVER_ENV_VAR, PHANTOMJS_DRIVER);
    switch(driverName) {
        case CHROME_DRIVER:
            setupLocalChrome();
            break;
        case SAFARI_DRIVER:
            driver = new SafariDriver();
            break;
        case SAUCE_DRIVER:
            setupSauceLabs();
            break;
        case BS_DRIVER:
            setupBrowserStack();
            break;
        case PHANTOMJS_DRIVER:
        default:
            driver = new PhantomJSDriver();
            break;
    }
    final WebDriverWait wait = new WebDriverWait(driver, 30);
    wait.until(WINDOW_AVAILABLE);
    server = configFileName.map(TestServer::new).orElseGet(TestServer::new);
}
Also used : PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) SafariDriver(org.openqa.selenium.safari.SafariDriver) TestServer(io.divolte.server.ServerTestUtils.TestServer)

Example 3 with TestServer

use of io.divolte.server.ServerTestUtils.TestServer in project divolte-collector by divolte.

the class DslRecordMapperTest method setupServer.

private void setupServer(final String mapping) throws IOException {
    mappingFile = File.createTempFile("test-mapping", ".groovy");
    copyResourceToFile(mapping, mappingFile);
    avroFile = File.createTempFile("TestSchema-", ".avsc");
    copyResourceToFile("TestRecord.avsc", avroFile);
    final ImmutableMap<String, Object> mappingConfig = ImmutableMap.of("divolte.mappings.test.mapping_script_file", mappingFile.getAbsolutePath(), "divolte.mappings.test.schema_file", avroFile.getAbsolutePath());
    server = new TestServer("base-test-server.conf", mappingConfig);
}
Also used : TestServer(io.divolte.server.ServerTestUtils.TestServer)

Example 4 with TestServer

use of io.divolte.server.ServerTestUtils.TestServer in project divolte-collector by divolte.

the class RequestChecksumTest method setServerConf.

private void setServerConf(final Map<String, Object> configurationProperties) {
    if (null == server || !configurationProperties.equals(serverProperties)) {
        serverProperties = ImmutableMap.copyOf(configurationProperties);
        setServer(new TestServer("base-test-server.conf", serverProperties));
    }
}
Also used : TestServer(io.divolte.server.ServerTestUtils.TestServer)

Aggregations

TestServer (io.divolte.server.ServerTestUtils.TestServer)4 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)1 SafariDriver (org.openqa.selenium.safari.SafariDriver)1 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)1