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());
}
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());
}
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);
}
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());
}
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));
}
Aggregations