use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class CassandraStorageSetup method getEmbeddedConfiguration.
public static ModifiableConfiguration getEmbeddedConfiguration(String ks) {
ModifiableConfiguration config = getGenericConfiguration(ks, "embeddedcassandra");
config.set(STORAGE_CONF_FILE, getPaths().yamlPath);
return config;
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class CassandraStorageSetup method getGenericConfiguration.
private static ModifiableConfiguration getGenericConfiguration(String ks, String backend) {
ModifiableConfiguration config = buildGraphConfiguration();
config.set(CASSANDRA_KEYSPACE, cleanKeyspaceName(ks));
log.debug("Set keyspace name: {}", config.get(CASSANDRA_KEYSPACE));
config.set(PAGE_SIZE, 500);
config.set(CONNECTION_TIMEOUT, Duration.ofSeconds(60L));
config.set(STORAGE_BACKEND, backend);
return config;
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class AbstractCassandraStoreTest method testCustomCFCompressor.
@Test
public void testCustomCFCompressor() throws BackendException {
final String cname = "DeflateCompressor";
final int ckb = 128;
final String cf = TEST_CF_NAME + "_gzip";
ModifiableConfiguration config = getBaseStorageConfiguration();
config.set(AbstractCassandraStoreManager.CF_COMPRESSION_TYPE, cname);
config.set(AbstractCassandraStoreManager.CF_COMPRESSION_BLOCK_SIZE, ckb);
AbstractCassandraStoreManager mgr = openStorageManager(config);
// N.B.: clearStorage() truncates CFs but does not delete them
mgr.openDatabase(cf);
final Map<String, String> expected = ImmutableMap.<String, String>builder().put("sstable_compression", DEFAULT_COMPRESSOR_PACKAGE + "." + cname).put("chunk_length_kb", String.valueOf(ckb)).build();
assertEquals(expected, mgr.getCompressionOptions(cf));
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class CassandraTransactionTest method testWriteConsistencyLevel.
/* testRead/WriteConsistencyLevel have unnecessary code duplication
* that could be avoided by creating a common helper method that takes
* a ConfigOption parameter and a function that converts a
* CassandraTransaction to a consistency level by calling either
* ct.getReadConsistencyLevel() or .getWriteConsistencyLevel(),
* but it doesn't seem worth the complexity.
*/
@Test
public void testWriteConsistencyLevel() {
int levelsChecked = 0;
// Test whether CassandraTransaction honors the write consistency level option
for (CLevel writeLevel : CLevel.values()) {
StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();
ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration();
mc.set(CASSANDRA_WRITE_CONSISTENCY, writeLevel.name());
b.customOptions(mc);
b.timestampProvider(TimestampProviders.MICRO);
CassandraTransaction ct = new CassandraTransaction(b.build());
assertEquals(writeLevel, ct.getWriteConsistencyLevel());
levelsChecked++;
}
// Sanity check: if CLevel.values was empty, something is wrong with the test
Preconditions.checkState(0 < levelsChecked);
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class CassandraTransactionTest method testReadConsistencyLevel.
@Test
public void testReadConsistencyLevel() {
int levelsChecked = 0;
// Test whether CassandraTransaction honors the write consistency level option
for (CLevel writeLevel : CLevel.values()) {
StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();
ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration();
mc.set(CASSANDRA_READ_CONSISTENCY, writeLevel.name());
b.timestampProvider(TimestampProviders.MICRO);
b.customOptions(mc);
CassandraTransaction ct = new CassandraTransaction(b.build());
assertEquals(writeLevel, ct.getReadConsistencyLevel());
levelsChecked++;
}
// Sanity check: if CLevel.values was empty, something is wrong with the test
Preconditions.checkState(0 < levelsChecked);
}
Aggregations