Search in sources :

Example 1 with HBaseRetriever

use of uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever in project Gaffer by gchq.

the class GetElementsHandlerTest method shouldReturnHBaseRetrieverWithIncludeMatchedVertexWhenSeedMatchingIsNull.

@Test
public void shouldReturnHBaseRetrieverWithIncludeMatchedVertexWhenSeedMatchingIsNull() throws OperationException, StoreException {
    // Given
    final Iterable<EntityId> ids = mock(Iterable.class);
    final Context context = mock(Context.class);
    final User user = mock(User.class);
    final HBaseStore store = mock(HBaseStore.class);
    final HBaseRetriever<GetElements> hbaseRetriever = mock(HBaseRetriever.class);
    final GetElementsHandler handler = new GetElementsHandler();
    final GetElements getElements = new GetElements.Builder().inputIds(ids).seedMatching(null).build();
    given(context.getUser()).willReturn(user);
    given(store.createRetriever(getElements, user, ids, true)).willReturn(hbaseRetriever);
    // When
    final HBaseRetriever<GetElements> result = (HBaseRetriever<GetElements>) handler.doOperation(getElements, context, store);
    // Then
    assertSame(hbaseRetriever, result);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) Context(uk.gov.gchq.gaffer.store.Context) User(uk.gov.gchq.gaffer.user.User) HBaseStore(uk.gov.gchq.gaffer.hbasestore.HBaseStore) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) HBaseRetriever(uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever) Test(org.junit.jupiter.api.Test)

Example 2 with HBaseRetriever

use of uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever in project Gaffer by gchq.

the class GetElementsHandlerTest method shouldReturnHBaseRetrieverWithoutIncludeMatchdxVertex.

@Test
public void shouldReturnHBaseRetrieverWithoutIncludeMatchdxVertex() throws OperationException, StoreException {
    // Given
    final Iterable<EntityId> ids = mock(Iterable.class);
    final Context context = mock(Context.class);
    final User user = mock(User.class);
    final HBaseStore store = mock(HBaseStore.class);
    final HBaseRetriever<GetElements> hbaseRetriever = mock(HBaseRetriever.class);
    final GetElementsHandler handler = new GetElementsHandler();
    final GetElements getElements = new GetElements.Builder().inputIds(ids).seedMatching(SeedMatching.SeedMatchingType.EQUAL).build();
    given(context.getUser()).willReturn(user);
    given(store.createRetriever(getElements, user, ids, false)).willReturn(hbaseRetriever);
    // When
    final HBaseRetriever<GetElements> result = (HBaseRetriever<GetElements>) handler.doOperation(getElements, context, store);
    // Then
    assertSame(hbaseRetriever, result);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) Context(uk.gov.gchq.gaffer.store.Context) User(uk.gov.gchq.gaffer.user.User) HBaseStore(uk.gov.gchq.gaffer.hbasestore.HBaseStore) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) HBaseRetriever(uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever) Test(org.junit.jupiter.api.Test)

Example 3 with HBaseRetriever

use of uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever in project Gaffer by gchq.

the class GetElementsHandlerTest method shouldReturnHBaseRetrieverWithIncludeMatchedVertex.

@Test
public void shouldReturnHBaseRetrieverWithIncludeMatchedVertex() throws OperationException, StoreException {
    // Given
    final Iterable<EntityId> ids = mock(Iterable.class);
    final Context context = mock(Context.class);
    final User user = mock(User.class);
    final HBaseStore store = mock(HBaseStore.class);
    final HBaseRetriever<GetElements> hbaseRetriever = mock(HBaseRetriever.class);
    final GetElementsHandler handler = new GetElementsHandler();
    final GetElements getElements = new GetElements.Builder().inputIds(ids).seedMatching(SeedMatching.SeedMatchingType.RELATED).build();
    given(context.getUser()).willReturn(user);
    given(store.createRetriever(getElements, user, ids, true)).willReturn(hbaseRetriever);
    // When
    final HBaseRetriever<GetElements> result = (HBaseRetriever<GetElements>) handler.doOperation(getElements, context, store);
    // Then
    assertSame(hbaseRetriever, result);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) Context(uk.gov.gchq.gaffer.store.Context) User(uk.gov.gchq.gaffer.user.User) HBaseStore(uk.gov.gchq.gaffer.hbasestore.HBaseStore) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) HBaseRetriever(uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever) Test(org.junit.jupiter.api.Test)

Example 4 with HBaseRetriever

use of uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever in project Gaffer by gchq.

the class GetAllElementsHandlerTest method shouldReturnHBaseRetriever.

@Test
public void shouldReturnHBaseRetriever() throws OperationException, StoreException {
    // Given
    final Context context = mock(Context.class);
    final User user = mock(User.class);
    final HBaseStore store = mock(HBaseStore.class);
    final HBaseRetriever<GetAllElements> hbaseRetriever = mock(HBaseRetriever.class);
    final GetAllElementsHandler handler = new GetAllElementsHandler();
    final GetAllElements getElements = new GetAllElements();
    given(context.getUser()).willReturn(user);
    given(store.createRetriever(getElements, user, null, false, ElementDedupeFilterProcessor.class)).willReturn(hbaseRetriever);
    // When
    final HBaseRetriever<GetAllElements> result = (HBaseRetriever<GetAllElements>) handler.doOperation(getElements, context, store);
    // Then
    assertSame(hbaseRetriever, result);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) User(uk.gov.gchq.gaffer.user.User) HBaseStore(uk.gov.gchq.gaffer.hbasestore.HBaseStore) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) HBaseRetriever(uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)4 HBaseStore (uk.gov.gchq.gaffer.hbasestore.HBaseStore)4 HBaseRetriever (uk.gov.gchq.gaffer.hbasestore.retriever.HBaseRetriever)4 Context (uk.gov.gchq.gaffer.store.Context)4 User (uk.gov.gchq.gaffer.user.User)4 EntityId (uk.gov.gchq.gaffer.data.element.id.EntityId)3 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)3 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)1