private <A> void setIllegalGraphOption(ConfigOption<A> opt, ConfigOption.Type requiredType, A attemptedValue) { // Sanity check: make sure the Type of the configuration option is what we expect final ConfigOption.Type type = opt.getType(); Preconditions.checkState(type.equals(requiredType)); Preconditions.checkArgument(requiredType.equals(ConfigOption.Type.LOCAL) || requiredType.equals(ConfigOption.Type.FIXED)); // Get full string path of config option final String path = ConfigElement.getPath(opt); // Try to read the option try { mgmt.get(path); } catch (Throwable t) { log.debug("Caught expected exception", t); } // Try to modify the option try { mgmt.set(path, attemptedValue); mgmt.commit(); fail("Option " + path + " with type " + type + " should not be modifiable in the persistent graph config"); } catch (Throwable t) { log.debug("Caught expected exception", t); } }
assertEquals(firstValue.toString(), mgmt.get(path)); assertEquals(firstValue.toString(), mgmt.get(path)); assertEquals(secondValue.toString(), mgmt.get(path)); mgmt.commit(); clopen(); tx.rollback(); assertEquals(secondValue.toString(), mgmt.get(path)); assertEquals(secondValue.toString(), m2.get(path)); log.debug("Caught expected exception", e); assertEquals(secondValue.toString(), mgmt.get(path)); assertEquals(firstValue.toString(), mgmt.get(path)); mgmt.commit(); clopen(); assertEquals(firstValue.toString(), mgmt.get(path));
static void validateIndexBackend(Configuration config) { String configuredIndexBackend = config.getString(INDEX_BACKEND_CONF); JanusGraphManagement managementSystem = getGraphInstance().openManagement(); String currentIndexBackend = managementSystem.get(INDEX_BACKEND_CONF); managementSystem.commit(); if (!configuredIndexBackend.equals(currentIndexBackend)) { throw new RuntimeException("Configured Index Backend " + configuredIndexBackend + " differs from earlier configured Index Backend " + currentIndexBackend + ". Aborting!"); } }