List of usage examples for org.apache.commons.configuration BaseConfiguration BaseConfiguration
BaseConfiguration
From source file:org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest.java
@Test public void shouldOpenViaConfiguration() { final Configuration conf = new BaseConfiguration(); conf.setProperty(Graph.GRAPH, MockGraph.class.getName()); conf.setProperty("keep", "it"); GraphFactory.open(conf);/* ww w .j a v a2 s. c o m*/ final MockGraph g = (MockGraph) GraphFactory.open(conf); assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH)); assertEquals("it", g.getConf().getString("keep")); }
From source file:org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest.java
@Test public void shouldOpenWithFactoryViaConcreteClass() { final Configuration conf = new BaseConfiguration(); conf.setProperty(Graph.GRAPH, MockGraphWithFactory.class.getName()); GraphFactory.open(conf);// w w w.ja v a2s . c o m final MockGraphWithFactory g = (MockGraphWithFactory) GraphFactory.open(conf); assertEquals(conf, g.getConf()); }
From source file:org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest.java
@Test public void shouldOpenWithFactoryViaConcreteInterface() { final Configuration conf = new BaseConfiguration(); conf.setProperty(Graph.GRAPH, MockGraphInterface.class.getName()); GraphFactory.open(conf);//from w ww . j av a 2s .c om final MockGraphInterface g = (MockGraphInterface) GraphFactory.open(conf); assertEquals(conf, g.getConf()); }
From source file:org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest.java
@Test(expected = RuntimeException.class) public void shouldThrowExceptionIfFactoryDoesNotHaveOpenMethodViaConfiguration() { final Configuration conf = new BaseConfiguration(); conf.setProperty(Graph.GRAPH, MockGraphWithFactoryWithoutOpen.class.getName()); GraphFactory.open(conf);// w ww . ja v a 2 s . com }
From source file:org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.java
public static TinkerGraph createClassic() { final Configuration conf = new BaseConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); final TinkerGraph g = TinkerGraph.open(conf); generateClassic(g);// w ww.jav a 2 s . co m return g; }
From source file:org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.java
public static TinkerGraph createTheCrew() { final Configuration conf = new BaseConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); final TinkerGraph g = TinkerGraph.open(conf); generateTheCrew(g);/* w ww . ja v a 2s . co m*/ return g; }
From source file:org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphTest.java
@Test(expected = IllegalStateException.class) public void shouldRequireGraphLocationIfFormatIsSet() { final Configuration conf = new BaseConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "graphml"); TinkerGraph.open(conf);/*from w w w. j a va2 s . c o m*/ }
From source file:org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphTest.java
@Test(expected = IllegalStateException.class) public void shouldRequireGraphFormatIfLocationIsSet() { final Configuration conf = new BaseConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, TestHelper.makeTestDataDirectory(TinkerGraphTest.class)); TinkerGraph.open(conf);/*from w ww. j av a 2 s. c om*/ }
From source file:org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphTest.java
@Test public void shouldPersistToGraphML() { final String graphLocation = TestHelper.makeTestDataDirectory(TinkerGraphTest.class) + "shouldPersistToGraphML.xml"; final File f = new File(graphLocation); if (f.exists() && f.isFile()) f.delete();/*from www . j a va 2 s . co m*/ final Configuration conf = new BaseConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "graphml"); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, graphLocation); final TinkerGraph graph = TinkerGraph.open(conf); TinkerFactory.generateModern(graph); graph.close(); final TinkerGraph reloadedGraph = TinkerGraph.open(conf); IoTest.assertModernGraph(reloadedGraph, true, true); reloadedGraph.close(); }
From source file:org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphTest.java
@Test public void shouldPersistToGraphSON() { final String graphLocation = TestHelper.makeTestDataDirectory(TinkerGraphTest.class) + "shouldPersistToGraphSON.json"; final File f = new File(graphLocation); if (f.exists() && f.isFile()) f.delete();/* w ww . j av a 2 s. c om*/ final Configuration conf = new BaseConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "graphson"); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, graphLocation); final TinkerGraph graph = TinkerGraph.open(conf); TinkerFactory.generateModern(graph); graph.close(); final TinkerGraph reloadedGraph = TinkerGraph.open(conf); IoTest.assertModernGraph(reloadedGraph, true, false); reloadedGraph.close(); }