Search in sources :

Example 36 with ModifiableConfiguration

use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.

the class AbstractCassandraStoreTest method testDisableCFCompressor.

@Test
public void testDisableCFCompressor() throws BackendException {
    final String cf = TEST_CF_NAME + "_nocompress";
    ModifiableConfiguration config = getBaseStorageConfiguration();
    config.set(AbstractCassandraStoreManager.CF_COMPRESSION, false);
    AbstractCassandraStoreManager mgr = openStorageManager(config);
    // N.B.: clearStorage() truncates CFs but does not delete them
    mgr.openDatabase(cf);
    assertEquals(Collections.emptyMap(), mgr.getCompressionOptions(cf));
}
Also used : ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) KeyColumnValueStoreTest(org.janusgraph.diskstorage.KeyColumnValueStoreTest) Test(org.junit.Test)

Example 37 with ModifiableConfiguration

use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.

the class CassandraStorageSetup method getGenericConfiguration.

private static ModifiableConfiguration getGenericConfiguration(String ks, String backend) {
    ModifiableConfiguration config = buildGraphConfiguration();
    if (null != ks) {
        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);
    if (HOSTNAME != null)
        config.set(STORAGE_HOSTS, new String[] { HOSTNAME });
    config.set(DROP_ON_CLEAR, false);
    return config;
}
Also used : ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Example 38 with ModifiableConfiguration

use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.

the class ThriftGraphComputerProvider method getJanusGraphConfiguration.

@Override
public ModifiableConfiguration getJanusGraphConfiguration(String graphName, Class<?> test, String testMethodName) {
    CassandraStorageSetup.startCleanEmbedded();
    ModifiableConfiguration config = super.getJanusGraphConfiguration(graphName, test, testMethodName);
    config.setAll(CassandraStorageSetup.getCassandraThriftConfiguration(graphName).getAll());
    return config;
}
Also used : ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Example 39 with ModifiableConfiguration

use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.

the class CQLStoreTest method testDisableCFCompressor.

@Test
public void testDisableCFCompressor() throws BackendException {
    final String cf = TEST_CF_NAME + "_nocompress";
    final ModifiableConfiguration config = getBaseStorageConfiguration();
    config.set(CF_COMPRESSION, false);
    final CQLStoreManager mgr = openStorageManager(config);
    // N.B.: clearStorage() truncates CFs but does not delete them
    mgr.openDatabase(cf);
    final Map<String, String> opts = new HashMap<>(mgr.getCompressionOptions(cf));
    if ("false".equals(opts.get("enabled"))) {
        // Cassandra 3.x contains {"enabled": false"} mapping not found in 2.x
        opts.remove("enabled");
    }
    assertEquals(Collections.emptyMap(), opts);
}
Also used : HashMap(java.util.HashMap) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) KeyColumnValueStoreTest(org.janusgraph.diskstorage.KeyColumnValueStoreTest) Test(org.junit.Test)

Example 40 with ModifiableConfiguration

use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.

the class CQLStoreTest method testCustomCFCompressor.

@Test
public void testCustomCFCompressor() throws BackendException {
    final String cname = "DeflateCompressor";
    final int ckb = 128;
    final String cf = TEST_CF_NAME + "_gzip";
    final ModifiableConfiguration config = getBaseStorageConfiguration();
    config.set(CF_COMPRESSION_TYPE, cname);
    config.set(CF_COMPRESSION_BLOCK_SIZE, ckb);
    final CQLStoreManager mgr = openStorageManager(config);
    // N.B.: clearStorage() truncates CFs but does not delete them
    mgr.openDatabase(cf);
    final Map<String, String> opts = mgr.getCompressionOptions(cf);
    assertEquals(2, opts.size());
    // chunk length key differs between 2.x (chunk_length_kb) and 3.x (chunk_length_in_kb)
    assertEquals(String.valueOf(ckb), opts.getOrDefault("chunk_length_kb", opts.get("chunk_length_in_kb")));
    // compression class key differs between 2.x (sstable_compression) and 3.x (class)
    assertEquals(DEFAULT_COMPRESSOR_PACKAGE + "." + cname, opts.getOrDefault("sstable_compression", opts.get("class")));
}
Also used : ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) KeyColumnValueStoreTest(org.janusgraph.diskstorage.KeyColumnValueStoreTest) Test(org.junit.Test)

Aggregations

ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)62 Test (org.junit.Test)16 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)10 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)10 KeyColumnValueStoreTest (org.janusgraph.diskstorage.KeyColumnValueStoreTest)6 BasicConfiguration (org.janusgraph.diskstorage.configuration.BasicConfiguration)5 Configuration (org.janusgraph.diskstorage.configuration.Configuration)5 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)5 HashMap (java.util.HashMap)3 Map (java.util.Map)3 StandardBaseTransactionConfig (org.janusgraph.diskstorage.util.StandardBaseTransactionConfig)3 WriteConfiguration (org.janusgraph.diskstorage.configuration.WriteConfiguration)2 InMemoryStoreManager (org.janusgraph.diskstorage.keycolumnvalue.inmemory.InMemoryStoreManager)2 IndexRemoveJob (org.janusgraph.graphdb.olap.job.IndexRemoveJob)2 IndexRepairJob (org.janusgraph.graphdb.olap.job.IndexRepairJob)2 CassandraHadoopScanRunner (org.janusgraph.hadoop.scan.CassandraHadoopScanRunner)2 HBaseHadoopScanRunner (org.janusgraph.hadoop.scan.HBaseHadoopScanRunner)2 Before (org.junit.Before)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 IOException (java.io.IOException)1