Search in sources :

Example 1 with TestUnmodifiableOperationsImpl

use of uk.gov.gchq.gaffer.operation.TestUnmodifiableOperationsImpl in project Gaffer by gchq.

the class AddOperationsToChainTest method shouldFailQuietlyIfNestedOperationsCannotBeModified.

@Test
public void shouldFailQuietlyIfNestedOperationsCannotBeModified() throws SerialisationException {
    // Given
    AddOperationsToChain hook = fromJson(ADD_OPERATIONS_TO_CHAIN_RESOURCE_PATH);
    Operation discardOutput = new DiscardOutput();
    Operation splitStore = new SplitStoreFromFile();
    Operation validate = new Validate();
    Operation getAdjacentIds = new GetAdjacentIds();
    Operation count = new Count<>();
    Operation getElements = new GetElements();
    Operation getAllElements = new GetAllElements();
    TestUnmodifiableOperationsImpl nestedUnmodifiableOps = new TestUnmodifiableOperationsImpl(Arrays.asList(getAllElements, getElements));
    final OperationChain opChain = new OperationChain.Builder().first(getAdjacentIds).then(nestedUnmodifiableOps).build();
    // When
    hook.preExecute(opChain, new Context(new User()));
    // Then
    final OperationChain expectedOpChain = new OperationChain.Builder().first(discardOutput).then(splitStore).then(validate).then(getAdjacentIds).then(count).then(discardOutput).then(nestedUnmodifiableOps).then(count).build();
    JsonAssert.assertEquals(JSONSerialiser.serialise(expectedOpChain), JSONSerialiser.serialise(opChain));
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) GetAdjacentIds(uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds) User(uk.gov.gchq.gaffer.user.User) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) Operation(uk.gov.gchq.gaffer.operation.Operation) Count(uk.gov.gchq.gaffer.operation.impl.Count) SplitStoreFromFile(uk.gov.gchq.gaffer.operation.impl.SplitStoreFromFile) Validate(uk.gov.gchq.gaffer.operation.impl.Validate) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) DiscardOutput(uk.gov.gchq.gaffer.operation.impl.DiscardOutput) TestUnmodifiableOperationsImpl(uk.gov.gchq.gaffer.operation.TestUnmodifiableOperationsImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 Operation (uk.gov.gchq.gaffer.operation.Operation)1 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)1 TestUnmodifiableOperationsImpl (uk.gov.gchq.gaffer.operation.TestUnmodifiableOperationsImpl)1 Count (uk.gov.gchq.gaffer.operation.impl.Count)1 DiscardOutput (uk.gov.gchq.gaffer.operation.impl.DiscardOutput)1 SplitStoreFromFile (uk.gov.gchq.gaffer.operation.impl.SplitStoreFromFile)1 Validate (uk.gov.gchq.gaffer.operation.impl.Validate)1 GetAdjacentIds (uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds)1 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)1 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)1 Context (uk.gov.gchq.gaffer.store.Context)1 User (uk.gov.gchq.gaffer.user.User)1