Search in sources :

Example 1 with TableSplittingKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService in project atlasdb by palantir.

the class CassandraKeyValueServiceIntegrationTest method testCfEqualityChecker.

@Test
public void testCfEqualityChecker() throws TException {
    CassandraKeyValueServiceImpl kvs;
    if (keyValueService instanceof CassandraKeyValueService) {
        kvs = (CassandraKeyValueServiceImpl) keyValueService;
    } else if (keyValueService instanceof TableSplittingKeyValueService) {
        // scylla tests
        KeyValueService delegate = ((TableSplittingKeyValueService) keyValueService).getDelegate(testTable);
        assertTrue("The nesting of Key Value Services has apparently changed", delegate instanceof CassandraKeyValueService);
        kvs = (CassandraKeyValueServiceImpl) delegate;
    } else {
        throw new IllegalArgumentException("Can't run this cassandra-specific test against a non-cassandra KVS");
    }
    kvs.createTable(testTable, tableMetadata);
    List<CfDef> knownCfs = kvs.getClientPool().runWithRetry(client -> client.describe_keyspace("atlasdb").getCf_defs());
    CfDef clusterSideCf = Iterables.getOnlyElement(knownCfs.stream().filter(cf -> cf.getName().equals(getInternalTestTableName())).collect(Collectors.toList()));
    assertTrue("After serialization and deserialization to database, Cf metadata did not match.", ColumnFamilyDefinitions.isMatchingCf(kvs.getCfForTable(testTable, tableMetadata, FOUR_DAYS_IN_SECONDS), clusterSideCf));
}
Also used : TableSplittingKeyValueService(com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) TableSplittingKeyValueService(com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService) CfDef(org.apache.cassandra.thrift.CfDef) AbstractKeyValueServiceTest(com.palantir.atlasdb.keyvalue.impl.AbstractKeyValueServiceTest) Test(org.junit.Test)

Aggregations

KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)1 AbstractKeyValueServiceTest (com.palantir.atlasdb.keyvalue.impl.AbstractKeyValueServiceTest)1 TableSplittingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService)1 CfDef (org.apache.cassandra.thrift.CfDef)1 Test (org.junit.Test)1