use of net.sourceforge.argparse4j.inf.Namespace in project dropwizard by dropwizard.
the class DbGenerateDocsCommandTest method testRun.
@Test
public void testRun() throws Exception {
Liquibase liquibase = Mockito.mock(Liquibase.class);
generateDocsCommand.run(new Namespace(ImmutableMap.of("output", ImmutableList.of("/tmp/docs"))), liquibase);
Mockito.verify(liquibase).generateDocumentation("/tmp/docs");
}
use of net.sourceforge.argparse4j.inf.Namespace in project dropwizard by dropwizard.
the class DbClearChecksumsCommandTest method testRun.
@Test
public void testRun() throws Exception {
final Liquibase liquibase = Mockito.mock(Liquibase.class);
clearChecksums.run(new Namespace(ImmutableMap.of()), liquibase);
Mockito.verify(liquibase).clearCheckSums();
}
use of net.sourceforge.argparse4j.inf.Namespace in project dropwizard by dropwizard.
the class DbDropAllCommandTest method testRun.
@Test
public void testRun() throws Exception {
final String databaseUrl = getDatabaseUrl();
final TestMigrationConfiguration conf = createConfiguration(databaseUrl);
// Create some data
new DbMigrateCommand<>(TestMigrationConfiguration::getDataSource, TestMigrationConfiguration.class, "migrations.xml").run(null, new Namespace(ImmutableMap.of()), conf);
// Drop it
dropAllCommand.run(null, new Namespace(ImmutableMap.of()), conf);
// After we dropped data and schema, we should be able to create the "persons" table again
try (Handle handle = new DBI(databaseUrl, "sa", "").open()) {
handle.execute("create table persons(id int, name varchar(255))");
}
}
use of net.sourceforge.argparse4j.inf.Namespace in project dropwizard by dropwizard.
the class DbPrepareRollbackCommandTest method testRun.
@Test
public void testRun() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
prepareRollbackCommand.setOutputStream(new PrintStream(baos));
prepareRollbackCommand.run(null, new Namespace(ImmutableMap.of()), conf);
assertThat(baos.toString(UTF_8)).contains("ALTER TABLE PUBLIC.persons DROP COLUMN email;").contains("DROP TABLE PUBLIC.persons;");
}
use of net.sourceforge.argparse4j.inf.Namespace in project dropwizard by dropwizard.
the class DbRollbackCommandTest method testRollbackNChangesAsDryRun.
@Test
public void testRollbackNChangesAsDryRun() throws Exception {
// Migrate some DDL changes to the database
migrateCommand.run(null, new Namespace(ImmutableMap.of()), conf);
// Print out the change that rollbacks the second change
rollbackCommand.setOutputStream(new PrintStream(baos, true));
rollbackCommand.run(null, new Namespace(ImmutableMap.of("count", 1, "dry-run", true)), conf);
assertThat(baos.toString(UTF_8)).containsIgnoringCase("ALTER TABLE PUBLIC.persons DROP COLUMN email;");
}
Aggregations