Search in sources :

Example 6 with HugeGraphLoader

use of com.baidu.hugegraph.loader.HugeGraphLoader in project incubator-hugegraph-toolchain by apache.

the class HDFSLoadTest method testHDFSWithCoreSitePath.

@Test
public void testHDFSWithCoreSitePath() {
    ioUtil.write("vertex_person.csv", "name,age,city", "marko,29,Beijing", "vadas,27,Hongkong", "josh,32,Beijing", "peter,35,Shanghai", "\"li,nary\",26,\"Wu,han\"");
    String[] args = new String[] { "-f", structPath("hdfs_with_core_site_path/struct.json"), "-s", configPath("hdfs_with_core_site_path/schema.groovy"), "-g", GRAPH, "-h", SERVER, "--batch-insert-threads", "2", "--test-mode", "true" };
    HugeGraphLoader loader = new HugeGraphLoader(args);
    loader.load();
    List<Vertex> vertices = CLIENT.graph().listVertices();
    Assert.assertEquals(5, vertices.size());
}
Also used : HugeGraphLoader(com.baidu.hugegraph.loader.HugeGraphLoader) Vertex(com.baidu.hugegraph.structure.graph.Vertex) Test(org.junit.Test)

Example 7 with HugeGraphLoader

use of com.baidu.hugegraph.loader.HugeGraphLoader in project incubator-hugegraph-toolchain by apache.

the class HDFSLoadTest method testHDFSWithInvalidCoreSitePath.

@Test
public void testHDFSWithInvalidCoreSitePath() {
    ioUtil.write("vertex_person.csv", "name,age,city", "marko,29,Beijing", "vadas,27,Hongkong", "josh,32,Beijing", "peter,35,Shanghai", "\"li,nary\",26,\"Wu,han\"");
    String[] args = new String[] { "-f", structPath("hdfs_with_invalid_core_site_path/struct.json"), "-s", configPath("hdfs_with_invalid_core_site_path/schema.groovy"), "-g", GRAPH, "-h", SERVER, "--batch-insert-threads", "2", "--test-mode", "true" };
    Assert.assertThrows(LoadException.class, () -> {
        HugeGraphLoader loader = new HugeGraphLoader(args);
        loader.load();
    }, e -> {
        String message = "An exception occurred while checking HDFS path";
        Assert.assertTrue(e.getMessage().contains(message));
    });
}
Also used : HugeGraphLoader(com.baidu.hugegraph.loader.HugeGraphLoader) Test(org.junit.Test)

Aggregations

HugeGraphLoader (com.baidu.hugegraph.loader.HugeGraphLoader)7 Test (org.junit.Test)6 LoadContext (com.baidu.hugegraph.loader.executor.LoadContext)2 FileItemProgress (com.baidu.hugegraph.loader.progress.FileItemProgress)2 InputItemProgress (com.baidu.hugegraph.loader.progress.InputItemProgress)2 InputProgress (com.baidu.hugegraph.loader.progress.InputProgress)2 Vertex (com.baidu.hugegraph.structure.graph.Vertex)2 File (java.io.File)2 Edge (com.baidu.hugegraph.structure.graph.Edge)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Set (java.util.Set)1