Search in sources :

Example 1 with IsolationLevel

use of com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel in project titan by thinkaurelius.

the class BerkeleyGraphTest method getConfiguration.

@Override
public WriteConfiguration getConfiguration() {
    ModifiableConfiguration mcfg = BerkeleyStorageSetup.getBerkeleyJEConfiguration();
    String methodName = methodNameRule.getMethodName();
    if (methodName.equals("testConsistencyEnforcement")) {
        IsolationLevel iso = IsolationLevel.SERIALIZABLE;
        log.debug("Forcing isolation level {} for test method {}", iso, methodName);
        mcfg.set(BerkeleyJEStoreManager.ISOLATION_LEVEL, iso.toString());
    } else {
        IsolationLevel iso = null;
        if (mcfg.has(BerkeleyJEStoreManager.ISOLATION_LEVEL)) {
            iso = ConfigOption.getEnumValue(mcfg.get(BerkeleyJEStoreManager.ISOLATION_LEVEL), IsolationLevel.class);
        }
        log.debug("Using isolation level {} (null means adapter default) for test method {}", iso, methodName);
    }
    return mcfg.getConfiguration();
}
Also used : IsolationLevel(com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)

Example 2 with IsolationLevel

use of com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel in project titan by thinkaurelius.

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(com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel)

Aggregations

IsolationLevel (com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.IsolationLevel)2 ModifiableConfiguration (com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)1