Search in sources :

Example 1 with TestSystem

use of liquibase.extension.testing.testsystem.TestSystem in project liquibase by liquibase.

the class LiquibaseIntegrationMethodInterceptor method startContainers.

private static void startContainers(List<FieldInfo> containers, IMethodInvocation invocation) throws Exception {
    for (FieldInfo field : containers) {
        TestSystem testSystem = readContainerFromField(field, invocation);
        Assume.assumeTrue("Not running test against " + testSystem.getDefinition() + ": liquibase.sdk.testSystem.test is " + configuredTestSystems, testSystem.shouldTest());
        testSystem.start();
    }
}
Also used : TestSystem(liquibase.extension.testing.testsystem.TestSystem) FieldInfo(org.spockframework.runtime.model.FieldInfo)

Example 2 with TestSystem

use of liquibase.extension.testing.testsystem.TestSystem in project liquibase by liquibase.

the class TestSystemDownCommand method run.

@Override
public void run(CommandResultsBuilder resultsBuilder) throws Exception {
    final TestSystem env = new TestSystemFactory().getTestSystem(resultsBuilder.getCommandScope().getConfiguredValue(NAME).getValue());
    env.stop();
}
Also used : TestSystem(liquibase.extension.testing.testsystem.TestSystem) TestSystemFactory(liquibase.extension.testing.testsystem.TestSystemFactory)

Example 3 with TestSystem

use of liquibase.extension.testing.testsystem.TestSystem in project liquibase by liquibase.

the class TestSystemUpCommand method run.

@Override
public void run(CommandResultsBuilder resultsBuilder) throws Exception {
    final String name = resultsBuilder.getCommandScope().getConfiguredValue(NAME).getValue();
    final String version = resultsBuilder.getCommandScope().getConfiguredValue(VERSION).getValue();
    final String profiles = resultsBuilder.getCommandScope().getConfiguredValue(PROFILES).getValue();
    final Boolean acceptLicenses = resultsBuilder.getCommandScope().getConfiguredValue(ACCEPT_LICENSES).getValue();
    String definition = name;
    if (profiles != null) {
        definition = name + ":" + profiles;
    }
    if (version != null) {
        definition += "?version=" + version;
    }
    final TestSystem testSystem = new TestSystemFactory().getTestSystem(definition);
    Map<String, Object> scopeValues = new HashMap<>();
    if (acceptLicenses) {
        scopeValues.put("liquibase.sdk.testSystem.acceptLicenses", testSystem.getDefinition().getName());
    }
    Scope.child(scopeValues, testSystem::start);
}
Also used : TestSystem(liquibase.extension.testing.testsystem.TestSystem) HashMap(java.util.HashMap) TestSystemFactory(liquibase.extension.testing.testsystem.TestSystemFactory)

Aggregations

TestSystem (liquibase.extension.testing.testsystem.TestSystem)3 TestSystemFactory (liquibase.extension.testing.testsystem.TestSystemFactory)2 HashMap (java.util.HashMap)1 FieldInfo (org.spockframework.runtime.model.FieldInfo)1