Search in sources :

Example 36 with FederatedStore

use of uk.gov.gchq.gaffer.federatedstore.FederatedStore in project Gaffer by gchq.

the class FederatedValidateHandlerTest method shouldDelegateToHandler.

@Test
public void shouldDelegateToHandler() throws OperationException {
    // Given
    final FederatedStore store = mock(FederatedStore.class);
    final ValidateHandler handler = mock(ValidateHandler.class);
    final Validate op = mock(Validate.class);
    final Context context = mock(Context.class);
    final Iterable expectedResult = mock(Iterable.class);
    final Schema schema = mock(Schema.class);
    given(store.getSchema(op, context)).willReturn(schema);
    given(handler.doOperation(op, schema)).willReturn(expectedResult);
    final FederatedValidateHandler federatedHandler = new FederatedValidateHandler(handler);
    // When
    final Object result = federatedHandler.doOperation(op, context, store);
    // Then
    assertSame(expectedResult, result);
    verify(handler).doOperation(op, schema);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) Validate(uk.gov.gchq.gaffer.operation.impl.Validate) Schema(uk.gov.gchq.gaffer.store.schema.Schema) FederatedValidateHandler(uk.gov.gchq.gaffer.federatedstore.operation.handler.FederatedValidateHandler) ValidateHandler(uk.gov.gchq.gaffer.store.operation.handler.ValidateHandler) FederatedValidateHandler(uk.gov.gchq.gaffer.federatedstore.operation.handler.FederatedValidateHandler) FederatedStore(uk.gov.gchq.gaffer.federatedstore.FederatedStore) Test(org.junit.jupiter.api.Test)

Example 37 with FederatedStore

use of uk.gov.gchq.gaffer.federatedstore.FederatedStore in project Gaffer by gchq.

the class FederatedGetTraitsHandlerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    federatedStore = new FederatedStore();
    properties = new FederatedStoreProperties();
    HashMapGraphLibrary.clear();
    CacheServiceLoader.shutdown();
    storeProperties = new StoreProperties();
    storeProperties.setStoreClass(TestStoreImpl.class);
}
Also used : FederatedStoreProperties(uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties) FederatedStoreProperties(uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) FederatedStore(uk.gov.gchq.gaffer.federatedstore.FederatedStore) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 38 with FederatedStore

use of uk.gov.gchq.gaffer.federatedstore.FederatedStore in project Gaffer by gchq.

the class FederatedOperationChainValidatorTest method shouldGetFederatedSchema.

@Test
public void shouldGetFederatedSchema() {
    // Given
    final ViewValidator viewValidator = mock(FederatedViewValidator.class);
    final FederatedOperationChainValidator validator = new FederatedOperationChainValidator(viewValidator);
    final FederatedStore store = mock(FederatedStore.class);
    final User user = mock(User.class);
    final Operation op = mock(Operation.class);
    final Schema schema = mock(Schema.class);
    given(store.getSchema(op, user)).willReturn(schema);
    // When
    final Schema actualSchema = validator.getSchema(op, user, store);
    // Then
    assertSame(schema, actualSchema);
}
Also used : User(uk.gov.gchq.gaffer.user.User) FederatedViewValidator(uk.gov.gchq.gaffer.federatedstore.schema.FederatedViewValidator) ViewValidator(uk.gov.gchq.gaffer.store.schema.ViewValidator) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Operation(uk.gov.gchq.gaffer.operation.Operation) FederatedStore(uk.gov.gchq.gaffer.federatedstore.FederatedStore) Test(org.junit.jupiter.api.Test)

Aggregations

FederatedStore (uk.gov.gchq.gaffer.federatedstore.FederatedStore)38 Test (org.junit.jupiter.api.Test)25 Context (uk.gov.gchq.gaffer.store.Context)25 Schema (uk.gov.gchq.gaffer.store.schema.Schema)19 Graph (uk.gov.gchq.gaffer.graph.Graph)16 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)12 OperationException (uk.gov.gchq.gaffer.operation.OperationException)12 StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)11 Store (uk.gov.gchq.gaffer.store.Store)10 FederatedOperationChain (uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperationChain)8 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)7 FederatedStoreProperties (uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties)7 PredefinedFederatedStore (uk.gov.gchq.gaffer.federatedstore.PredefinedFederatedStore)7 Operation (uk.gov.gchq.gaffer.operation.Operation)7 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)6 User (uk.gov.gchq.gaffer.user.User)6 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Element (uk.gov.gchq.gaffer.data.element.Element)4 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)4 GraphSerialisable (uk.gov.gchq.gaffer.graph.GraphSerialisable)4