Search in sources :

Example 21 with BQRuntime

use of io.bootique.BQRuntime in project bootique-mvc by bootique.

the class MvcMustacheModuleProviderTest method testModuleDeclaresDependencies.

@Test
public void testModuleDeclaresDependencies() {
    final BQRuntime bqRuntime = testFactory.app().module(new MvcMustacheModuleProvider()).createRuntime();
    BQRuntimeChecker.testModulesLoaded(bqRuntime, JerseyModule.class, MvcModule.class, MvcMustacheModule.class);
}
Also used : BQRuntime(io.bootique.BQRuntime) Test(org.junit.Test)

Example 22 with BQRuntime

use of io.bootique.BQRuntime in project bootique-mvc by bootique.

the class MvcModuleProviderTest method testModuleDeclaresDependencies.

@Test
public void testModuleDeclaresDependencies() {
    final BQRuntime bqRuntime = testFactory.app().module(new MvcModuleProvider()).createRuntime();
    BQRuntimeChecker.testModulesLoaded(bqRuntime, JerseyModule.class, MvcModule.class);
}
Also used : BQRuntime(io.bootique.BQRuntime) Test(org.junit.Test)

Example 23 with BQRuntime

use of io.bootique.BQRuntime in project bootique-linkmove by bootique.

the class LinkMoveModuleProviderIT method testModuleDeclaresDependencies.

@Test
public void testModuleDeclaresDependencies() {
    final BQRuntime bqRuntime = testFactory.app().module(new LinkMoveModuleProvider()).createRuntime();
    BQRuntimeChecker.testModulesLoaded(bqRuntime, JdbcModule.class, LinkMoveModule.class, CayenneModule.class);
}
Also used : BQRuntime(io.bootique.BQRuntime) Test(org.junit.Test)

Example 24 with BQRuntime

use of io.bootique.BQRuntime in project tutorials by eugenp.

the class AppTest method givenService_expectBoolen.

@Test
public void givenService_expectBoolen() {
    BQRuntime runtime = bqTestFactory.app("--server").autoLoadModules().createRuntime();
    HelloService service = runtime.getInstance(HelloService.class);
    assertEquals(true, service.save());
}
Also used : BQRuntime(io.bootique.BQRuntime) HelloService(com.baeldung.bootique.service.HelloService) Test(org.junit.Test)

Example 25 with BQRuntime

use of io.bootique.BQRuntime in project bootique-jdbc by bootique.

the class HikariCPInstrumentedModuleIT method testHealthChecksMultipleDs.

@Test
public void testHealthChecksMultipleDs() throws SQLException {
    BQRuntime runtime = TEST_FACTORY.app("-c", "classpath:io/bootique/jdbc/instrumented/hikaricp/hikaricp-ds2-health.yml").autoLoadModules().createRuntime();
    DataSourceFactory factory = runtime.getInstance(DataSourceFactory.class);
    String derby2 = "derby2", derby3 = "derby3";
    HikariDataSource ds2 = (HikariDataSource) factory.forName(derby2);
    assertNotNull(ds2);
    HikariDataSource ds3 = (HikariDataSource) factory.forName(derby3);
    assertNotNull(ds3);
    HealthCheckRegistry registry = runtime.getInstance(HealthCheckRegistry.class);
    assertTrue(registry.containsHealthCheck(ConnectivityCheck.healthCheckName(derby2)));
    assertTrue(registry.containsHealthCheck(Connection99PercentCheck.healthCheckName(derby2)));
    /**
     * embedded health check {@link io.bootique.jdbc.instrumented.healthcheck.DataSourceHealthCheck}
     */
    assertTrue(registry.containsHealthCheck(DataSourceHealthCheck.healthCheckName(derby2)));
    assertTrue(registry.containsHealthCheck(ConnectivityCheck.healthCheckName(derby3)));
    assertTrue(registry.containsHealthCheck(Connection99PercentCheck.healthCheckName(derby3)));
    /**
     * embedded health check {@link io.bootique.jdbc.instrumented.healthcheck.DataSourceHealthCheck}
     */
    assertTrue(registry.containsHealthCheck(DataSourceHealthCheck.healthCheckName(derby3)));
    Map<String, HealthCheckOutcome> results = registry.runHealthChecks();
    assertEquals(results.size(), 6);
}
Also used : DataSourceFactory(io.bootique.jdbc.DataSourceFactory) HikariDataSource(com.zaxxer.hikari.HikariDataSource) HealthCheckOutcome(io.bootique.metrics.health.HealthCheckOutcome) BQRuntime(io.bootique.BQRuntime) HealthCheckRegistry(io.bootique.metrics.health.HealthCheckRegistry) Test(org.junit.Test)

Aggregations

BQRuntime (io.bootique.BQRuntime)45 Test (org.junit.Test)39 DataSource (javax.sql.DataSource)23 DataSourceFactory (io.bootique.jdbc.DataSourceFactory)22 HikariDataSource (com.zaxxer.hikari.HikariDataSource)12 ProvisionException (com.google.inject.ProvisionException)10 BootiqueException (io.bootique.BootiqueException)10 BQTestFactory (io.bootique.test.junit.BQTestFactory)10 JsonTypeName (com.fasterxml.jackson.annotation.JsonTypeName)9 Injector (com.google.inject.Injector)9 Map (java.util.Map)9 Optional (java.util.Optional)9 Assert.assertNotNull (org.junit.Assert.assertNotNull)9 Assert.assertTrue (org.junit.Assert.assertTrue)9 Assert.fail (org.junit.Assert.fail)9 Rule (org.junit.Rule)9 Mockito.mock (org.mockito.Mockito.mock)9 JdbcModule (io.bootique.jdbc.JdbcModule)8 Connection (java.sql.Connection)7 ConfigurationFactory (io.bootique.config.ConfigurationFactory)6