use of com.palantir.atlasdb.backup.KvsRunner in project atlasdb by palantir.
the class CassandraRepairEteTest method setUp.
@Before
public void setUp() {
int replicationFactor = 2;
config = ThreeNodeCassandraCluster.getKvsConfig();
runtimeConfig = ThreeNodeCassandraCluster.getRuntimeConfig(replicationFactor);
kvs = CassandraKeyValueServiceImpl.createForTesting(config, runtimeConfig);
TransactionTables.createTables(kvs);
kvs.createTable(TABLE_REF, AtlasDbConstants.GENERIC_TABLE_METADATA);
kvs.putUnlessExists(TABLE_REF, ImmutableMap.of(NONEMPTY_CELL, CONTENTS));
KvsRunner kvsRunner = KvsRunner.create(_unused -> kvs);
Function<AtlasService, CassandraKeyValueServiceConfig> configFactory = _unused -> config;
Function<AtlasService, Refreshable<CassandraKeyValueServiceRuntimeConfig>> runtimeConfigFactory = _unused -> runtimeConfig;
Function<AtlasService, CassandraClusterConfig> cassandraClusterConfigFunction = atlasService -> CassandraClusterConfig.of(configFactory.apply(atlasService), runtimeConfigFactory.apply(atlasService).get());
Function<AtlasService, Refreshable<CassandraServersConfig>> cassandraServersConfigFactory = runtimeConfigFactory.andThen(runtimeConfig -> runtimeConfig.map(CassandraKeyValueServiceRuntimeConfig::servers));
cassandraRepairHelper = new CassandraRepairHelper(kvsRunner, cassandraClusterConfigFunction, cassandraServersConfigFactory);
cluster = new ClusterFactory(Cluster::builder).constructCluster(cassandraClusterConfigFunction.apply(ATLAS_SERVICE), cassandraServersConfigFactory.apply(ATLAS_SERVICE).get());
cqlCluster = new CqlCluster(cluster, cassandraServersConfigFactory.apply(ATLAS_SERVICE).get(), NAMESPACE);
}
Aggregations