use of com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration in project titan by thinkaurelius.
the class AbstractTitanGraphProvider method clear.
// @Override
// public <ID> ID reconstituteGraphSONIdentifier(final Class<? extends Element> clazz, final Object id) {
// if (Edge.class.isAssignableFrom(clazz)) {
// // TitanGraphSONModule toStrings the edgeid - expect a String value for the id
// if (!(id instanceof String)) throw new RuntimeException("Expected a String value for the RelationIdentifier");
// return (ID) RelationIdentifier.parse((String) id);
// } else {
// return (ID) id;
// }
// }
@Override
public void clear(Graph g, final Configuration configuration) throws Exception {
if (null != g) {
while (g instanceof WrappedGraph) g = ((WrappedGraph<? extends Graph>) g).getBaseGraph();
TitanGraph graph = (TitanGraph) g;
if (graph.isOpen()) {
if (g.tx().isOpen())
g.tx().rollback();
g.close();
}
}
WriteConfiguration config = new CommonsConfiguration(configuration);
BasicConfiguration readConfig = new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE);
if (readConfig.has(GraphDatabaseConfiguration.STORAGE_BACKEND)) {
TitanGraphBaseTest.clearGraph(config);
}
}
use of com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration in project titan by thinkaurelius.
the class CassandraGraphTest method testGraphConfigUsedByThreadBoundTx.
@Test
public void testGraphConfigUsedByThreadBoundTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "LOCAL_QUORUM");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx) graph.getCurrentThreadTx();
assertEquals("ALL", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("LOCAL_QUORUM", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
}
use of com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration in project titan by thinkaurelius.
the class CassandraGraphTest method testGraphConfigUsedByTx.
@Test
public void testGraphConfigUsedByTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "TWO");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "THREE");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx) graph.newTransaction();
assertEquals("TWO", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("THREE", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
tx.rollback();
}
use of com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration in project titan by thinkaurelius.
the class TitanOperationCountingTest method getConfiguration.
@Override
public WriteConfiguration getConfiguration() {
WriteConfiguration config = getBaseConfiguration();
ModifiableConfiguration mconf = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE);
mconf.set(BASIC_METRICS, true);
mconf.set(METRICS_MERGE_STORES, false);
mconf.set(PROPERTY_PREFETCHING, false);
mconf.set(DB_CACHE, false);
return config;
}
use of com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration in project titan by thinkaurelius.
the class TitanPartitionGraphTest method getConfiguration.
@Override
public WriteConfiguration getConfiguration() {
WriteConfiguration config = getBaseConfiguration();
ModifiableConfiguration mconf = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE);
// Let GraphDatabaseConfiguration's config freezer set CLUSTER_PARTITION
//mconf.set(GraphDatabaseConfiguration.CLUSTER_PARTITION,true);
mconf.set(GraphDatabaseConfiguration.CLUSTER_MAX_PARTITIONS, numPartitions);
//uses SimpleBulkPlacementStrategy by default
mconf.set(SimpleBulkPlacementStrategy.CONCURRENT_PARTITIONS, 3 * numPartitions);
return config;
}
Aggregations