Search in sources :

Example 1 with TestSystemFactory

use of liquibase.extension.testing.testsystem.TestSystemFactory 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 2 with TestSystemFactory

use of liquibase.extension.testing.testsystem.TestSystemFactory 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)2 TestSystemFactory (liquibase.extension.testing.testsystem.TestSystemFactory)2 HashMap (java.util.HashMap)1