当前位置: 首页>>代码示例>>Java>>正文


Java LoadGraphWith.GraphData方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData方法的典型用法代码示例。如果您正苦于以下问题:Java LoadGraphWith.GraphData方法的具体用法?Java LoadGraphWith.GraphData怎么用?Java LoadGraphWith.GraphData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.LoadGraphWith的用法示例。


在下文中一共展示了LoadGraphWith.GraphData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@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");
        }
    }};
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:21,代码来源:TinkerGraphUUIDProvider.java

示例2: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@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");
        }
    }};
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:21,代码来源:TinkerGraphProvider.java

示例3: getServerGraphName

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
private static String getServerGraphName(final LoadGraphWith.GraphData loadGraphWith) {
    final String serverGraphName;

    if (null == loadGraphWith) return "graph";

    switch (loadGraphWith) {
        case CLASSIC:
            serverGraphName = "classic";
            break;
        case MODERN:
            serverGraphName = "modern";
            break;
        case GRATEFUL:
            serverGraphName = "grateful";
            break;
        case CREW:
            serverGraphName = "crew";
            break;
        default:
            serverGraphName = "graph";
            break;
    }
    return serverGraphName;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:25,代码来源:RemoteGraphProvider.java

示例4: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
    final Map<String, Object> config = super.getBaseConfiguration(graphName, test, testMethodName, loadGraphWith);
    config.put("mapreduce.job.reduces", 2);
    /// giraph configuration
    config.put(GiraphConstants.LOCAL_TEST_MODE.getKey(), true); // local testing can only spawn one worker
    config.put(GiraphConstants.MIN_WORKERS, 1);
    config.put(GiraphConstants.MAX_WORKERS, 1);
    config.put(GiraphConstants.SPLIT_MASTER_WORKER.getKey(), false);
    config.put(GiraphConstants.ZOOKEEPER_IS_EXTERNAL.getKey(), false);
    config.put(GiraphConstants.NETTY_SERVER_USE_EXECUTION_HANDLER.getKey(), false); // this prevents so many integration tests running out of threads
    config.put(GiraphConstants.NETTY_CLIENT_USE_EXECUTION_HANDLER.getKey(), false); // this prevents so many integration tests running out of threads
    config.put(GiraphConstants.NETTY_USE_DIRECT_MEMORY.getKey(), true);
    config.put(GiraphConstants.NUM_INPUT_THREADS.getKey(), 2);
    config.put(GiraphConstants.NUM_COMPUTE_THREADS.getKey(), 2);
    config.put(GiraphConstants.MAX_MASTER_SUPERSTEP_WAIT_MSECS.getKey(), TimeUnit.MINUTES.toMillis(60L));
    config.put(GiraphConstants.VERTEX_OUTPUT_FORMAT_THREAD_SAFE.getKey(), false);
    config.put(GiraphConstants.NUM_OUTPUT_THREADS.getKey(), 1);
    return config;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:GiraphHadoopGraphProvider.java

示例5: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
                                                final LoadGraphWith.GraphData loadGraphWith) {

    final Map<String, Object> config = super.getBaseConfiguration(graphName, test, testMethodName, loadGraphWith);
    config.put("skipTest", SKIP_TESTS.contains(testMethodName) || SKIP_TESTS.contains(test.getCanonicalName()));
    return config;
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:9,代码来源:TinkerGraphGryoTranslatorProvider.java

示例6: requiresListCardinalityAsDefault

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
/**
 * 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"));
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:10,代码来源:TinkerGraphProvider.java

示例7: selectIdMakerFromGraphData

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
/**
 * 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
        throw new IllegalStateException(String.format("Need to define a new %s for %s", TinkerGraph.IdManager.class.getName(), loadGraphWith.name()));
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:18,代码来源:TinkerGraphProvider.java

示例8: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData graphData) {
    Map<String, Object> config = null;
    switch (type) {
        case MOCK:
            config = new HashMap<String, Object>() {{
                put(Graph.GRAPH, HBaseGraph.class.getName());
                put(HBaseGraphConfiguration.Keys.INSTANCE_TYPE, HBaseGraphConfiguration.InstanceType.MOCK.toString());
                put(HBaseGraphConfiguration.Keys.GRAPH_NAMESPACE, graphName);
                put(HBaseGraphConfiguration.Keys.CREATE_TABLES, true);
            }};
            break;
        case BIGTABLE:
            config = new HashMap<String, Object>() {{
                put(Graph.GRAPH, HBaseGraph.class.getName());
                put(HBaseGraphConfiguration.Keys.INSTANCE_TYPE, HBaseGraphConfiguration.InstanceType.BIGTABLE.toString());
                put(HBaseGraphConfiguration.Keys.GRAPH_NAMESPACE, graphName);
                put(HBaseGraphConfiguration.Keys.GRAPH_TABLE_PREFIX, graphName);
                put(HBaseGraphConfiguration.Keys.CREATE_TABLES, true);
                put("hbase.client.connection.impl", "com.google.cloud.bigtable.hbase1_2.BigtableConnection");
                put("google.bigtable.instance.id", "hgraphdb-bigtable");
                put("google.bigtable.project.id", "rayokota2");
            }};
            break;
        case DISTRIBUTED:
            config = new HashMap<String, Object>() {{
                put(Graph.GRAPH, HBaseGraph.class.getName());
                put(HBaseGraphConfiguration.Keys.INSTANCE_TYPE, HBaseGraphConfiguration.InstanceType.DISTRIBUTED.toString());
                put(HBaseGraphConfiguration.Keys.GRAPH_NAMESPACE, graphName);
                put(HBaseGraphConfiguration.Keys.CREATE_TABLES, true);
                put("hbase.zookeeper.quorum", "127.0.0.1");
                put("zookeeper.znode.parent", "/hbase-unsecure");
            }};
            break;
    }
    return config;
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:38,代码来源:HBaseGraphProvider.java

示例9: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
    System.clearProperty(KRYO_SHIM_SERVICE);
    this.graphSONInput = RANDOM.nextBoolean();
    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, HadoopGraph.class.getName());
        put(Constants.GREMLIN_HADOOP_GRAPH_READER, graphSONInput ? GraphSONInputFormat.class.getCanonicalName() : GryoInputFormat.class.getCanonicalName());
        put(Constants.GREMLIN_HADOOP_GRAPH_WRITER, GryoOutputFormat.class.getCanonicalName());
        put(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, getWorkingDirectory());
        put(Constants.GREMLIN_HADOOP_JARS_IN_DISTRIBUTED_CACHE, false);
    }};
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:13,代码来源:HadoopGraphProvider.java

示例10: loadGraphDataViaHadoopConfig

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
public void loadGraphDataViaHadoopConfig(final Graph g, final LoadGraphWith.GraphData graphData) {
    final String type = this.graphSONInput ? "json" : "kryo";

    if (graphData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
        ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("grateful-dead." + type));
    } else if (graphData.equals(LoadGraphWith.GraphData.MODERN)) {
        ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-modern." + type));
    } else if (graphData.equals(LoadGraphWith.GraphData.CLASSIC)) {
        ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-classic." + type));
    } else if (graphData.equals(LoadGraphWith.GraphData.CREW)) {
        ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-crew." + type));
    } else {
        throw new RuntimeException("Could not load graph with " + graphData);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:16,代码来源:HadoopGraphProvider.java

示例11: prepare

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
/**
 * Opens a new {@link TinkerGraph} instance and optionally preloads it with one of the test data sets enumerated
 * in {@link LoadGraphWith}.
 *
 * @throws IOException on failure to load graph
 */
@Setup
public void prepare() throws IOException {
    graph = TinkerGraph.open();
    g = graph.traversal();

    final LoadGraphWith[] loadGraphWiths = this.getClass().getAnnotationsByType(LoadGraphWith.class);
    final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
    final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();

    String graphFile;
    if(loadGraphWithData != null) {
        if (loadGraphWithData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
            graphFile = "grateful-dead.kryo";
        } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.MODERN)) {
            graphFile = "tinkerpop-modern.kryo";
        } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.CLASSIC)) {
            graphFile = "tinkerpop-classic.kryo";
        } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.CREW)) {
            graphFile = "tinkerpop-crew.kryo";
        } else {
            throw new RuntimeException("Could not load graph with " + loadGraphWithData);
        }

        final GraphReader reader = GryoReader.build().create();
        try (final InputStream stream = AbstractGraphBenchmark.class.
                getResourceAsStream(PATH + graphFile)) {
            reader.readGraph(stream, graph);
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:37,代码来源:AbstractGraphBenchmark.java

示例12: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, Class<?> test, final String testMethodName,
                                                final LoadGraphWith.GraphData loadGraphWith) {
    final String serverGraphName = getServerGraphName(loadGraphWith);

    final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraphs().get(serverGraphName);
    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, RemoteGraph.class.getName());
        put(RemoteGraph.GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
        put(DriverRemoteConnection.GREMLIN_REMOTE_GRAPH_DRIVER_GRAPHNAME, serverGraphName);
        put("hidden.for.testing.only", graphGetter);
    }};
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:RemoteGraphProvider.java

