use of com.palantir.atlasdb.spi.KeyValueServiceConfig in project atlasdb by palantir.
the class AtlasDbCommandUtilsTest method setUp.
@Before
public void setUp() {
KeyValueServiceConfig kvsConfig = mock(KeyValueServiceConfig.class);
when(kvsConfig.namespace()).thenReturn(Optional.of("test"));
minimalLeaderConfig = ImmutableAtlasDbConfig.builder().leader(ImmutableLeaderConfig.builder().quorumSize(1).addLeaders(LOCAL_SERVER_NAME).localServer(LOCAL_SERVER_NAME).build()).keyValueService(kvsConfig).build();
minimalEmbeddedConfig = ImmutableAtlasDbConfig.builder().keyValueService(kvsConfig).build();
timeLockConfig = ImmutableAtlasDbConfig.builder().timelock(TIME_LOCK_CLIENT_CONFIG).keyValueService(kvsConfig).build();
runtimeConfig = ImmutableAtlasDbRuntimeConfig.builder().timelockRuntime(ImmutableTimeLockRuntimeConfig.builder().serversList(LOCAL_SERVER_LIST_CONFIG).build()).build();
}
use of com.palantir.atlasdb.spi.KeyValueServiceConfig in project atlasdb by palantir.
the class AtlasDbServicesConnector method connect.
public AtlasDbServices connect() {
if (services != null) {
throw new IllegalStateException("connect() has already been called");
}
DockerizedDatabaseUri dburi = DockerizedDatabaseUri.fromUriString(uri);
KeyValueServiceConfig config = dburi.getKeyValueServiceInstrumentation().getKeyValueServiceConfig(dburi.getAddress());
ImmutableAtlasDbConfig atlasDbConfig = ImmutableAtlasDbConfig.builder().keyValueService(config).build();
ImmutableAtlasDbRuntimeConfig runtimeConfig = ImmutableAtlasDbRuntimeConfig.defaultRuntimeConfig();
ServicesConfigModule servicesConfigModule = ServicesConfigModule.create(atlasDbConfig, runtimeConfig);
services = DaggerAtlasDbServices.builder().servicesConfigModule(servicesConfigModule).build();
return services;
}
use of com.palantir.atlasdb.spi.KeyValueServiceConfig in project atlasdb by palantir.
the class PostgresConfigLoadingTest method getConnectionConfig.
private ConnectionConfig getConnectionConfig() throws IOException {
AtlasDbConfig config = getPostgresTestConfig();
KeyValueServiceConfig keyValueServiceConfig = config.keyValueService();
DbKeyValueServiceConfig dbkvsConfig = (DbKeyValueServiceConfig) keyValueServiceConfig;
return dbkvsConfig.connection();
}
use of com.palantir.atlasdb.spi.KeyValueServiceConfig in project atlasdb by palantir.
the class CleanCassLocksStateCommand method getCassandraKvsConfig.
private CassandraKeyValueServiceConfig getCassandraKvsConfig() {
KeyValueServiceConfig kvsConfig = getAtlasDbConfig().keyValueService();
if (!kvsConfig.type().equals(CassandraKeyValueServiceConfig.TYPE)) {
throw new IllegalStateException(String.format("KeyValueService must be of type %s, but yours is %s", CassandraKeyValueServiceConfig.TYPE, kvsConfig.type()));
}
CassandraKeyValueServiceConfig cassandraConfig = (CassandraKeyValueServiceConfig) kvsConfig;
Optional<String> namespace = getAtlasDbConfig().namespace();
String desiredKeyspace = OptionalResolver.resolve(namespace, cassandraConfig.keyspace());
return CassandraKeyValueServiceConfigs.copyWithKeyspace(cassandraConfig, desiredKeyspace);
}
Aggregations