use of uk.gov.gchq.gaffer.store.operation.handler.OperationHandler in project Gaffer by gchq.
the class AccumuloStoreTest method testRequestForNullHandlerManaged.
public void testRequestForNullHandlerManaged(final AccumuloStore store) {
final OperationHandler returnedHandler = store.getOperationHandler(null);
assertNull(returnedHandler);
}
use of uk.gov.gchq.gaffer.store.operation.handler.OperationHandler in project Gaffer by gchq.
the class AccumuloStoreTest method testStoreReturnsHandlersForRegisteredOperations.
public void testStoreReturnsHandlersForRegisteredOperations(final AccumuloStore store) {
OperationHandler op;
// Then
assertNotNull(store.getOperationHandler(Validate.class));
op = store.getOperationHandler(AddElementsFromHdfs.class);
assertTrue(op instanceof AddElementsFromHdfsHandler);
op = store.getOperationHandler(GetElementsBetweenSets.class);
assertTrue(op instanceof GetElementsBetweenSetsHandler);
op = store.getOperationHandler(GetElementsInRanges.class);
assertTrue(op instanceof GetElementsInRangesHandler);
op = store.getOperationHandler(GetElementsWithinSet.class);
assertTrue(op instanceof GetElementsWithinSetHandler);
op = store.getOperationHandler(SplitStore.class);
assertTrue(op instanceof SplitStoreHandler);
op = store.getOperationHandler(SampleDataForSplitPoints.class);
assertTrue(op instanceof SampleDataForSplitPointsHandler);
op = store.getOperationHandler(ImportAccumuloKeyValueFiles.class);
assertTrue(op instanceof ImportAccumuloKeyValueFilesHandler);
op = store.getOperationHandler(GenerateElements.class);
assertTrue(op instanceof GenerateElementsHandler);
op = store.getOperationHandler(GenerateObjects.class);
assertTrue(op instanceof GenerateObjectsHandler);
}
use of uk.gov.gchq.gaffer.store.operation.handler.OperationHandler in project Gaffer by gchq.
the class AccumuloStoreTest method testRequestForNullHandlerManaged.
public void testRequestForNullHandlerManaged(MockAccumuloStore store) {
final OperationHandler returnedHandler = store.getOperationHandlerExposed(null);
assertNull(returnedHandler);
}
use of uk.gov.gchq.gaffer.store.operation.handler.OperationHandler in project Gaffer by gchq.
the class StoreTest method shouldCloseOperationIfExceptionThrown.
@Test
public void shouldCloseOperationIfExceptionThrown() throws Exception {
// Given
final Schema schema = createSchemaMock();
final StoreProperties properties = mock(StoreProperties.class);
given(properties.getJobExecutorThreadCount()).willReturn(1);
final Operation operation = mock(Operation.class);
final StoreImpl store = new StoreImpl();
final OperationHandler opHandler = mock(OperationHandler.class);
store.addOperationHandler(Operation.class, opHandler);
store.initialise("graphId", schema, properties);
given(opHandler.doOperation(operation, context, store)).willThrow(new RuntimeException());
// When / Then
try {
store.handleOperation(operation, context);
} catch (final Exception e) {
verify(operation).close();
}
}
use of uk.gov.gchq.gaffer.store.operation.handler.OperationHandler in project Gaffer by gchq.
the class ExportToOtherAuthorisedGraphHandlerTest method shouldGetHandlerFromJson.
@Test
public void shouldGetHandlerFromJson() throws OperationException {
// Given
OperationDeclarations opDeclarations = OperationDeclarations.fromPaths("src/test/resources/ExportToOtherAuthorisedGraphOperationDeclarations.json");
OperationDeclaration opDeclaration = opDeclarations.getOperations().get(0);
OperationHandler handler = opDeclaration.getHandler();
// When / Then
assertThat(handler.getClass().getName()).contains("AuthorisedGraph");
}
Aggregations