diff --git a/pom.xml b/pom.xml index 6c9188430d05cc776e0017df82477674d2481995..3b3ad6f779380bebee17a039bc0f50def356b0d0 100644 --- a/pom.xml +++ b/pom.xml @@ -117,5 +117,10 @@ <artifactId>titan-es</artifactId> <version>0.4.4</version> </dependency> + <dependency> + <groupId>com.tinkerpop.gremlin</groupId> + <artifactId>gremlin-java</artifactId> + <version>2.6.0</version> + </dependency> </dependencies> </project> diff --git a/src/main/java/com/syncleus/titangraph/example/TitanGods.java b/src/main/java/com/syncleus/titangraph/example/TitanGods.java index 3a5e1edb2fabcff373a9651ef327b238a7c589d0..17ef9ddb671ba8f656e5ae93cb6e7dc28a06c154 100644 --- a/src/main/java/com/syncleus/titangraph/example/TitanGods.java +++ b/src/main/java/com/syncleus/titangraph/example/TitanGods.java @@ -5,8 +5,7 @@ import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.TitanKey; import com.thinkaurelius.titan.core.attribute.Geoshape; import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration; -import com.tinkerpop.blueprints.Edge; -import com.tinkerpop.blueprints.Vertex; +import com.tinkerpop.blueprints.*; import com.tinkerpop.blueprints.util.ElementHelper; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; diff --git a/src/test/java/com/syncleus/titangraph/example/GremlinTest.java b/src/test/java/com/syncleus/titangraph/example/GremlinTest.java new file mode 100644 index 0000000000000000000000000000000000000000..594896b1c0f38681f64414c1094e1b45703fe0ed --- /dev/null +++ b/src/test/java/com/syncleus/titangraph/example/GremlinTest.java @@ -0,0 +1,18 @@ +package com.syncleus.titangraph.example; + +import com.thinkaurelius.titan.core.TitanGraph; +import com.tinkerpop.blueprints.Vertex; +import com.tinkerpop.gremlin.java.GremlinPipeline; +import org.junit.*; + +public class GremlinTest { + @Test + public void testGremlin() { + final TitanGraph godGraph = TitanGods.create("./target/TitanTestDB"); + final GremlinPipeline pipe = new GremlinPipeline(); + final Vertex saturnVertex = godGraph.getVertices("name", "saturn").iterator().next(); + final GremlinPipeline childsNamePipe = pipe.start(saturnVertex).in("father").property("name"); + final String childsName = childsNamePipe.next().toString(); + Assert.assertEquals(childsName, "jupiter"); + } +} diff --git a/src/test/java/com/syncleus/titangraph/example/TitanGodsTest.java b/src/test/java/com/syncleus/titangraph/example/TitanGodsTest.java index 76033e906fb135e197ceb6010c259d4961aa5970..b89a9f2b60de9aebe1dd64c7c27cb2307b644294 100644 --- a/src/test/java/com/syncleus/titangraph/example/TitanGodsTest.java +++ b/src/test/java/com/syncleus/titangraph/example/TitanGodsTest.java @@ -2,37 +2,13 @@ package com.syncleus.titangraph.example; import com.thinkaurelius.titan.core.TitanGraph; import com.tinkerpop.blueprints.Vertex; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; +import org.junit.*; -/** - * Unit test for simple App. - */ -public class TitanGodsTest - extends TestCase { - /** - * Create the test case - * - * @param testName name of the test case - */ - public TitanGodsTest(String testName) { - super(testName); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() { - return new TestSuite(TitanGodsTest.class); - } - - /** - * Rigourous Test :-) - */ +public class TitanGodsTest { + @Test public void testApp() { TitanGraph godGraph = TitanGods.create("./target/TitanTestDB"); Iterable<Vertex> skyVertices = godGraph.getVertices("name", "sky"); - assertTrue("no sky vertices found", skyVertices.iterator().hasNext()); + Assert.assertTrue("no sky vertices found", skyVertices.iterator().hasNext()); } }