Search in sources :

Example 6 with AtlasDbServices

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();
    }
}
Also used : AtlasDbServices(com.palantir.atlasdb.services.AtlasDbServices)

Example 7 with AtlasDbServices

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();
}
Also used : InMemoryTestRunner(com.palantir.atlasdb.cli.runner.InMemoryTestRunner) DaggerTestAtlasDbServices(com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices) TestAtlasDbServices(com.palantir.atlasdb.services.test.TestAtlasDbServices) AtlasDbServices(com.palantir.atlasdb.services.AtlasDbServices)

Example 8 with AtlasDbServices

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);
}
Also used : InMemoryTestRunner(com.palantir.atlasdb.cli.runner.InMemoryTestRunner) DaggerTestAtlasDbServices(com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices) TestAtlasDbServices(com.palantir.atlasdb.services.test.TestAtlasDbServices) AtlasDbServices(com.palantir.atlasdb.services.AtlasDbServices)

Aggregations

AtlasDbServices (com.palantir.atlasdb.services.AtlasDbServices)8 InMemoryTestRunner (com.palantir.atlasdb.cli.runner.InMemoryTestRunner)2 DaggerTestAtlasDbServices (com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices)2 TestAtlasDbServices (com.palantir.atlasdb.services.test.TestAtlasDbServices)2 Functions (com.google.common.base.Functions)1 Stopwatch (com.google.common.base.Stopwatch)1 Maps (com.google.common.collect.Maps)1 Sets (com.google.common.collect.Sets)1 BaseEncoding (com.google.common.io.BaseEncoding)1 AtlasDbConstants (com.palantir.atlasdb.AtlasDbConstants)1 OutputPrinter (com.palantir.atlasdb.cli.output.OutputPrinter)1 PtBytes (com.palantir.atlasdb.encoding.PtBytes)1 SweepResults (com.palantir.atlasdb.keyvalue.api.SweepResults)1 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)1 LoggingArgs (com.palantir.atlasdb.logging.LoggingArgs)1 KeyValueServiceMigrator (com.palantir.atlasdb.schema.KeyValueServiceMigrator)1 TaskProgress (com.palantir.atlasdb.schema.TaskProgress)1 SweepPriorityTable (com.palantir.atlasdb.schema.generated.SweepPriorityTable)1 SweepTableFactory (com.palantir.atlasdb.schema.generated.SweepTableFactory)1 DaggerAtlasDbServices (com.palantir.atlasdb.services.DaggerAtlasDbServices)1