This is an automated email from the ASF dual-hosted git repository. Cole-Greer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit ac524e62c5773085606917f72589a3c9a284e9d4 Merge: 1abfc0cf99 5f1c592a59 Author: Cole Greer <[email protected]> AuthorDate: Tue Oct 27 10:09:47 2026 -0700 Merge branch '3.8-dev' CHANGELOG.asciidoc | 2 + .../traversal/step/sideEffect/AddPropertyStep.java | 25 ++-- .../decoration/EventStrategyProcessTest.java | 131 +++++++++++++++++++++ .../tinkergraph/TinkerMemoryGraphProvider.java | 16 ++- .../tinkergraph/TinkerStorageGraphProvider.java | 15 ++- 5 files changed, 177 insertions(+), 12 deletions(-) diff --cc tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerMemoryGraphProvider.java index 170b43f8f5,0000000000..3a5e562c42 mode 100644,000000..100644 --- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerMemoryGraphProvider.java +++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerMemoryGraphProvider.java @@@ -1,189 -1,0 +1,203 @@@ +/* + * 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.tinkergraph; + +import org.apache.commons.configuration2.Configuration; +import org.apache.tinkerpop.gremlin.AbstractGraphProvider; +import org.apache.tinkerpop.gremlin.LoadGraphWith; ++import org.apache.tinkerpop.gremlin.TestHelper; ++import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.GraphTest; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest; +import org.apache.tinkerpop.gremlin.structure.io.IoVertexTest; +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedGraphTest; +import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphTest; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerMemoryGraph; +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.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public class TinkerMemoryGraphProvider extends AbstractGraphProvider { + + private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{ + add(TinkerEdge.class); + add(TinkerElement.class); + add(TinkerMemoryGraph.class); + add(AbstractTinkerGraph.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) ? selectIdMakerFromTest(test, testMethodName) : idManager).name(); + return new HashMap<String, Object>() {{ + put(Graph.GRAPH, TinkerMemoryGraph.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); + if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName)) + put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); ++ if (requiresSetCardinalityAsDefault(test, testMethodName)) ++ put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.set.name()); + }}; + } + + @Override + public void clear(final Graph graph, final Configuration configuration) throws Exception { + if (graph != null) + graph.close(); + } + + @Override + public Set<Class> getImplementations() { + return IMPLEMENTATION; + } + + /** + * Determines if a test requires a different cardinality as the default or not. + */ + protected static boolean requiresListCardinalityAsDefault(final LoadGraphWith.GraphData loadGraphWith, + final Class<?> test, final String testMethodName) { + return loadGraphWith == LoadGraphWith.GraphData.CREW + || (test == StarGraphTest.class && testMethodName.equals("shouldAttachWithCreateMethod")) - || (test == DetachedGraphTest.class && testMethodName.equals("testAttachableCreateMethod")); ++ || (test == DetachedGraphTest.class && testMethodName.equals("testAttachableCreateMethod")) ++ || (test == EventStrategyProcessTest.class && testMethodName.equals("shouldNotCaptureOldVertexPropertyWhenAddedWithDefaultListCardinality")); ++ } ++ ++ /** ++ * Determines if a test requires set cardinality as the default. ++ */ ++ protected static boolean requiresSetCardinalityAsDefault(final Class<?> test, final String testMethodName) { ++ return test == EventStrategyProcessTest.class ++ && (testMethodName.equals("shouldCaptureOldVertexPropertyWhenChangedWithDefaultSetCardinality") ++ || testMethodName.equals("shouldNotCaptureOldVertexPropertyWhenValueIsNewWithDefaultSetCardinality")); + } + + /** + * Some tests require special configuration for TinkerGraph to properly configure the id manager. + */ + protected TinkerGraph.DefaultIdManager selectIdMakerFromTest(final Class<?> test, final String testMethodName) { + if (test.equals(GraphTest.class)) { + final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{ + add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentations"); + add("shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentations"); + add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentations"); + add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingStringRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingStringRepresentations"); + }}; + + final Set<String> testsThatNeedUuidIdManager = new HashSet<String>(){{ + add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentation"); + add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentations"); + add("shouldIterateEdgesWithUuidIdSupportUsingStringRepresentation"); + add("shouldIterateEdgesWithUuidIdSupportUsingStringRepresentations"); + }}; + + if (testsThatNeedLongIdManager.contains(testMethodName)) + return TinkerGraph.DefaultIdManager.LONG; + else if (testsThatNeedUuidIdManager.contains(testMethodName)) + return TinkerGraph.DefaultIdManager.UUID; + } else if (test.equals(IoEdgeTest.class)) { + final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{ + add("shouldReadWriteEdge[graphson-v1]"); + add("shouldReadWriteDetachedEdgeAsReference[graphson-v1]"); + add("shouldReadWriteDetachedEdge[graphson-v1]"); + add("shouldReadWriteEdge[graphson-v2]"); + add("shouldReadWriteDetachedEdgeAsReference[graphson-v2]"); + add("shouldReadWriteDetachedEdge[graphson-v2]"); + }}; + + if (testsThatNeedLongIdManager.contains(testMethodName)) + return TinkerGraph.DefaultIdManager.LONG; + } else if (test.equals(IoVertexTest.class)) { + final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{ + add("shouldReadWriteVertexWithBOTHEdges[graphson-v1]"); + add("shouldReadWriteVertexWithINEdges[graphson-v1]"); + add("shouldReadWriteVertexWithOUTEdges[graphson-v1]"); + add("shouldReadWriteVertexNoEdges[graphson-v1]"); + add("shouldReadWriteDetachedVertexNoEdges[graphson-v1]"); + add("shouldReadWriteDetachedVertexAsReferenceNoEdges[graphson-v1]"); + add("shouldReadWriteVertexMultiPropsNoEdges[graphson-v1]"); + add("shouldReadWriteVertexWithBOTHEdges[graphson-v2]"); + add("shouldReadWriteVertexWithINEdges[graphson-v2]"); + add("shouldReadWriteVertexWithOUTEdges[graphson-v2]"); + add("shouldReadWriteVertexNoEdges[graphson-v2]"); + add("shouldReadWriteDetachedVertexNoEdges[graphson-v2]"); + add("shouldReadWriteDetachedVertexAsReferenceNoEdges[graphson-v2]"); + add("shouldReadWriteVertexMultiPropsNoEdges[graphson-v2]"); + }}; + + if (testsThatNeedLongIdManager.contains(testMethodName)) + return TinkerGraph.DefaultIdManager.LONG; + } + + return TinkerGraph.DefaultIdManager.ANY; + } + + /** + * 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 if (loadGraphWith.equals(LoadGraphWith.GraphData.SINK)) + return TinkerGraph.DefaultIdManager.INTEGER; + else + throw new IllegalStateException(String.format("Need to define a new %s for %s", TinkerGraph.IdManager.class.getName(), loadGraphWith.name())); + } +} diff --cc tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerStorageGraphProvider.java index 3d235b284b,0000000000..88df57e037 mode 100644,000000..100644 --- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerStorageGraphProvider.java +++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerStorageGraphProvider.java @@@ -1,212 -1,0 +1,225 @@@ +/* + * 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.tinkergraph; + +import org.apache.commons.configuration2.Configuration; +import org.apache.tinkerpop.gremlin.AbstractGraphProvider; +import org.apache.tinkerpop.gremlin.LoadGraphWith; +import org.apache.tinkerpop.gremlin.TestHelper; ++import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.GraphTest; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest; +import org.apache.tinkerpop.gremlin.structure.io.IoVertexTest; +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedGraphTest; +import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphTest; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.DefaultIdManager; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphVariables; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerStorageGraph; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertexProperty; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class TinkerStorageGraphProvider extends AbstractGraphProvider { + + private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{ + add(TinkerEdge.class); + add(TinkerElement.class); + add(TinkerStorageGraph.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 DefaultIdManager idManager = selectIdMakerFromGraphData(loadGraphWith); + final String idMaker = (idManager.equals(DefaultIdManager.ANY) ? selectIdMakerFromTest(test, testMethodName) : idManager).name(); + return new HashMap<String, Object>() {{ + put(Graph.GRAPH, TinkerStorageGraph.class.getName()); + put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, idMaker); + put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, idMaker); + put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, idMaker); + if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName)) + put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); ++ if (requiresSetCardinalityAsDefault(test, testMethodName)) ++ put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.set.name()); + if (requiresPersistence(test, testMethodName)) { + put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_STORAGE, "graphbinary"); + put(TinkerStorageGraph.GREMLIN_TINKERGRAPH_STORAGE_DIRECTORY, + TestHelper.makeTestDataDirectory(test, "temp", testMethodName)); + } + }}; + } + + @Override + public void clear(final Graph graph, final Configuration configuration) throws Exception { + if (graph != null) + graph.close(); + + // in the event the graph is persisted we need to clean up the storage directory + final String storageDirectory = null != configuration ? configuration.getString(TinkerStorageGraph.GREMLIN_TINKERGRAPH_STORAGE_DIRECTORY, null) : null; + if (storageDirectory != null) { + deleteDirectory(new File(storageDirectory)); + } + } + + @Override + public Set<Class> getImplementations() { + return IMPLEMENTATION; + } + + /** + * Determines if a test requires TinkerGraph persistence to be configured with graph location and format. + */ + protected static boolean requiresPersistence(final Class<?> test, final String testMethodName) { + return test == GraphTest.class && testMethodName.equals("shouldPersistDataOnClose"); + } + + /** + * Determines if a test requires a different cardinality as the default or not. + */ + protected static boolean requiresListCardinalityAsDefault(final LoadGraphWith.GraphData loadGraphWith, + final Class<?> test, final String testMethodName) { + return loadGraphWith == LoadGraphWith.GraphData.CREW + || (test == StarGraphTest.class && testMethodName.equals("shouldAttachWithCreateMethod")) - || (test == DetachedGraphTest.class && testMethodName.equals("testAttachableCreateMethod")); ++ || (test == DetachedGraphTest.class && testMethodName.equals("testAttachableCreateMethod")) ++ || (test == EventStrategyProcessTest.class && testMethodName.equals("shouldNotCaptureOldVertexPropertyWhenAddedWithDefaultListCardinality")); ++ } ++ ++ /** ++ * Determines if a test requires set cardinality as the default. ++ */ ++ protected static boolean requiresSetCardinalityAsDefault(final Class<?> test, final String testMethodName) { ++ return test == EventStrategyProcessTest.class ++ && (testMethodName.equals("shouldCaptureOldVertexPropertyWhenChangedWithDefaultSetCardinality") ++ || testMethodName.equals("shouldNotCaptureOldVertexPropertyWhenValueIsNewWithDefaultSetCardinality")); + } + + /** + * Some tests require special configuration for TinkerGraph to properly configure the id manager. + */ + protected DefaultIdManager selectIdMakerFromTest(final Class<?> test, final String testMethodName) { + if (test.equals(GraphTest.class)) { + final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{ + add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentations"); + add("shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentations"); + add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentations"); + add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentation"); + add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentations"); + add("shouldIterateEdgesWithNumericIdSupportUsingStringRepresentation"); + add("shouldIterateEdgesWithNumericIdSupportUsingStringRepresentations"); + }}; + + final Set<String> testsThatNeedUuidIdManager = new HashSet<String>(){{ + add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentation"); + add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentations"); + add("shouldIterateEdgesWithUuidIdSupportUsingStringRepresentation"); + add("shouldIterateEdgesWithUuidIdSupportUsingStringRepresentations"); + }}; + + if (testsThatNeedLongIdManager.contains(testMethodName)) + return DefaultIdManager.LONG; + else if (testsThatNeedUuidIdManager.contains(testMethodName)) + return DefaultIdManager.UUID; + } else if (test.equals(IoEdgeTest.class)) { + final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{ + add("shouldReadWriteEdge[graphson-v1]"); + add("shouldReadWriteDetachedEdgeAsReference[graphson-v1]"); + add("shouldReadWriteDetachedEdge[graphson-v1]"); + add("shouldReadWriteEdge[graphson-v2]"); + add("shouldReadWriteDetachedEdgeAsReference[graphson-v2]"); + add("shouldReadWriteDetachedEdge[graphson-v2]"); + }}; + + if (testsThatNeedLongIdManager.contains(testMethodName)) + return DefaultIdManager.LONG; + } else if (test.equals(IoVertexTest.class)) { + final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{ + add("shouldReadWriteVertexWithBOTHEdges[graphson-v1]"); + add("shouldReadWriteVertexWithINEdges[graphson-v1]"); + add("shouldReadWriteVertexWithOUTEdges[graphson-v1]"); + add("shouldReadWriteVertexNoEdges[graphson-v1]"); + add("shouldReadWriteDetachedVertexNoEdges[graphson-v1]"); + add("shouldReadWriteDetachedVertexAsReferenceNoEdges[graphson-v1]"); + add("shouldReadWriteVertexMultiPropsNoEdges[graphson-v1]"); + add("shouldReadWriteVertexWithBOTHEdges[graphson-v2]"); + add("shouldReadWriteVertexWithINEdges[graphson-v2]"); + add("shouldReadWriteVertexWithOUTEdges[graphson-v2]"); + add("shouldReadWriteVertexNoEdges[graphson-v2]"); + add("shouldReadWriteDetachedVertexNoEdges[graphson-v2]"); + add("shouldReadWriteDetachedVertexAsReferenceNoEdges[graphson-v2]"); + add("shouldReadWriteVertexMultiPropsNoEdges[graphson-v2]"); + }}; + + if (testsThatNeedLongIdManager.contains(testMethodName)) + return DefaultIdManager.LONG; + } + + return DefaultIdManager.ANY; + } + + /** + * 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 DefaultIdManager selectIdMakerFromGraphData(final LoadGraphWith.GraphData loadGraphWith) { + if (null == loadGraphWith) return DefaultIdManager.ANY; + if (loadGraphWith.equals(LoadGraphWith.GraphData.CLASSIC)) + return DefaultIdManager.INTEGER; + else if (loadGraphWith.equals(LoadGraphWith.GraphData.MODERN)) + return DefaultIdManager.INTEGER; + else if (loadGraphWith.equals(LoadGraphWith.GraphData.CREW)) + return DefaultIdManager.INTEGER; + else if (loadGraphWith.equals(LoadGraphWith.GraphData.GRATEFUL)) + return DefaultIdManager.INTEGER; + else if (loadGraphWith.equals(LoadGraphWith.GraphData.SINK)) + return DefaultIdManager.INTEGER; + else + throw new IllegalStateException(String.format("Need to define a new %s for %s", TinkerStorageGraph.IdManager.class.getName(), loadGraphWith.name())); + } + + @Override + protected void readIntoGraph(final Graph graph, final String path) throws IOException { + super.readIntoGraph(graph, path); + + graph.tx().commit(); + } +}
