public static CassandraKeyValueServiceConfig copyWithKeyspace( CassandraKeyValueServiceConfig cassandraConfig, String recommendedKeyspace) { return ImmutableCassandraKeyValueServiceConfig.builder() .from(cassandraConfig) .keyspace(recommendedKeyspace) .build(); } }
@Test public void canDeserialize() throws IOException, URISyntaxException { CassandraKeyValueServiceConfig testConfig = ImmutableCassandraKeyValueServiceConfig.builder() .servers(SERVERS) .addressTranslation(ImmutableMap.of("test", Iterables.getOnlyElement(SERVERS))) .replicationFactor(1) .build(); URL configUrl = CassandraKeyValueServiceConfigsTest.class.getClassLoader().getResource("testConfig.yml"); CassandraKeyValueServiceConfig deserializedTestConfig = AtlasDbConfigs.OBJECT_MAPPER .readValue(new File(configUrl.getPath()), CassandraKeyValueServiceConfig.class); assertThat(deserializedTestConfig).isEqualTo(testConfig); }
static CassandraKeyValueServiceConfig getConfig(Class<?> testClass) { return ImmutableCassandraKeyValueServiceConfig.builder() .from(CONFIG) .keyspace(testClass.getSimpleName()) .build(); }
private CassandraContainer(String dockerComposeFile, String name) { String keyspace = UUID.randomUUID().toString().replace("-", "_"); this.config = ImmutableCassandraKeyValueServiceConfig.builder() .addServers(forService(name)) .keyspace(keyspace) .credentials(ImmutableCassandraCredentialsConfig.builder() .username(USERNAME) .password(PASSWORD) .build()) .poolSize(20) .mutationBatchCount(10000) .mutationBatchSizeBytes(10000000) .fetchBatchCount(1000) .replicationFactor(1) .build(); this.dockerComposeFile = dockerComposeFile; this.name = name; }
@Override public KeyValueServiceConfig getKeyValueServiceConfig(InetSocketAddress addr) { return ImmutableCassandraKeyValueServiceConfig.builder() .addServers(addr) .poolSize(20) .keyspace("atlasdb") .credentials(ImmutableCassandraCredentialsConfig.builder() .username("cassandra") .password("cassandra") .build()) .ssl(false) .replicationFactor(1) .mutationBatchCount(10000) .mutationBatchSizeBytes(10000000) .fetchBatchCount(1000) .autoRefreshNodes(false) .build(); }
private CassandraService clientPoolWith( ImmutableSet<InetSocketAddress> servers, ImmutableSet<InetSocketAddress> serversInPool) { config = ImmutableCassandraKeyValueServiceConfig.builder() .replicationFactor(3) .addServers(servers.toArray(new InetSocketAddress[0])) .build(); blacklist = new Blacklist(config); CassandraService service = new CassandraService(MetricsManagers.createForTests(), config, blacklist); service.cacheInitialCassandraHosts(); serversInPool.forEach(service::addPool); return service; } }
public static CassandraKeyValueServiceConfig copyWithKeyspace( CassandraKeyValueServiceConfig cassandraConfig, String recommendedKeyspace) { return ImmutableCassandraKeyValueServiceConfig.builder() .from(cassandraConfig) .keyspace(recommendedKeyspace) .build(); } }