Search in sources :

Example 1 with JsonConfigurationFactory

use of io.dropwizard.configuration.JsonConfigurationFactory in project liftwizard by motlin.

the class ExecutorServiceFactoryTest method invalidExecutorServiceFactory.

@Test
public void invalidExecutorServiceFactory() throws Exception {
    URL resource = Resources.getResource("invalid-executor-service-config-test.json5");
    File json = new File(resource.toURI());
    JsonConfigurationFactory<ExecutorServiceFactory> factory = new JsonConfigurationFactory<>(ExecutorServiceFactory.class, this.validator, this.objectMapper, "dw");
    try {
        ExecutorServiceFactory executorServiceFactory = factory.build(json);
        Assert.fail();
    } catch (ConfigurationValidationException e) {
        String message = e.getMessage();
        assertThat(message, containsString("maxThreads < minThreads"));
    }
}
Also used : JsonConfigurationFactory(io.dropwizard.configuration.JsonConfigurationFactory) ConfigurationValidationException(io.dropwizard.configuration.ConfigurationValidationException) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 2 with JsonConfigurationFactory

use of io.dropwizard.configuration.JsonConfigurationFactory in project liftwizard by motlin.

the class ExecutorServiceFactoryTest method executorServiceFactory.

@Test
public void executorServiceFactory() throws Exception {
    URL resource = Resources.getResource("executor-service-config-test.json5");
    File json = new File(resource.toURI());
    JsonConfigurationFactory<ExecutorServiceFactory> factory = new JsonConfigurationFactory<>(ExecutorServiceFactory.class, this.validator, this.objectMapper, "dw");
    ExecutorServiceFactory executorServiceFactory = factory.build(json);
}
Also used : JsonConfigurationFactory(io.dropwizard.configuration.JsonConfigurationFactory) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 3 with JsonConfigurationFactory

use of io.dropwizard.configuration.JsonConfigurationFactory in project liftwizard by motlin.

the class ExecutorServiceFactoryTest method scheduledExecutorServiceFactory.

@Test
public void scheduledExecutorServiceFactory() throws Exception {
    URL resource = Resources.getResource("executor-service-config-test.json5");
    File json = new File(resource.toURI());
    JsonConfigurationFactory<ScheduledExecutorServiceFactory> factory = new JsonConfigurationFactory<>(ScheduledExecutorServiceFactory.class, this.validator, this.objectMapper, "dw");
    ScheduledExecutorServiceFactory executorServiceFactory = factory.build(json);
}
Also used : JsonConfigurationFactory(io.dropwizard.configuration.JsonConfigurationFactory) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Aggregations

JsonConfigurationFactory (io.dropwizard.configuration.JsonConfigurationFactory)3 File (java.io.File)3 URL (java.net.URL)3 Test (org.junit.Test)3 ConfigurationValidationException (io.dropwizard.configuration.ConfigurationValidationException)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1