okay. so I created ProcessActorsSuite and our first actors specific test -- GraphActorsTest (currently just makes sure toString() is valid :). Really organizing things around Configuration... Just like Graphs, Computers and Actors are defined by Configurations.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/343e9b79 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/343e9b79 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/343e9b79 Branch: refs/heads/TINKERPOP-1564 Commit: 343e9b79c3fe29dc13c6c53e2fb16f1a22af96a7 Parents: 2809703 Author: Marko A. Rodriguez <okramma...@gmail.com> Authored: Fri Dec 16 15:26:38 2016 -0700 Committer: Marko A. Rodriguez <okramma...@gmail.com> Committed: Thu Jan 19 10:26:57 2017 -0700 ---------------------------------------------------------------------- .../akka/process/actor/AkkaGraphActors.java | 1 + .../process/AkkaActorsProcessActorsTest.java | 34 +++ .../process/AkkaActorsProcessStandardTest.java | 33 --- .../akka/process/AkkaActorsProvider.java | 5 + .../computer/util/GraphComputerHelper.java | 3 +- .../util/partitioner/GlobalPartitioner.java | 2 +- .../util/partitioner/HashPartitioner.java | 2 +- .../apache/tinkerpop/gremlin/GraphManager.java | 6 + .../apache/tinkerpop/gremlin/GraphProvider.java | 5 + .../gremlin/process/ProcessActorsSuite.java | 272 +++++++++++++++++++ .../gremlin/process/actors/GraphActorsTest.java | 42 +++ .../computer/AbstractHadoopGraphComputer.java | 2 + .../TinkerGraphPartitionerProvider.java | 42 ++- .../tinkergraph/structure/TinkerGraph.java | 1 + 14 files changed, 405 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/akka-gremlin/src/main/java/org/apache/tinkerpop/gremlin/akka/process/actor/AkkaGraphActors.java ---------------------------------------------------------------------- diff --git a/akka-gremlin/src/main/java/org/apache/tinkerpop/gremlin/akka/process/actor/AkkaGraphActors.java b/akka-gremlin/src/main/java/org/apache/tinkerpop/gremlin/akka/process/actor/AkkaGraphActors.java index c602dae..05e63be 100644 --- a/akka-gremlin/src/main/java/org/apache/tinkerpop/gremlin/akka/process/actor/AkkaGraphActors.java +++ b/akka-gremlin/src/main/java/org/apache/tinkerpop/gremlin/akka/process/actor/AkkaGraphActors.java @@ -57,6 +57,7 @@ public final class AkkaGraphActors<R> implements GraphActors<R> { private AkkaGraphActors(final Configuration configuration) { this.configuration = configuration; this.configuration.setProperty(GRAPH_ACTORS, AkkaGraphActors.class.getCanonicalName()); + this.workers = this.configuration.getInt(GRAPH_ACTORS_WORKERS, 1); } @Override http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessActorsTest.java ---------------------------------------------------------------------- diff --git a/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessActorsTest.java b/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessActorsTest.java new file mode 100644 index 0000000..2c1aa57 --- /dev/null +++ b/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessActorsTest.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.akka.process; + +import org.apache.tinkerpop.gremlin.GraphProviderClass; +import org.apache.tinkerpop.gremlin.process.ProcessActorsSuite; +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(ProcessActorsSuite.class) +@GraphProviderClass(provider = AkkaActorsProvider.class, graph = TinkerGraph.class) +public class AkkaActorsProcessActorsTest { +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessStandardTest.java ---------------------------------------------------------------------- diff --git a/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessStandardTest.java b/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessStandardTest.java deleted file mode 100644 index 2e84bd9..0000000 --- a/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProcessStandardTest.java +++ /dev/null @@ -1,33 +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.akka.process; - -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 = AkkaActorsProvider.class, graph = TinkerGraph.class) -public class AkkaActorsProcessStandardTest { -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProvider.java ---------------------------------------------------------------------- diff --git a/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProvider.java b/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProvider.java index 968fb99..6756e0c 100644 --- a/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProvider.java +++ b/akka-gremlin/src/test/java/org/apache/tinkerpop/gremlin/akka/process/AkkaActorsProvider.java @@ -150,4 +150,9 @@ public class AkkaActorsProvider extends AbstractGraphProvider { g.withProcessor(GraphActors.open(AkkaGraphActors.class)); } } + + @Override + public GraphActors getGraphActors(final Graph graph) { + return AkkaGraphActors.open().workers(new Random().nextInt(15) + 1); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java index 840c5da..0aea51b 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java @@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.computer.Memory; import org.apache.tinkerpop.gremlin.process.computer.VertexProgram; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import java.lang.reflect.Method; import java.util.Iterator; @@ -72,7 +73,7 @@ public final class GraphComputerHelper { } public static GraphComputer configure(GraphComputer computer, final Configuration configuration) { - final Iterator<String> keys = configuration.getKeys(); + final Iterator<String> keys = IteratorUtils.asList(configuration.getKeys()).iterator(); while (keys.hasNext()) { final String key = keys.next(); if (key.equals(GraphComputer.WORKERS)) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/GlobalPartitioner.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/GlobalPartitioner.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/GlobalPartitioner.java index 1d72a2d..4d9f565 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/GlobalPartitioner.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/GlobalPartitioner.java @@ -67,7 +67,7 @@ public final class GlobalPartitioner implements Partitioner { private GlobalPartition(final Graph graph) { this.graph = graph; - this.id = this.graph.toString(); + this.id = "global-" + graph.getClass().getSimpleName().toLowerCase(); try { this.location = InetAddress.getLocalHost(); } catch (final UnknownHostException e) { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java index 15b4563..3e937d2 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java @@ -77,7 +77,7 @@ public final class HashPartitioner implements Partitioner { this.basePartition = basePartition; this.totalSplits = totalSplits; this.splitId = splitId; - this.id = this.basePartition.id() + "#" + splitId; + this.id = this.basePartition.id() + "-split-" + splitId; } @Override http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java index 6886465..43b3608 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java @@ -19,6 +19,7 @@ package org.apache.tinkerpop.gremlin; import org.apache.commons.configuration.Configuration; +import org.apache.tinkerpop.gremlin.process.actor.GraphActors; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; @@ -114,6 +115,11 @@ public class GraphManager { } @Override + public GraphActors getGraphActors(final Graph graph) { + return innerGraphProvider.getGraphActors(graph); + } + + @Override public Graph standardTestGraph(final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) { // call the ManagedGraphProvider.openTestGraph() so that the created Graph/Configuration instances // are tracked http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java index c785cfc..9d63b3c 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java @@ -19,6 +19,7 @@ package org.apache.tinkerpop.gremlin; import org.apache.commons.configuration.Configuration; +import org.apache.tinkerpop.gremlin.process.actor.GraphActors; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; @@ -115,6 +116,10 @@ public interface GraphProvider { return graph.compute(); } + public default GraphActors getGraphActors(final Graph graph) { + throw new UnsupportedOperationException("This is currently unsupported by this graph provider: GraphProvider.getGraphActors()"); + } + /** * Creates a new {@link org.apache.tinkerpop.gremlin.structure.Graph} instance using the default * {@code org.apache.commons.configuration.Configuration} from http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessActorsSuite.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessActorsSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessActorsSuite.java new file mode 100644 index 0000000..b89408a --- /dev/null +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessActorsSuite.java @@ -0,0 +1,272 @@ +/* + * 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; + +import org.apache.tinkerpop.gremlin.AbstractGremlinSuite; +import org.apache.tinkerpop.gremlin.process.actors.GraphActorsTest; +import org.apache.tinkerpop.gremlin.process.traversal.CoreTraversalTest; +import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; +import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.ComplexTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.branch.LocalTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.branch.OptionalTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.branch.UnionTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.AndTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CoinTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CyclicPathTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DedupTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.IsTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.OrTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.RangeTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.SampleTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.SimplePathTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TailTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.CoalesceTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.FoldTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.LoopsTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MapKeysTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MapTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MapValuesTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MaxTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MeanTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.MinTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProfileTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProjectTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.SelectTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.SumTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.ValueMapTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ExplainTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupTestV3d0; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SackTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectCapTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StoreTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SubgraphTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.TreeTest; +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.decoration.TranslationStrategyProcessTest; +import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategyProcessTest; +import org.junit.runners.model.InitializationError; +import org.junit.runners.model.RunnerBuilder; + +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ +public class ProcessActorsSuite extends AbstractGremlinSuite { + + /** + * This list of tests in the suite that will be executed as part of this suite. + */ + private static final Class<?>[] allTests = new Class<?>[]{ + GraphActorsTest.class, + // branch + BranchTest.Traversals.class, + ChooseTest.Traversals.class, + OptionalTest.Traversals.class, + LocalTest.Traversals.class, + RepeatTest.Traversals.class, + UnionTest.Traversals.class, + + // filter + AndTest.Traversals.class, + CoinTest.Traversals.class, + CyclicPathTest.Traversals.class, + DedupTest.Traversals.class, + DropTest.Traversals.class, + FilterTest.Traversals.class, + HasTest.Traversals.class, + IsTest.Traversals.class, + OrTest.Traversals.class, + RangeTest.Traversals.class, + SampleTest.Traversals.class, + SimplePathTest.Traversals.class, + TailTest.Traversals.class, + WhereTest.Traversals.class, + + // map + AddEdgeTest.Traversals.class, + AddVertexTest.Traversals.class, + CoalesceTest.Traversals.class, + ConstantTest.Traversals.class, + CountTest.Traversals.class, + FlatMapTest.Traversals.class, + FoldTest.Traversals.class, + GraphTest.Traversals.class, + LoopsTest.Traversals.class, + MapTest.Traversals.class, + MapKeysTest.Traversals.class, + MapValuesTest.Traversals.class, + MatchTest.CountMatchTraversals.class, + MatchTest.GreedyMatchTraversals.class, + MaxTest.Traversals.class, + MeanTest.Traversals.class, + MinTest.Traversals.class, + SumTest.Traversals.class, + OrderTest.Traversals.class, + PathTest.Traversals.class, + ProfileTest.Traversals.class, + ProjectTest.Traversals.class, + PropertiesTest.Traversals.class, + SelectTest.Traversals.class, + VertexTest.Traversals.class, + UnfoldTest.Traversals.class, + ValueMapTest.Traversals.class, + + // sideEffect + AggregateTest.Traversals.class, + ExplainTest.Traversals.class, + GroupTest.Traversals.class, + GroupTestV3d0.Traversals.class, + GroupCountTest.Traversals.class, + InjectTest.Traversals.class, + SackTest.Traversals.class, + SideEffectCapTest.Traversals.class, + SideEffectTest.Traversals.class, + StoreTest.Traversals.class, + SubgraphTest.Traversals.class, + TreeTest.Traversals.class, + + // compliance + ComplexTest.Traversals.class, + CoreTraversalTest.class, + TraversalInterruptionTest.class, + + // creations + TranslationStrategyProcessTest.class, + + // decorations + ElementIdStrategyProcessTest.class, + EventStrategyProcessTest.class, + ReadOnlyStrategyProcessTest.class, + PartitionStrategyProcessTest.class, + SubgraphStrategyProcessTest.class + }; + + /** + * A list of the minimum set of base tests that Gremlin flavors should implement to be compliant with Gremlin. + */ + private static final Class<?>[] testsToEnforce = new Class<?>[]{ + GraphActorsTest.class, + // branch + BranchTest.class, + ChooseTest.class, + OptionalTest.class, + LocalTest.class, + RepeatTest.class, + UnionTest.class, + + // filter + AndTest.class, + CoinTest.class, + CyclicPathTest.class, + DedupTest.class, + DropTest.class, + FilterTest.class, + HasTest.class, + IsTest.class, + OrTest.class, + RangeTest.class, + SampleTest.class, + SimplePathTest.class, + TailTest.class, + WhereTest.class, + + // map + AddEdgeTest.class, + AddVertexTest.class, + CoalesceTest.class, + ConstantTest.class, + CountTest.class, + FlatMapTest.class, + FoldTest.class, + LoopsTest.class, + MapTest.class, + MapKeysTest.class, + MapValuesTest.class, + MatchTest.class, + MaxTest.class, + MeanTest.class, + MinTest.class, + SumTest.class, + OrderTest.class, + PathTest.class, + PropertiesTest.class, + ProfileTest.class, + ProjectTest.class, + SelectTest.class, + VertexTest.class, + UnfoldTest.class, + ValueMapTest.class, + + // sideEffect + AggregateTest.class, + GroupTest.class, + GroupCountTest.class, + InjectTest.class, + SackTest.class, + SideEffectCapTest.class, + SideEffectTest.class, + StoreTest.class, + SubgraphTest.class, + TreeTest.class, + }; + + /** + * This constructor is used by JUnit and will run this suite with its concrete implementations of the + * {@code testsToEnforce}. + */ + public ProcessActorsSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError { + super(klass, builder, allTests, testsToEnforce, false, TraversalEngine.Type.STANDARD); + } + + /** + * This constructor is used by Gremlin flavor implementers who supply their own implementations of the + * {@code testsToEnforce}. + */ + public ProcessActorsSuite(final Class<?> klass, final RunnerBuilder builder, final Class<?>[] testsToExecute) throws InitializationError { + super(klass, builder, testsToExecute, testsToEnforce, true, TraversalEngine.Type.STANDARD); + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/actors/GraphActorsTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/actors/GraphActorsTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/actors/GraphActorsTest.java new file mode 100644 index 0000000..d040f49 --- /dev/null +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/actors/GraphActorsTest.java @@ -0,0 +1,42 @@ +/* + * 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.actors; + +import org.apache.tinkerpop.gremlin.LoadGraphWith; +import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; +import org.apache.tinkerpop.gremlin.process.actor.GraphActors; +import org.apache.tinkerpop.gremlin.structure.util.StringFactory; +import org.junit.Test; + +import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN; +import static org.junit.Assert.assertEquals; + +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ +public class GraphActorsTest extends AbstractGremlinProcessTest { + + @Test + @LoadGraphWith(MODERN) + public void shouldHaveStandardStringRepresentation() { + final GraphActors actors = graphProvider.getGraphActors(graph); + assertEquals(StringFactory.graphActorsString(actors), actors.toString()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/AbstractHadoopGraphComputer.java ---------------------------------------------------------------------- diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/AbstractHadoopGraphComputer.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/AbstractHadoopGraphComputer.java index 93f3de6..344f04e 100644 --- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/AbstractHadoopGraphComputer.java +++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/AbstractHadoopGraphComputer.java @@ -18,6 +18,7 @@ */ package org.apache.tinkerpop.gremlin.hadoop.process.computer; +import org.apache.commons.configuration.ConfigurationUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocatedFileStatus; @@ -76,6 +77,7 @@ public abstract class AbstractHadoopGraphComputer implements GraphComputer { public AbstractHadoopGraphComputer(final HadoopGraph hadoopGraph) { this.hadoopGraph = hadoopGraph; this.logger = LoggerFactory.getLogger(this.getClass()); + //GraphComputerHelper.configure(this, this.hadoopGraph.configuration()); } @Override http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/structure/io/partitioner/TinkerGraphPartitionerProvider.java ---------------------------------------------------------------------- diff --git a/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/structure/io/partitioner/TinkerGraphPartitionerProvider.java b/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/structure/io/partitioner/TinkerGraphPartitionerProvider.java index 941c942..9046c76 100644 --- a/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/structure/io/partitioner/TinkerGraphPartitionerProvider.java +++ b/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/structure/io/partitioner/TinkerGraphPartitionerProvider.java @@ -28,11 +28,21 @@ import org.apache.tinkerpop.gremlin.hadoop.Constants; import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat; import org.apache.tinkerpop.gremlin.hadoop.structure.io.partitioner.PartitionerInputFormat; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; +import org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgramTest; +import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgramTest; +import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionComputerTest; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.PageRankTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.PeerPressureTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest; +import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; +import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategyProcessTest; import org.apache.tinkerpop.gremlin.spark.process.computer.SparkGraphComputer; import org.apache.tinkerpop.gremlin.spark.structure.io.gryo.GryoSerializer; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; @@ -55,9 +65,17 @@ import java.util.Set; public class TinkerGraphPartitionerProvider extends AbstractGraphProvider { private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList( + TraversalInterruptionComputerTest.class.getCanonicalName(), + PageRankTest.Traversals.class.getCanonicalName(), + ProgramTest.Traversals.class.getCanonicalName(), + PeerPressureTest.Traversals.class.getCanonicalName(), + BulkLoaderVertexProgramTest.class.getCanonicalName(), + PageRankVertexProgramTest.class.getCanonicalName(), + ReadOnlyStrategyProcessTest.class.getCanonicalName(), "testProfileStrategyCallback", "testProfileStrategyCallbackSideEffect", "shouldSucceedWithProperTraverserRequirements", + "shouldStartAndEndWorkersForVertexProgramAndMapReduce", "shouldFailWithImproperTraverserRequirements")); private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{ @@ -92,11 +110,13 @@ public class TinkerGraphPartitionerProvider extends AbstractGraphProvider { put(Constants.GREMLIN_HADOOP_GRAPH_WRITER, GryoOutputFormat.class.getCanonicalName()); put(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, getWorkingDirectory()); put(Constants.GREMLIN_HADOOP_JARS_IN_DISTRIBUTED_CACHE, false); - put(GraphComputer.GRAPH_COMPUTER, SparkGraphComputer.class.getCanonicalName()); + if (!skipTest) + put(GraphComputer.GRAPH_COMPUTER, SparkGraphComputer.class.getCanonicalName()); put(Constants.GREMLIN_SPARK_PERSIST_CONTEXT, true); put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo"); // System.out.println(AbstractGremlinTest.class.getResource(loadGraphWith.location()).toString().replace("file:","")); - put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, AbstractGremlinTest.class.getResource(loadGraphWith.location()).toString().replace("file:", "")); + if (null != loadGraphWith) + put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, AbstractGremlinTest.class.getResource(loadGraphWith.location()).toString().replace("file:", "")); }}; @@ -108,7 +128,9 @@ public class TinkerGraphPartitionerProvider extends AbstractGraphProvider { @Override public void clear(final Graph graph, final Configuration configuration) throws Exception { - //if (graph != null) + if (null != graph) + ((TinkerGraph) graph).clear(); + // if (graph != null) // graph.close(); } @@ -141,15 +163,17 @@ public class TinkerGraphPartitionerProvider extends AbstractGraphProvider { @Override public GraphTraversalSource traversal(final Graph graph) { - if ((Boolean) graph.configuration().getProperty("skipTest")) - return graph.traversal().withComputer(); - else { - return graph.traversal().withProcessor(SparkGraphComputer.open(graph.configuration())); - } + if (graph.configuration().getBoolean("skipTest", false)) + return graph.traversal().withStrategies(ReadOnlyStrategy.instance()).withComputer(); + else + return graph.traversal().withStrategies(ReadOnlyStrategy.instance()).withProcessor(SparkGraphComputer.open(graph.configuration())); } @Override public GraphComputer getGraphComputer(final Graph graph) { - return SparkGraphComputer.open(graph.configuration()); + if (graph.configuration().getBoolean("skipTest", false)) + return new TinkerGraphComputer((TinkerGraph) graph); + else + return SparkGraphComputer.open(graph.configuration()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/343e9b79/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java ---------------------------------------------------------------------- diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java index b40515e..6d6ec5b 100644 --- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java +++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java @@ -67,6 +67,7 @@ import java.util.stream.Stream; @Graph.OptIn(Graph.OptIn.SUITE_GROOVY_PROCESS_COMPUTER) @Graph.OptIn(Graph.OptIn.SUITE_GROOVY_ENVIRONMENT) @Graph.OptIn(Graph.OptIn.SUITE_GROOVY_ENVIRONMENT_INTEGRATE) +@Graph.OptIn("org.apache.tinkerpop.gremlin.process.ProcessActorsSuite") public final class TinkerGraph implements Graph { static {