Search in sources :

Example 1 with OperationHandler

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);
}
Also used : OperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OperationHandler)

Example 2 with OperationHandler

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);
}
Also used : SplitStore(uk.gov.gchq.gaffer.operation.impl.SplitStore) AddElementsFromHdfs(uk.gov.gchq.gaffer.hdfs.operation.AddElementsFromHdfs) ImportAccumuloKeyValueFiles(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles) GetElementsBetweenSets(uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets) GenerateElements(uk.gov.gchq.gaffer.operation.impl.generate.GenerateElements) SampleDataForSplitPointsHandler(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.SampleDataForSplitPointsHandler) GetElementsInRanges(uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsInRanges) GetElementsBetweenSetsHandler(uk.gov.gchq.gaffer.accumulostore.operation.handler.GetElementsBetweenSetsHandler) GenerateObjectsHandler(uk.gov.gchq.gaffer.store.operation.handler.generate.GenerateObjectsHandler) GenerateObjects(uk.gov.gchq.gaffer.operation.impl.generate.GenerateObjects) SplitStoreHandler(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.SplitStoreHandler) Validate(uk.gov.gchq.gaffer.operation.impl.Validate) ImportAccumuloKeyValueFilesHandler(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.ImportAccumuloKeyValueFilesHandler) GetElementsWithinSetHandler(uk.gov.gchq.gaffer.accumulostore.operation.handler.GetElementsWithinSetHandler) GetElementsWithinSet(uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet) GenerateElementsHandler(uk.gov.gchq.gaffer.store.operation.handler.generate.GenerateElementsHandler) AddElementsFromHdfsHandler(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.AddElementsFromHdfsHandler) GetElementsInRangesHandler(uk.gov.gchq.gaffer.accumulostore.operation.handler.GetElementsInRangesHandler) SampleDataForSplitPoints(uk.gov.gchq.gaffer.hdfs.operation.SampleDataForSplitPoints) OperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OperationHandler)

Example 3 with OperationHandler

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);
}
Also used : OperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OperationHandler)

Example 4 with OperationHandler

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();
    }
}
Also used : Schema(uk.gov.gchq.gaffer.store.schema.Schema) GetSchema(uk.gov.gchq.gaffer.store.operation.GetSchema) NamedOperation(uk.gov.gchq.gaffer.named.operation.NamedOperation) DeleteNamedOperation(uk.gov.gchq.gaffer.named.operation.DeleteNamedOperation) Operation(uk.gov.gchq.gaffer.operation.Operation) AddNamedOperation(uk.gov.gchq.gaffer.named.operation.AddNamedOperation) SchemaException(uk.gov.gchq.gaffer.data.elementdefinition.exception.SchemaException) SerialisationException(uk.gov.gchq.gaffer.exception.SerialisationException) Assertions.assertThatIllegalArgumentException(org.assertj.core.api.Assertions.assertThatIllegalArgumentException) OperationException(uk.gov.gchq.gaffer.operation.OperationException) OutputOperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OutputOperationHandler) OperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OperationHandler) Test(org.junit.jupiter.api.Test)

Example 5 with OperationHandler

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");
}
Also used : OperationDeclarations(uk.gov.gchq.gaffer.store.operation.declaration.OperationDeclarations) OperationDeclaration(uk.gov.gchq.gaffer.store.operation.declaration.OperationDeclaration) OperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OperationHandler) Test(org.junit.jupiter.api.Test)

Aggregations

OperationHandler (uk.gov.gchq.gaffer.store.operation.handler.OperationHandler)6 Test (org.junit.jupiter.api.Test)3 Assertions.assertThatIllegalArgumentException (org.assertj.core.api.Assertions.assertThatIllegalArgumentException)1 GetElementsBetweenSetsHandler (uk.gov.gchq.gaffer.accumulostore.operation.handler.GetElementsBetweenSetsHandler)1 GetElementsInRangesHandler (uk.gov.gchq.gaffer.accumulostore.operation.handler.GetElementsInRangesHandler)1 GetElementsWithinSetHandler (uk.gov.gchq.gaffer.accumulostore.operation.handler.GetElementsWithinSetHandler)1 AddElementsFromHdfsHandler (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.AddElementsFromHdfsHandler)1 ImportAccumuloKeyValueFilesHandler (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.ImportAccumuloKeyValueFilesHandler)1 SampleDataForSplitPointsHandler (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.SampleDataForSplitPointsHandler)1 SplitStoreHandler (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.SplitStoreHandler)1 ImportAccumuloKeyValueFiles (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.operation.ImportAccumuloKeyValueFiles)1 GetElementsBetweenSets (uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets)1 GetElementsInRanges (uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsInRanges)1 GetElementsWithinSet (uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet)1 SchemaException (uk.gov.gchq.gaffer.data.elementdefinition.exception.SchemaException)1 SerialisationException (uk.gov.gchq.gaffer.exception.SerialisationException)1 AddElementsFromHdfs (uk.gov.gchq.gaffer.hdfs.operation.AddElementsFromHdfs)1 SampleDataForSplitPoints (uk.gov.gchq.gaffer.hdfs.operation.SampleDataForSplitPoints)1 AddNamedOperation (uk.gov.gchq.gaffer.named.operation.AddNamedOperation)1 DeleteNamedOperation (uk.gov.gchq.gaffer.named.operation.DeleteNamedOperation)1