Search in sources :

Example 1 with SingularityTestModule

use of com.hubspot.singularity.scheduler.SingularityTestModule in project Singularity by HubSpot.

the class SingularityCuratorTestBase method curatorSetup.

@Before
public final void curatorSetup() throws Exception {
    JerseyGuiceUtils.reset();
    singularityTestModule = new SingularityTestModule(useDBTests, customConfigSetup);
    singularityTestModule.getInjector().injectMembers(this);
    singularityTestModule.start();
}
Also used : SingularityTestModule(com.hubspot.singularity.scheduler.SingularityTestModule) Before(org.junit.Before)

Example 2 with SingularityTestModule

use of com.hubspot.singularity.scheduler.SingularityTestModule in project Singularity by HubSpot.

the class SingularityCuratorTestBase method setup.

@BeforeAll
public synchronized void setup() throws Exception {
    JerseyGuiceUtils.reset();
    singularityTestModule = new SingularityTestModule(useDBTests, customConfigSetup);
    singularityTestModule.getInjector().injectMembers(this);
    singularityTestModule.start();
    leaderCacheCoordinator.activateLeaderCache();
    configuration.setThreadpoolShutdownDelayInSeconds(0);
    if (useDBTests) {
        Handle handle = dbiProvider.get().open();
        handle.getConnection().setAutoCommit(true);
        Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(handle.getConnection()));
        Liquibase liquibase = new Liquibase("singularity_test.sql", new FileSystemResourceAccessor(), database);
        liquibase.update((String) null);
        try {
            database.close();
            handle.close();
        } catch (Throwable t) {
        }
    }
}
Also used : Liquibase(liquibase.Liquibase) Database(liquibase.database.Database) SingularityTestModule(com.hubspot.singularity.scheduler.SingularityTestModule) JdbcConnection(liquibase.database.jvm.JdbcConnection) FileSystemResourceAccessor(liquibase.resource.FileSystemResourceAccessor) Handle(org.jdbi.v3.core.Handle) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

SingularityTestModule (com.hubspot.singularity.scheduler.SingularityTestModule)2 Liquibase (liquibase.Liquibase)1 Database (liquibase.database.Database)1 JdbcConnection (liquibase.database.jvm.JdbcConnection)1 FileSystemResourceAccessor (liquibase.resource.FileSystemResourceAccessor)1 Handle (org.jdbi.v3.core.Handle)1 Before (org.junit.Before)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1