Java Code Examples for org.apache.tinkerpop.gremlin.TestHelper#makeTestDataPath()

The following examples show how to use org.apache.tinkerpop.gremlin.TestHelper#makeTestDataPath() . 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: RecordReaderWriterTest.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldSplitFileAndWriteProperSplits() throws Exception {
    for (int numberOfSplits = 1; numberOfSplits < 10; numberOfSplits++) {
        final File testFile = new File(HadoopGraphProvider.PATHS.get(getInputFilename()));
        logger.info("Testing: {}", testFile + " (splits {}", numberOfSplits + ")");
        final List<FileSplit> splits = generateFileSplits(testFile, numberOfSplits);
        final Class<? extends InputFormat<NullWritable, VertexWritable>> inputFormatClass = getInputFormat();
        final Class<? extends OutputFormat<NullWritable, VertexWritable>> outputFormatClass = getOutputFormat();

        final File outputDirectory = TestHelper.makeTestDataPath(inputFormatClass, "hadoop-record-reader-writer-test");
        final Configuration config = configure(outputDirectory);
        config.addResource(this.configuration);
        validateFileSplits(splits, config, inputFormatClass, Optional.of(outputFormatClass));
    }
}
 
Example 4
Source File: IoDataGenerationTest.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Before
public void before() throws IOException {
    tempPath = TestHelper.makeTestDataPath(TinkerGraphTest.class, "tinkerpop-io");

    FileUtils.deleteDirectory(tempPath);
    if (!tempPath.mkdirs()) throw new IOException(String.format("Could not create %s", tempPath));
}