Search in sources :

Example 1 with IsolationLevel

use of org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel in project janusgraph by JanusGraph.

the class BerkeleyGraphTest method testConsistencyEnforcement.

@Override
public void testConsistencyEnforcement() {
    // Check that getConfiguration() explicitly set serializable isolation
    // This could be enforced with a JUnit assertion instead of a Precondition,
    // but a failure here indicates a problem in the test itself rather than the
    // system-under-test, so a Precondition seems more appropriate
    IsolationLevel effective = ConfigOption.getEnumValue(config.get(ConfigElement.getPath(BerkeleyJEStoreManager.ISOLATION_LEVEL), String.class), IsolationLevel.class);
    Preconditions.checkState(IsolationLevel.SERIALIZABLE.equals(effective));
    super.testConsistencyEnforcement();
}
Also used : IsolationLevel(org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel)

Example 2 with IsolationLevel

use of org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel 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();
}
Also used : IsolationLevel(org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Aggregations

IsolationLevel (org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel)2 ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)1