Search in sources :

Example 1 with TextJobInitialiser

use of uk.gov.gchq.gaffer.hdfs.operation.handler.job.initialiser.TextJobInitialiser in project Gaffer by gchq.

the class AddElementsFromHdfsIT method addElementsFromHdfs.

private void addElementsFromHdfs(Class<? extends AccumuloKeyPackage> keyPackageClass) throws Exception {
    // Given
    createInputFile();
    final Graph graph = createGraph(keyPackageClass);
    // When
    graph.execute(new AddElementsFromHdfs.Builder().inputPaths(Collections.singletonList(inputDir)).outputPath(outputDir).failurePath(failureDir).mapperGenerator(TextMapperGeneratorImpl.class).jobInitialiser(new TextJobInitialiser()).option(AccumuloStoreConstants.OPERATION_HDFS_USE_PROVIDED_SPLITS_FILE, "false").option(AccumuloStoreConstants.OPERATION_HDFS_SPLITS_FILE_PATH, splitsFile).build(), new User());
    // Then
    final CloseableIterable<Element> elements = graph.execute(new GetAllElements<>(), new User());
    final List<Element> elementList = Lists.newArrayList(elements);
    assertEquals(NUM_ENTITIES, elementList.size());
    for (int i = 0; i < NUM_ENTITIES; i++) {
        assertEquals(TestGroups.ENTITY, elementList.get(i).getGroup());
        assertEquals(VERTEX_ID_PREFIX + i, ((Entity) elementList.get(i)).getVertex());
    }
}
Also used : AddElementsFromHdfs(uk.gov.gchq.gaffer.hdfs.operation.AddElementsFromHdfs) Graph(uk.gov.gchq.gaffer.graph.Graph) User(uk.gov.gchq.gaffer.user.User) Element(uk.gov.gchq.gaffer.data.element.Element) TextJobInitialiser(uk.gov.gchq.gaffer.hdfs.operation.handler.job.initialiser.TextJobInitialiser)

Aggregations

Element (uk.gov.gchq.gaffer.data.element.Element)1 Graph (uk.gov.gchq.gaffer.graph.Graph)1 AddElementsFromHdfs (uk.gov.gchq.gaffer.hdfs.operation.AddElementsFromHdfs)1 TextJobInitialiser (uk.gov.gchq.gaffer.hdfs.operation.handler.job.initialiser.TextJobInitialiser)1 User (uk.gov.gchq.gaffer.user.User)1