tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [1/2] incubator-tinkerpop git commit: Have GroovyTranslator implemented and connected with ProcessStandard and ProcessComputer suites. Moved packages around -- now its tinkerpop.gremlin.python -- tinkerpop.gremlin.groovy. Things are looking good.
Date Thu, 09 Jun 2016 15:26:04 GMT
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 47e71228f -> 97b12a405


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessComputerTest.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessComputerTest.java
new file mode 100644
index 0000000..57f94ca
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessComputerTest.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.groovy;
+
+import org.apache.tinkerpop.gremlin.GraphProviderClass;
+import org.apache.tinkerpop.gremlin.process.ProcessComputerSuite;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(ProcessComputerSuite.class)
+@GraphProviderClass(provider = GroovyComputerProvider.class, graph = TinkerGraph.class)
+public class GroovyProcessComputerTest {
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessStandardTest.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessStandardTest.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessStandardTest.java
new file mode 100644
index 0000000..a8252d1
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProcessStandardTest.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.groovy;
+
+import org.apache.tinkerpop.gremlin.GraphProviderClass;
+import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(ProcessStandardSuite.class)
+@GraphProviderClass(provider = GroovyProvider.class, graph = TinkerGraph.class)
+public class GroovyProcessStandardTest {
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProvider.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProvider.java
new file mode 100644
index 0000000..310307e
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/groovy/GroovyProvider.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.groovy;
+
+import org.apache.tinkerpop.gremlin.VariantGraphProvider;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GroovyProvider extends VariantGraphProvider {
+
+    @Override
+    public GraphTraversalSource traversal(final Graph graph) {
+        if ((Boolean) graph.configuration().getProperty("skipTest"))
+            return graph.traversal();
+            //throw new VerificationException("This test current does not work with Gremlin-Python",
EmptyTraversal.instance());
+        else
+            return graph.traversal(GroovyTranslator.of("g"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
deleted file mode 100644
index dc999cd..0000000
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.process.traversal.CoreTraversalTest;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionComputerTest;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphVariables;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertexProperty;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public abstract class VariantGraphProvider extends AbstractGraphProvider {
-
-    private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList(
-            "testProfileStrategyCallback",
-            "testProfileStrategyCallbackSideEffect",
-            "g_withSideEffectXa_g_VX2XX_VX1X_out_whereXneqXaXX",
-            "g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack",
-            "g_withSideEffectXa_setX_V_both_name_storeXaX_capXaX",
-            "shouldSupportJobChaining",
-            InjectTest.Traversals.class.getCanonicalName(),
-            ProgramTest.Traversals.class.getCanonicalName(),
-            CoreTraversalTest.class.getCanonicalName(),
-            TraversalInterruptionTest.class.getCanonicalName(),
-            TraversalInterruptionComputerTest.class.getCanonicalName(),
-            ElementIdStrategyProcessTest.class.getCanonicalName(),
-            EventStrategyProcessTest.class.getCanonicalName(),
-            ReadOnlyStrategyProcessTest.class.getCanonicalName(),
-            PartitionStrategyProcessTest.class.getCanonicalName(),
-            SubgraphStrategyProcessTest.class.getCanonicalName()));
-
-    private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{
-        add(TinkerEdge.class);
-        add(TinkerElement.class);
-        add(TinkerGraph.class);
-        add(TinkerGraphVariables.class);
-        add(TinkerProperty.class);
-        add(TinkerVertex.class);
-        add(TinkerVertexProperty.class);
-    }};
-
-    @Override
-    public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?>
test, final String testMethodName,
-                                                    final LoadGraphWith.GraphData loadGraphWith)
{
-
-        final TinkerGraph.DefaultIdManager idManager = selectIdMakerFromGraphData(loadGraphWith);
-        final String idMaker = (idManager.equals(TinkerGraph.DefaultIdManager.ANY) ? selectIdMakerFromGraphData(loadGraphWith)
: idManager).name();
-        return new HashMap<String, Object>() {{
-            put(Graph.GRAPH, TinkerGraph.class.getName());
-            put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, idMaker);
-            put(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, idMaker);
-            put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, idMaker);
-            put("skipTest", SKIP_TESTS.contains(testMethodName) || SKIP_TESTS.contains(test.getCanonicalName()));
-            if (loadGraphWith == LoadGraphWith.GraphData.CREW)
-                put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY,
VertexProperty.Cardinality.list.name());
-        }};
-    }
-
-    @Override
-    public void clear(final Graph graph, final Configuration configuration) throws Exception
{
-        if (graph != null)
-            graph.close();
-
-        // in the even the graph is persisted we need to clean up
-        final String graphLocation = configuration.getString(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
null);
-        if (graphLocation != null) {
-            final File f = new File(graphLocation);
-            f.delete();
-        }
-    }
-
-    @Override
-    public Set<Class> getImplementations() {
-        return IMPLEMENTATION;
-    }
-
-    /**
-     * Test that load with specific graph data can be configured with a specific id manager
as the data type to
-     * be used in the test for that graph is known.
-     */
-    protected TinkerGraph.DefaultIdManager selectIdMakerFromGraphData(final LoadGraphWith.GraphData
loadGraphWith) {
-        if (null == loadGraphWith) return TinkerGraph.DefaultIdManager.ANY;
-        if (loadGraphWith.equals(LoadGraphWith.GraphData.CLASSIC))
-            return TinkerGraph.DefaultIdManager.INTEGER;
-        else if (loadGraphWith.equals(LoadGraphWith.GraphData.MODERN))
-            return TinkerGraph.DefaultIdManager.INTEGER;
-        else if (loadGraphWith.equals(LoadGraphWith.GraphData.CREW))
-            return TinkerGraph.DefaultIdManager.INTEGER;
-        else if (loadGraphWith.equals(LoadGraphWith.GraphData.GRATEFUL))
-            return TinkerGraph.DefaultIdManager.INTEGER;
-        else
-            throw new IllegalStateException(String.format("Need to define a new %s for %s",
TinkerGraph.IdManager.class.getName(), loadGraphWith.name()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonComputerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonComputerProvider.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonComputerProvider.java
deleted file mode 100644
index a9e9a2d..0000000
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonComputerProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant.python;
-
-import org.apache.tinkerpop.gremlin.GraphProvider;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-@GraphProvider.Descriptor(computer = TinkerGraphComputer.class)
-public class PythonComputerProvider extends PythonProvider {
-
-    public GraphTraversalSource traversal(final Graph graph) {
-        return super.traversal(graph).withComputer();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessComputerTest.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessComputerTest.java
deleted file mode 100644
index 1d3bef8..0000000
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessComputerTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant.python;
-
-import org.apache.tinkerpop.gremlin.GraphProviderClass;
-import org.apache.tinkerpop.gremlin.process.ProcessComputerSuite;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.junit.runner.RunWith;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-@RunWith(ProcessComputerSuite.class)
-@GraphProviderClass(provider = PythonComputerProvider.class, graph = TinkerGraph.class)
-public class PythonProcessComputerTest {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessStandardTest.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessStandardTest.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessStandardTest.java
deleted file mode 100644
index b6cce22..0000000
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProcessStandardTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant.python;
-
-import org.apache.tinkerpop.gremlin.GraphProviderClass;
-import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.junit.runner.RunWith;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-@RunWith(ProcessStandardSuite.class)
-@GraphProviderClass(provider = PythonProvider.class, graph = TinkerGraph.class)
-public class PythonProcessStandardTest {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
deleted file mode 100644
index 2b2aeb0..0000000
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant.python;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.script.ScriptGraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.variant.VariantGraphProvider;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class PythonProvider extends VariantGraphProvider {
-
-    public GraphTraversalSource traversal(final Graph graph) {
-        if ((Boolean) graph.configuration().getProperty("skipTest"))
-            return graph.traversal();
-            //throw new VerificationException("This test current does not work with Gremlin-Python",
EmptyTraversal.instance());
-        else
-            return new ScriptGraphTraversalSource(graph, graph.traversal().getStrategies(),
new PythonTranslator("gremlin-groovy", "g"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonComputerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonComputerProvider.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonComputerProvider.java
new file mode 100644
index 0000000..70bbf4f
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonComputerProvider.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.python;
+
+import org.apache.tinkerpop.gremlin.GraphProvider;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@GraphProvider.Descriptor(computer = TinkerGraphComputer.class)
+public class PythonComputerProvider extends PythonProvider {
+
+    @Override
+    public GraphTraversalSource traversal(final Graph graph) {
+        return super.traversal(graph).withComputer();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessComputerTest.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessComputerTest.java
new file mode 100644
index 0000000..5f79f9a
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessComputerTest.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.python;
+
+import org.apache.tinkerpop.gremlin.GraphProviderClass;
+import org.apache.tinkerpop.gremlin.process.ProcessComputerSuite;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(ProcessComputerSuite.class)
+@GraphProviderClass(provider = PythonComputerProvider.class, graph = TinkerGraph.class)
+public class PythonProcessComputerTest {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessStandardTest.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessStandardTest.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessStandardTest.java
new file mode 100644
index 0000000..a170408
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProcessStandardTest.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.python;
+
+import org.apache.tinkerpop.gremlin.GraphProviderClass;
+import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(ProcessStandardSuite.class)
+@GraphProviderClass(provider = PythonProvider.class, graph = TinkerGraph.class)
+public class PythonProcessStandardTest {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97b12a40/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProvider.java
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProvider.java
new file mode 100644
index 0000000..28cdcfe
--- /dev/null
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/python/PythonProvider.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.python;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.VariantGraphProvider;
+import org.apache.tinkerpop.gremlin.python.GremlinPythonGenerator;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import java.io.File;
+import java.util.Random;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class PythonProvider extends VariantGraphProvider {
+
+    private static final Random RANDOM = new Random();
+
+    static {
+        try {
+            final String rootPackageName = (new File("gremlin-variant").exists() ? "gremlin-variant/"
: "") + "src/main/jython/";
+            final String gremlinPythonPackageName = rootPackageName + "/gremlin_python";
+            final String gremlinDriverPackageName = rootPackageName + "/gremlin_driver";
+            final String gremlinPythonModuleName = gremlinPythonPackageName + "/gremlin_python.py";
+            GremlinPythonGenerator.create(gremlinPythonModuleName);
+            final ScriptEngine jythonEngine = ScriptEngineCache.get("jython");
+            jythonEngine.eval("import sys");
+            jythonEngine.eval("sys.path.append('" + gremlinPythonPackageName + "')");
+            jythonEngine.eval("sys.path.append('" + gremlinDriverPackageName + "')");
+            jythonEngine.eval("from gremlin_python import *");
+            jythonEngine.eval("from gremlin_python import __");
+        } catch (final ScriptException e) {
+            throw new IllegalStateException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public GraphTraversalSource traversal(final Graph graph) {
+        final boolean importStatics = RANDOM.nextBoolean();
+        try {
+            if (importStatics)
+                ScriptEngineCache.get("jython").eval("for k in statics:\n  globals()[k] =
statics[k]");
+        } catch (final ScriptException e) {
+            throw new IllegalStateException(e.getMessage(), e);
+        }
+        //
+        if ((Boolean) graph.configuration().getProperty("skipTest"))
+            return graph.traversal();
+            //throw new VerificationException("This test current does not work with Gremlin-Python",
EmptyTraversal.instance());
+        else
+            return graph.traversal(PythonTranslator.of("gremlin-groovy", "g", importStatics));
+    }
+
+}


Mime
View raw message