use of com.palantir.atlasdb.services.AtlasDbServices in project atlasdb by palantir.
the class TestKvsMigrationCommand method runTestWithTableSpecs.
private void runTestWithTableSpecs(int numTables, int numEntriesPerTable) throws Exception {
KvsMigrationCommand cmd = getCommand(new String[] { "-smv" });
AtlasDbServices fromServices = cmd.connectFromServices();
// CLIs don't currently reinitialize the KVS
Schemas.createTablesAndIndexes(SweepSchema.INSTANCE.getLatestSchema(), fromServices.getKeyValueService());
AtlasDbServices toServices = cmd.connectToServices();
seedKvs(fromServices, numTables, numEntriesPerTable);
try {
int exitCode = cmd.execute(fromServices, toServices);
Assert.assertEquals(0, exitCode);
checkKvs(toServices, numTables, numEntriesPerTable);
} finally {
fromServices.close();
toServices.close();
}
}
use of com.palantir.atlasdb.services.AtlasDbServices in project atlasdb by palantir.
the class TestFastForwardTimestampCommand method fetchCurrentTimestamp.
private static long fetchCurrentTimestamp() throws Exception {
InMemoryTestRunner fetchRunner = new InMemoryTestRunner(FetchTimestamp.class, TIMESTAMP_GROUP, FETCH_COMMAND);
AtlasDbServices services = fetchRunner.connect(moduleFactory);
return services.getTimestampService().getFreshTimestamp();
}
use of com.palantir.atlasdb.services.AtlasDbServices in project atlasdb by palantir.
the class TestFastForwardTimestampCommand method checkFastForward.
private static void checkFastForward(long target, long expected) throws Exception {
InMemoryTestRunner runner = makeRunnerWithTargetTimestamp(target);
AtlasDbServices atlasDbServices = runner.connect(moduleFactory);
String response = runner.run();
// Unintuitive, but is consistent with existing CLI behaviour.
assertThat(response).contains("Timestamp successfully fast-forwarded to " + target);
assertThat(atlasDbServices.getTimestampService().getFreshTimestamp()).isEqualTo(expected + 1);
}
Aggregations