Java Code Examples for org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph#DefaultIdManager

The following examples show how to use org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph#DefaultIdManager . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TinkerGraphUUIDProvider.java    From tinkergraph-gremlin with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
                                                final LoadGraphWith.GraphData loadGraphWith) {
    final TinkerGraph.DefaultIdManager idManager = TinkerGraph.DefaultIdManager.UUID;
    final String idMaker = 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);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            final File tempDir = TestHelper.makeTestDataPath(test, "temp");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
                    tempDir.getAbsolutePath() + File.separator + testMethodName + ".kryo");
        }
    }};
}
 
Example 2
Source File: TinkerGraphProvider.java    From tinkergraph-gremlin with Apache License 2.0 6 votes vote down vote up
@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, 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);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            final File tempDir = TestHelper.makeTestDataPath(test, "temp");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
                    tempDir.getAbsolutePath() + File.separator + testMethodName + ".kryo");
        }
    }};
}
 
Example 3
Source File: TinkerGraphProvider.java    From tinkergraph-gremlin with Apache License 2.0 6 votes vote down vote up
/**
 * 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()));
}
 
Example 4
Source File: TinkerGraphUUIDProvider.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
                                                final LoadGraphWith.GraphData loadGraphWith) {
    final TinkerGraph.DefaultIdManager idManager = TinkerGraph.DefaultIdManager.UUID;
    final String idMaker = 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);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, TestHelper.makeTestDataFile(test, "temp", testMethodName + ".kryo"));
        }
    }};
}
 
Example 5
Source File: TinkerGraphProvider.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@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, 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);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,TestHelper.makeTestDataFile(test, "temp", testMethodName + ".kryo"));
        }
    }};
}
 
Example 6
Source File: TinkerGraphProvider.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
/**
 * 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()));
}
 
Example 7
Source File: TinkerGraphProvider.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@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, 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);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, TestHelper.makeTestDataFile(test, "temp", testMethodName + ".kryo"));
        }
    }};
}
 
Example 8
Source File: TinkerGraphProvider.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
/**
 * 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()));
}