use of org.janusgraph.diskstorage.configuration.BasicConfiguration in project janusgraph by JanusGraph.
the class HBaseStoreManagerConfigTest method testShortCfNames.
@Test
public void testShortCfNames() throws Exception {
Logger log = Logger.getLogger(HBaseStoreManager.class);
Level savedLevel = log.getLevel();
log.setLevel(Level.WARN);
StringWriter writer = new StringWriter();
Appender appender = new WriterAppender(new PatternLayout("%p: %m%n"), writer);
log.addAppender(appender);
// Open the HBaseStoreManager and store with default SHORT_CF_NAMES true.
WriteConfiguration config = HBaseStorageSetup.getHBaseGraphConfiguration();
HBaseStoreManager manager = new HBaseStoreManager(new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE));
KeyColumnValueStore store = manager.openDatabase(GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME);
store.close();
manager.close();
// Open the HBaseStoreManager and store with SHORT_CF_NAMES false.
config.set(ConfigElement.getPath(HBaseStoreManager.SHORT_CF_NAMES), false);
manager = new HBaseStoreManager(new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE));
writer.getBuffer().setLength(0);
store = manager.openDatabase(GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME);
// Verify we get WARN.
assertTrue(writer.toString(), writer.toString().startsWith("WARN: Configuration"));
log.removeAppender(appender);
log.setLevel(savedLevel);
store.close();
manager.close();
}
use of org.janusgraph.diskstorage.configuration.BasicConfiguration in project janusgraph by JanusGraph.
the class AbstractJanusGraphProvider method clear.
// @Override
// public <ID> ID reconstituteGraphSONIdentifier(final Class<? extends Element> clazz, final Object id) {
// if (Edge.class.isAssignableFrom(clazz)) {
// // JanusGraphSONModule 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();
JanusGraph graph = (JanusGraph) g;
if (graph.isOpen()) {
if (g.tx().isOpen())
g.tx().rollback();
try {
g.close();
} catch (IOException | IllegalStateException e) {
logger.warn("Titan graph may not have closed cleanly", e);
}
}
}
WriteConfiguration config = new CommonsConfiguration(configuration);
BasicConfiguration readConfig = new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE);
if (readConfig.has(GraphDatabaseConfiguration.STORAGE_BACKEND)) {
JanusGraphBaseTest.clearGraph(config);
}
}
Aggregations