private static boolean canCreateCassandraKeyValueService() { return CassandraKeyValueServiceImpl.createForTesting( KVS_CONFIG, LEADER_CONFIG) .isInitialized(); } }
public CassandraResource() { this.supplier = () -> CassandraKeyValueServiceImpl.createForTesting( containerInstance.getConfig(), CassandraContainer.LEADER_CONFIG); }
@Override public SuccessOrFailure isReady(DockerComposeRule rule) { return SuccessOrFailure.onResultOf(() -> CassandraKeyValueServiceImpl.createForTesting( config, LEADER_CONFIG) .isInitialized()); }
@Override public boolean canConnect(InetSocketAddress addr) { return CassandraKeyValueServiceImpl.createForTesting( (CassandraKeyValueServiceConfig) getKeyValueServiceConfig(addr), Optional.of(ImmutableLeaderConfig.builder() .quorumSize(1) .localServer(addr.getHostString()) .leaders(ImmutableSet.of(addr.getHostString())) .build())) .isInitialized(); }
private static CassandraKeyValueService createKvs(Class<?> testClass) { return CassandraKeyValueServiceImpl .createForTesting(getConfig(testClass), ThreeNodeCassandraCluster.LEADER_CONFIG); }
@Test public void testAuthMissing() { CassandraKeyValueServiceImpl.createForTesting( NO_CREDS_CKVS_CONFIG, CassandraResource.LEADER_CONFIG).close(); } }
private static CassandraKeyValueService kvsWithSchemaMutationTimeout(int millis) { ImmutableCassandraKeyValueServiceConfig config = ImmutableCassandraKeyValueServiceConfig .copyOf(CASSANDRA.getConfig()) .withSchemaMutationTimeoutMillis(millis); return CassandraKeyValueServiceImpl.createForTesting( config, CassandraResource.LEADER_CONFIG); } }
@Test public void shouldCreateTablesConsistentlyWithMultipleCassandraNodes() throws Exception { TableReference table1 = TableReference.createFromFullyQualifiedName("ns.table1"); CassandraKeyValueServiceConfig config = ThreeNodeCassandraCluster.KVS_CONFIG; try { CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT); for (int i = 0; i < THREAD_COUNT; i++) { async(() -> { CassandraKeyValueService keyValueService = CassandraKeyValueServiceImpl.createForTesting(config, Optional.empty()); barrier.await(); keyValueService.createTable(table1, AtlasDbConstants.GENERIC_TABLE_METADATA); return null; }); } } finally { executorService.shutdown(); assertTrue(executorService.awaitTermination(4, TimeUnit.MINUTES)); } CassandraKeyValueService kvs = CassandraKeyValueServiceImpl.createForTesting(config, Optional.empty()); assertThat(kvs.getAllTableNames(), hasItem(table1)); assertThat(new File(CONTAINERS.getLogDirectory()), containsFiles(everyItem(doesNotContainTheColumnFamilyIdMismatchError()))); }