Search in sources :

Example 1 with ImportAccumuloKeyValueFiles

use of uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles in project Gaffer by gchq.

the class ImportAccumuloKeyValueFilesTest method shouldJSONSerialiseAndDeserialise.

@Test
public void shouldJSONSerialiseAndDeserialise() throws SerialisationException {
    // Given
    final ImportAccumuloKeyValueFiles op = new ImportAccumuloKeyValueFiles();
    op.setInputPath(INPUT_DIRECTORY);
    op.setFailurePath(FAIL_DIRECTORY);
    // When
    byte[] json = JSONSerialiser.serialise(op, true);
    final ImportAccumuloKeyValueFiles deserialisedOp = JSONSerialiser.deserialise(json, ImportAccumuloKeyValueFiles.class);
    // Then
    assertEquals(INPUT_DIRECTORY, deserialisedOp.getInputPath());
    assertEquals(FAIL_DIRECTORY, deserialisedOp.getFailurePath());
}
Also used : ImportAccumuloKeyValueFiles(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles) Test(org.junit.jupiter.api.Test) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest)

Example 2 with ImportAccumuloKeyValueFiles

use of uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles in project Gaffer by gchq.

the class ImportAccumuloKeyValueFilesTest method shouldShallowCloneOperation.

@Test
@Override
public void shouldShallowCloneOperation() {
    // Given
    final ImportAccumuloKeyValueFiles importAccumuloKeyValueFiles = new ImportAccumuloKeyValueFiles.Builder().inputPath(INPUT_DIRECTORY).failurePath(FAIL_DIRECTORY).option("testOption", "true").build();
    // When
    final ImportAccumuloKeyValueFiles clone = importAccumuloKeyValueFiles.shallowClone();
    // Then
    assertNotSame(importAccumuloKeyValueFiles, clone);
    assertEquals("true", clone.getOption("testOption"));
    assertEquals(INPUT_DIRECTORY, clone.getInputPath());
    assertEquals(FAIL_DIRECTORY, clone.getFailurePath());
}
Also used : ImportAccumuloKeyValueFiles(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles) Test(org.junit.jupiter.api.Test) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest)

Example 3 with ImportAccumuloKeyValueFiles

use of uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles in project Gaffer by gchq.

the class AbstractImportKeyValuePairRDDToAccumuloHandler method doOperation.

public void doOperation(final T operation, final Context context, final AccumuloStore store) throws OperationException {
    final String outputPath = getOutputPath(operation);
    if (null == outputPath || outputPath.isEmpty()) {
        throw new OperationException("Option outputPath must be set for this option to be run against the accumulostore");
    }
    final String failurePath = getFailurePath(operation);
    if (null == failurePath || failurePath.isEmpty()) {
        throw new OperationException("Option failurePath must be set for this option to be run against the accumulostore");
    }
    prepareKeyValues(operation, new AccumuloKeyRangePartitioner(store));
    final ImportAccumuloKeyValueFiles importAccumuloKeyValueFiles = new ImportAccumuloKeyValueFiles.Builder().inputPath(outputPath).failurePath(failurePath).build();
    store._execute(new OperationChain<>(importAccumuloKeyValueFiles), context);
}
Also used : ImportAccumuloKeyValueFiles(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles) AccumuloKeyRangePartitioner(uk.gov.gchq.gaffer.sparkaccumulo.operation.utils.AccumuloKeyRangePartitioner) OperationException(uk.gov.gchq.gaffer.operation.OperationException)

Example 4 with ImportAccumuloKeyValueFiles

use of uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles in project Gaffer by gchq.

the class ImportAccumuloKeyValueFilesTest method shouldSerialiseAndDeserialiseOperation.

@Test
@Override
public void shouldSerialiseAndDeserialiseOperation() throws SerialisationException {
    // Given
    final ImportAccumuloKeyValueFiles op = new ImportAccumuloKeyValueFiles();
    op.setInputPath(INPUT_DIRECTORY);
    op.setFailurePath(FAIL_DIRECTORY);
    // When
    byte[] json = serialiser.serialise(op, true);
    final ImportAccumuloKeyValueFiles deserialisedOp = serialiser.deserialise(json, ImportAccumuloKeyValueFiles.class);
    // Then
    assertEquals(INPUT_DIRECTORY, deserialisedOp.getInputPath());
    assertEquals(FAIL_DIRECTORY, deserialisedOp.getFailurePath());
}
Also used : ImportAccumuloKeyValueFiles(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.Test)

Example 5 with ImportAccumuloKeyValueFiles

use of uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles in project Gaffer by gchq.

the class ImportAccumuloKeyValueFilesTest method builderShouldCreatePopulatedOperation.

@Test
@Override
public void builderShouldCreatePopulatedOperation() {
    // When
    final ImportAccumuloKeyValueFiles importAccumuloKeyValueFiles = new ImportAccumuloKeyValueFiles.Builder().inputPath(INPUT_DIRECTORY).failurePath(FAIL_DIRECTORY).option(TEST_OPTION_KEY, "true").build();
    // Then
    assertEquals(INPUT_DIRECTORY, importAccumuloKeyValueFiles.getInputPath());
    assertEquals(FAIL_DIRECTORY, importAccumuloKeyValueFiles.getFailurePath());
    assertEquals("true", importAccumuloKeyValueFiles.getOption(TEST_OPTION_KEY));
}
Also used : ImportAccumuloKeyValueFiles(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles) Test(org.junit.jupiter.api.Test) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest)

Aggregations

ImportAccumuloKeyValueFiles (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles)6 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)4 Test (org.junit.jupiter.api.Test)3 OperationException (uk.gov.gchq.gaffer.operation.OperationException)2 AccumuloKeyRangePartitioner (uk.gov.gchq.gaffer.sparkaccumulo.operation.utils.AccumuloKeyRangePartitioner)2 Test (org.junit.Test)1