org.apache.tinkerpop.gremlin

## Class AbstractGremlinTest

- java.lang.Object
- - org.apache.tinkerpop.gremlin.AbstractGremlinTest

- Direct Known Subclasses:
    AbstractGeneratorTest, AbstractGremlinProcessTest, AddVertexTest, CommunityGeneratorTest.ProcessorTest, CredentialGraphTest, CredentialGraphTest, DetachedEdgeTest, DetachedGraphTest, DetachedPropertyTest, DetachedVertexPropertyTest, DetachedVertexTest, DistributionGeneratorTest.ProcessorTest, DropTest, EdgeTest.BasicEdgeTest, FeatureSupportTest.EdgeFunctionalityTest, FeatureSupportTest.ElementPropertyDataTypeFunctionalityTest, FeatureSupportTest.FeatureToStringTest, FeatureSupportTest.GraphFunctionalityTest, FeatureSupportTest.GraphVariablesFunctionalityTest, FeatureSupportTest.LogicalFeatureSupportTest, FeatureSupportTest.VertexFunctionalityTest, FeatureSupportTest.VertexPropertyFunctionalityTest, GraphConstructionTest, GraphReadPerformanceTest.ReadFromGraph, GraphTest, GraphWritePerformanceTest.WriteToGraph, GraphWritePerformanceTest.WriteToIO, GremlinExecutorOverGraphTest, GremlinExecutorPerformanceTest, GremlinGroovyScriptEngineFileSandboxTest, GremlinGroovyScriptEngineIntegrateTest, GremlinGroovyScriptEngineOverGraphTest, GremlinGroovyScriptEngineSandboxCustomTest, GremlinGroovyScriptEngineSandboxedStandardTest, GremlinGroovyScriptEngineTinkerPopSandboxTest, GroovyTranslatorTest, IoCustomTest, IoEdgeTest, IoGraphTest, IoIntegrateTest, IoPropertyTest, IoTest.GraphMLTest, IoTest.GraphSONTest, IoTest.GryoTest, IoVertexTest, PropertyTest.BasicPropertyTest, PropertyTest.ElementGetValueExceptionConsistencyTest, PropertyTest.PropertyFeatureSupportTest, PropertyTest.PropertyValidationOnAddExceptionConsistencyTest, PropertyTest.PropertyValidationOnSetExceptionConsistencyTest, ReferenceEdgeTest, ReferenceGraphTest, ReferenceVertexPropertyTest, ReferenceVertexTest, SerializationTest.GraphSONTest, SerializationTest.GryoTest, StarGraphTest, TransactionTest, TraversalPerformanceTest, VariablesTest.GraphVariablesFeatureSupportTest, VariablesTest.StringRepresentationTest, VariablesTest.VariableAsMapTest, VariablesTest.VariableExceptionConsistencyTest, VertexPropertyTest, VertexPropertyTest.BasicVertexProperty, VertexPropertyTest.VertexPropertyAddition, VertexPropertyTest.VertexPropertyProperties, VertexPropertyTest.VertexPropertyRemoval, VertexTest.AddEdgeTest, VertexTest.BasicVertexTest

      public abstract class AbstractGremlinTest
      extends Object

  Sets up g based on the current graph configuration and checks required features for the test.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Configuration` | `config`
    `protected GraphTraversalSource` | `g`
    `protected Graph` | `graph`
    `protected GraphProvider` | `graphProvider`
    `TestName` | `name`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractGremlinTest()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterLoadGraphWith(Graph g)`
    `static void` | `assertVertexEdgeCounts(Graph graph, int expectedVertexCount, int expectedEdgeCount)`
    `protected void` | `beforeLoadGraphWith(Graph g)`
    `Object` | `convertToEdgeId(Graph graph, String outVertexName, String edgeLabel, String inVertexName)`
    `Object` | `convertToEdgeId(String outVertexName, String edgeLabel, String inVertexName)`
    `Vertex` | `convertToVertex(Graph graph, String vertexName)`
    `Object` | `convertToVertexId(Graph graph, String vertexName)` Looks up the identifier as generated by the current source graph being tested.
    `Object` | `convertToVertexId(String vertexName)` Looks up the identifier as generated by the current source graph being tested.
    `GraphTraversal<Vertex,VertexProperty<Object>>` | `convertToVertexProperty(Graph graph, String vertexName, String vertexPropertyKey)`
    `GraphTraversal<Vertex,Object>` | `convertToVertexPropertyId(Graph graph, String vertexName, String vertexPropertyKey)`
    `GraphTraversal<Vertex,Object>` | `convertToVertexPropertyId(String vertexName, String vertexPropertyKey)`
    `static Consumer<Graph>` | `getAssertVertexEdgeCounts(int expectedVertexCount, int expectedEdgeCount)`
    `void` | `printTraversalForm(Traversal traversal)`
    `void` | `setup()`
    `void` | `tearDown()`
    `void` | `tryCommit(Graph graph)` Utility method that commits if the graph supports transactions.
    `void` | `tryCommit(Graph graph, Consumer<Graph> assertFunction)` Utility method that commits if the graph supports transactions and executes an assertion function before and after the commit.
    `void` | `tryRandomCommit(Graph graph)` Deprecated. as of 3.1.1-incubating, and is not replaced
    `void` | `tryRollback(Graph graph)` Utility method that rollsback if the graph supports transactions.
    `static void` | `validateException(Throwable expected, Throwable actual)`
    `static void` | `verifyUniqueStepIds(Traversal.Admin<?,?> traversal)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### graph

          protected Graph graph

    - #### g

          protected GraphTraversalSource g

    - #### config

          protected Configuration config

    - #### graphProvider

          protected GraphProvider graphProvider

    - #### name

          public TestName name

  - ### Constructor Detail

    - #### AbstractGremlinTest

          public AbstractGremlinTest()

  - ### Method Detail

    - #### setup

          public void setup()
                     throws Exception

      Throws:
        `Exception`

    - #### beforeLoadGraphWith

          protected void beforeLoadGraphWith(Graph g)
                                      throws Exception

      Throws:
        `Exception`

    - #### afterLoadGraphWith

          protected void afterLoadGraphWith(Graph g)
                                     throws Exception

      Throws:
        `Exception`

    - #### tearDown

          public void tearDown()
                        throws Exception

      Throws:
        `Exception`

    - #### convertToVertexId

          public Object convertToVertexId(String vertexName)

      Looks up the identifier as generated by the current source graph being tested.
      Parameters:
        `vertexName` - a unique string that will identify a graph element within a graph
      Returns:
        the id as generated by the graph

    - #### convertToVertexId

          public Object convertToVertexId(Graph graph,
                                          String vertexName)

      Looks up the identifier as generated by the current source graph being tested.
      Parameters:
        `graph` - the graph to get the element id from
        `vertexName` - a unique string that will identify a graph element within a graph
      Returns:
        the id as generated by the graph

    - #### convertToVertex

          public Vertex convertToVertex(Graph graph,
                                        String vertexName)

    - #### convertToVertexPropertyId

          public GraphTraversal<Vertex,Object> convertToVertexPropertyId(String vertexName,
                                                                         String vertexPropertyKey)

    - #### convertToVertexPropertyId

          public GraphTraversal<Vertex,Object> convertToVertexPropertyId(Graph graph,
                                                                         String vertexName,
                                                                         String vertexPropertyKey)

    - #### convertToVertexProperty

          public GraphTraversal<Vertex,VertexProperty<Object>> convertToVertexProperty(Graph graph,
                                                                                       String vertexName,
                                                                                       String vertexPropertyKey)

    - #### convertToEdgeId

          public Object convertToEdgeId(String outVertexName,
                                        String edgeLabel,
                                        String inVertexName)

    - #### convertToEdgeId

          public Object convertToEdgeId(Graph graph,
                                        String outVertexName,
                                        String edgeLabel,
                                        String inVertexName)

    - #### tryCommit

          public void tryCommit(Graph graph)

      Utility method that commits if the graph supports transactions.

    - #### tryRandomCommit

          @Deprecated
          public void tryRandomCommit(Graph graph)

      Deprecated. as of 3.1.1-incubating, and is not replaced
      This method does not appear to be used in TinkerPop core. It was used at one time by Neo4j tests, but wasn't really a great pattern and was eventually removed.

    - #### tryCommit

          public void tryCommit(Graph graph,
                                Consumer<Graph> assertFunction)

      Utility method that commits if the graph supports transactions and executes an assertion function before and after the commit. It assumes that the assertion should be true before and after the commit.

    - #### tryRollback

          public void tryRollback(Graph graph)

      Utility method that rollsback if the graph supports transactions.

    - #### printTraversalForm

          public void printTraversalForm(Traversal traversal)

    - #### assertVertexEdgeCounts

          public static void assertVertexEdgeCounts(Graph graph,
                                                    int expectedVertexCount,
                                                    int expectedEdgeCount)

    - #### getAssertVertexEdgeCounts

          public static Consumer<Graph> getAssertVertexEdgeCounts(int expectedVertexCount,
                                                                  int expectedEdgeCount)

    - #### validateException

          public static void validateException(Throwable expected,
                                               Throwable actual)

    - #### verifyUniqueStepIds

          public static void verifyUniqueStepIds(Traversal.Admin<?,?> traversal)

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.