Search in sources :

Example 6 with ModifiableConfiguration

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;
}
Also used : ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)

Example 7 with ModifiableConfiguration

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;
}
Also used : ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)

Example 8 with ModifiableConfiguration

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));
}
Also used : ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) Test(org.junit.Test) KeyColumnValueStoreTest(com.thinkaurelius.titan.diskstorage.KeyColumnValueStoreTest)

Example 9 with ModifiableConfiguration

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);
}
Also used : StandardBaseTransactionConfig(com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) Test(org.junit.Test)

Example 10 with ModifiableConfiguration

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);
}
Also used : StandardBaseTransactionConfig(com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) Test(org.junit.Test)

Aggregations

ModifiableConfiguration (com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)50 Test (org.junit.Test)13 Configuration (com.thinkaurelius.titan.diskstorage.configuration.Configuration)9 ElasticSearchIndex (com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex)9 GraphDatabaseConfiguration (com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)9 CommonsConfiguration (com.thinkaurelius.titan.diskstorage.configuration.backend.CommonsConfiguration)8 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)8 BasicConfiguration (com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration)7 File (java.io.File)3 KeyColumnValueStoreTest (com.thinkaurelius.titan.diskstorage.KeyColumnValueStoreTest)2 WriteConfiguration (com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration)2 IndexProviderTest (com.thinkaurelius.titan.diskstorage.indexing.IndexProviderTest)2 StandardBaseTransactionConfig (com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig)2 IndexRemoveJob (com.thinkaurelius.titan.graphdb.olap.job.IndexRemoveJob)2 IndexRepairJob (com.thinkaurelius.titan.graphdb.olap.job.IndexRepairJob)2 CassandraHadoopScanRunner (com.thinkaurelius.titan.hadoop.scan.CassandraHadoopScanRunner)2 HBaseHadoopScanRunner (com.thinkaurelius.titan.hadoop.scan.HBaseHadoopScanRunner)2 Map (java.util.Map)2 TitanFactory (com.thinkaurelius.titan.core.TitanFactory)1 TitanGraph (com.thinkaurelius.titan.core.TitanGraph)1