public abstract class AbstractGraphProvider extends Object implements GraphProvider
CORE_IMPLEMENTATIONS
Constructor and Description |
---|
AbstractGraphProvider() |
Modifier and Type | Method and Description |
---|---|
protected static void |
deleteDirectory(File directory) |
abstract Map<String,Object> |
getBaseConfiguration(String graphName,
Class<?> test,
String testMethodName)
Provides a basic configuration for a particular
Graph instance and used
the graphName to ensure that the instance is unique. |
protected String |
getWorkingDirectory() |
void |
loadGraphData(Graph graph,
LoadGraphWith loadGraphWith,
Class testClass,
String testName)
Tests are annotated with a
LoadGraphWith annotation. |
Configuration |
newGraphConfiguration(String graphName,
Class<?> test,
String testMethodName,
Map<String,Object> configurationOverrides)
When implementing this method ensure that a test suite can override any settings EXCEPT the
"gremlin.graph" setting which should be defined by the implementer.
|
protected void |
readIntoGraph(Graph g,
String path) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, clear, convertId, convertLabel, getImplementations, newGraphConfiguration, openTestGraph, reconstituteGraphSONIdentifier, standardGraphConfiguration, standardTestGraph, traversal, traversal
public abstract Map<String,Object> getBaseConfiguration(String graphName, Class<?> test, String testMethodName)
Graph
instance and used
the graphName
to ensure that the instance is unique. It is up to the Gremlin implementation
to determine how best to use the graphName
to ensure uniqueness. For example, Neo4j, might use the
graphName
might be used to create a different sub-directory where the graph is stored.
The @{code test} and @{code testMethodName} can be used to alter graph configurations for specific tests.
For example, a graph that has support for different transaction isolation levels might only support a feature
in a specific configuration. Using these arguments, the implementation could detect when a test was being
fired that required the database to be configured in a specific isolation level and return a configuration
to support that.graphName
- a value that represents a unique configuration for a graphtest
- the test classtestMethodName
- the name of the test methodMap
that should be unique per the graphName
public Configuration newGraphConfiguration(String graphName, Class<?> test, String testMethodName, Map<String,Object> configurationOverrides)
GraphProvider
org.apache.commons.configuration.Configuration
that will generate a graph unique to that graphName
.newGraphConfiguration
in interface GraphProvider
graphName
- a unique test graph nametest
- the test classtestMethodName
- the name of the testconfigurationOverrides
- settings to override defaults with.public void loadGraphData(Graph graph, LoadGraphWith loadGraphWith, Class testClass, String testName)
GraphProvider
LoadGraphWith
annotation. These annotations tell
the test what kind of data to preload into the graph instance. It is up to the implementation to load the
graph with the data specified by that annotation. This method also represents the place where indices should
be configured according the the Graph
implementation's API. Implementers can use the testClass
and testName
arguments to implement test specific configurations to their graphs.loadGraphData
in interface GraphProvider
graph
- the Graph
instance to load data into constructed by this GraphProvider
loadGraphWith
- the annotation for the currently running test - this value may be null if no graph
data is to be loaded in front of the test.testClass
- the test class being executedtestName
- the name of the test method being executedprotected static void deleteDirectory(File directory)
protected String getWorkingDirectory()
protected void readIntoGraph(Graph g, String path) throws IOException
IOException
Copyright © 2013–2015 Apache Software Foundation. All rights reserved.