示例13: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
    Spark.close();
    final Map<String, Object> config = super.getBaseConfiguration(graphName, test, testMethodName, loadGraphWith);
    // ensure the context doesn't stay open for the GryoSerializer tests to follow
    // this is primarily to ensure that the KryoShimService loaded specifically in these tests don't leak to the other tests
    config.put(Constants.GREMLIN_SPARK_PERSIST_CONTEXT, false);
    config.put("spark.serializer", KryoSerializer.class.getCanonicalName());
    config.put("spark.kryo.registrator", GryoRegistrator.class.getCanonicalName());
    System.setProperty(KRYO_SHIM_SERVICE, UnshadedKryoShimService.class.getCanonicalName());
    KryoShimServiceLoader.load(true);
    System.clearProperty(KRYO_SHIM_SERVICE);
    return config;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:SparkHadoopGraphGryoRegistratorProvider.java

示例14: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
    final Map<String, Object> config = super.getBaseConfiguration(graphName, test, testMethodName, loadGraphWith);
    config.put(Constants.GREMLIN_SPARK_PERSIST_CONTEXT, true);  // this makes the test suite go really fast

    // toy graph inputRDD does not have corresponding outputRDD so where jobs chain, it fails (failing makes sense)
    if (null != loadGraphWith &&
            !test.equals(ProgramTest.Traversals.class) &&
            !test.equals(GroovyProgramTest.Traversals.class) &&
            !test.equals(PageRankTest.Traversals.class) &&
            !test.equals(GroovyPageRankTest.Traversals.class) &&
            !test.equals(PeerPressureTest.Traversals.class) &&
            !test.equals(GroovyPeerPressureTest.Traversals.class) &&
            !test.equals(FileSystemStorageCheck.class) &&
            !testMethodName.equals("shouldSupportJobChaining") &&  // GraphComputerTest.shouldSupportJobChaining
            RANDOM.nextBoolean()) {
        config.put(RANDOM.nextBoolean() ? Constants.GREMLIN_SPARK_GRAPH_INPUT_RDD : Constants.GREMLIN_HADOOP_GRAPH_READER, ToyGraphInputRDD.class.getCanonicalName());
    }

    // tests persisted RDDs
    if (test.equals(SparkContextStorageCheck.class)) {
        config.put(RANDOM.nextBoolean() ? Constants.GREMLIN_SPARK_GRAPH_INPUT_RDD : Constants.GREMLIN_HADOOP_GRAPH_READER, ToyGraphInputRDD.class.getCanonicalName());
        config.put(RANDOM.nextBoolean() ? Constants.GREMLIN_SPARK_GRAPH_OUTPUT_RDD : Constants.GREMLIN_HADOOP_GRAPH_WRITER, PersistedOutputRDD.class.getCanonicalName());
    }

    // sugar plugin causes meta-method issues with a persisted context
    if (test.equals(HadoopGremlinPluginCheck.class)) {
        Spark.close();
        SugarTestHelper.clearRegistry(this);
    }

    config.put(Constants.GREMLIN_HADOOP_DEFAULT_GRAPH_COMPUTER, SparkGraphComputer.class.getCanonicalName());
    config.put("spark.master", "local[4]");
    config.put("spark.serializer", GryoSerializer.class.getCanonicalName());
    config.put("spark.kryo.registrationRequired", true);
    return config;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:38,代码来源:SparkHadoopGraphProvider.java

示例15: getBaseConfiguration

import org.apache.tinkerpop.gremlin.LoadGraphWith; //导入方法依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData graphData) {
    final String directory = makeTestDirectory(graphName, test, testMethodName);

    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, Neo4jGraph.class.getName());
        put(Neo4jGraph.CONFIG_DIRECTORY, directory);
        put(Neo4jGraph.CONFIG_META_PROPERTIES, true);
        put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, true);
    }};
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:MultiMetaNeo4jGraphProvider.java


注:本文中的org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。