use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class ElasticSearchConfigTest method testClient.
@Test
public void testClient() throws BackendException, InterruptedException {
final ModifiableConfiguration config = esr.setElasticsearchConfiguration(GraphDatabaseConfiguration.buildGraphConfiguration(), INDEX_NAME);
Configuration indexConfig = config.restrictTo(INDEX_NAME);
IndexProvider idx = open(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
config.set(INDEX_HOSTS, new String[] { "10.11.12.13:" + ElasticsearchRunner.PORT }, INDEX_NAME);
indexConfig = config.restrictTo(INDEX_NAME);
Throwable failure = null;
try {
new ElasticSearchIndex(indexConfig);
} catch (final Throwable t) {
failure = t;
}
Assert.assertNotNull("ES client failed to throw exception on connection failure", failure);
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class BerkeleyGraphComputerProvider method getJanusGraphConfiguration.
@Override
public ModifiableConfiguration getJanusGraphConfiguration(String graphName, Class<?> test, String testMethodName) {
ModifiableConfiguration config = super.getJanusGraphConfiguration(graphName, test, testMethodName);
config.setAll(BerkeleyStorageSetup.getBerkeleyJEConfiguration(StorageSetup.getHomeDir(graphName)).getAll());
config.set(GraphDatabaseConfiguration.IDAUTHORITY_WAIT, Duration.ofMillis(20));
config.set(GraphDatabaseConfiguration.STORAGE_TRANSACTIONAL, false);
return config;
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class BerkeleyGraphTest method getConfiguration.
@Override
public WriteConfiguration getConfiguration() {
ModifiableConfiguration modifiableConfiguration = BerkeleyStorageSetup.getBerkeleyJEConfiguration();
String methodName = methodNameRule.getMethodName();
if (methodName.equals("testConsistencyEnforcement")) {
IsolationLevel iso = IsolationLevel.SERIALIZABLE;
log.debug("Forcing isolation level {} for test method {}", iso, methodName);
modifiableConfiguration.set(BerkeleyJEStoreManager.ISOLATION_LEVEL, iso.toString());
} else {
IsolationLevel iso = null;
if (modifiableConfiguration.has(BerkeleyJEStoreManager.ISOLATION_LEVEL)) {
iso = ConfigOption.getEnumValue(modifiableConfiguration.get(BerkeleyJEStoreManager.ISOLATION_LEVEL), IsolationLevel.class);
}
log.debug("Using isolation level {} (null means adapter default) for test method {}", iso, methodName);
}
return modifiableConfiguration.getConfiguration();
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class StandardJanusGraph method closeInternal.
private synchronized void closeInternal() {
if (!isOpen)
return;
Map<JanusGraphTransaction, RuntimeException> txCloseExceptions = new HashMap<>();
try {
// Unregister instance
String uniqueId = null;
try {
uniqueId = config.getUniqueGraphId();
ModifiableConfiguration globalConfig = GraphDatabaseConfiguration.getGlobalSystemConfig(backend);
globalConfig.remove(REGISTRATION_TIME, uniqueId);
} catch (Exception e) {
log.warn("Unable to remove graph instance uniqueid {}", uniqueId, e);
}
/* Assuming a couple of properties about openTransactions:
* 1. no concurrent modifications during graph shutdown
* 2. all contained txs are open
*/
for (StandardJanusGraphTx otx : openTransactions) {
try {
otx.close();
} catch (RuntimeException e) {
// Catch and store these exceptions, but proceed wit the loop
// Any remaining txs on the iterator should get a chance to close before we throw up
log.warn("Unable to close transaction {}", otx, e);
txCloseExceptions.put(otx, e);
}
}
super.close();
IOUtils.closeQuietly(idAssigner);
IOUtils.closeQuietly(backend);
IOUtils.closeQuietly(queryCache);
IOUtils.closeQuietly(serializer);
} finally {
isOpen = false;
}
// Throw an exception if at least one transaction failed to close
if (1 == txCloseExceptions.size()) {
// TP3's test suite requires that this be of type ISE
throw new IllegalStateException("Unable to close transaction", Iterables.getOnlyElement(txCloseExceptions.values()));
} else if (1 < txCloseExceptions.size()) {
throw new IllegalStateException(String.format("Unable to close %s transactions (see warnings in log output for details)", txCloseExceptions.size()));
}
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
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