use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class GraphConfigurationControllerTest method shouldReturnGraphId.
@Test
public void shouldReturnGraphId() {
// Given
when(graphFactory.getGraph()).thenReturn(new Graph.Builder().config(new GraphConfig("id")).addSchema(new Schema()).storeProperties(new MapStoreProperties()).description("test graph").build());
// When
GraphConfigurationController controller = new GraphConfigurationController(graphFactory);
final String graphId = controller.getGraphId();
// Then
assertEquals("id", graphId);
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class GraphConfigurationControllerIT method shouldReturn500WhenANonExistentClassIsProvidedForGetFilterFunctions.
@Test
public void shouldReturn500WhenANonExistentClassIsProvidedForGetFilterFunctions() {
// Given
Graph emptyGraph = new Graph.Builder().config(new GraphConfig.Builder().graphId("id").build()).storeProperties(new MapStoreProperties()).addSchema(new Schema()).build();
when(graphFactory.getGraph()).thenReturn(emptyGraph);
// When
ResponseEntity<Error> response = get("/graph/config/filterFunctions/a.random.thing", Error.class);
// Then
checkResponse(response, 500);
assertThat(response.getBody().getSimpleMessage()).isEqualTo("Could not find input class: a.random.thing");
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class GraphConfigurationControllerIT method shouldReturn200WhenReturningGraphId.
@Test
public void shouldReturn200WhenReturningGraphId() {
// Given
Graph emptyGraph = new Graph.Builder().config(new GraphConfig.Builder().graphId("id").description("test description").build()).storeProperties(new MapStoreProperties()).addSchema(new Schema()).build();
when(graphFactory.getGraph()).thenReturn(emptyGraph);
// When
ResponseEntity<String> response = get("/graph/config/graphId", String.class);
// Then
checkResponse(response, 200);
assertThat(response.getBody()).isEqualTo("id");
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class AddElementsHandlerTest method shouldAddWithNoGroupByProperties.
@Test
public void shouldAddWithNoGroupByProperties() throws OperationException, StoreException {
// Given
final AddElements addElements = mock(AddElements.class);
given(addElements.getInput()).willReturn((Iterable) Arrays.asList(new Edge("group1")));
final Context context = mock(Context.class);
final MapStore store = new SingleUseMapStore();
store.initialise("graphId1", new Schema(), new MapStoreProperties());
final AddElementsHandler handler = new AddElementsHandler();
// When / Then - should not throw NPE
handler.doOperation(addElements, context, store);
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class ElementClonerTest method testElementCloner.
@Test
public void testElementCloner() throws StoreException {
// Given
final ElementCloner cloner = new ElementCloner();
final MapStore mapStore = new MapStore();
mapStore.initialise("graphId", GetAllElementsHandlerTest.getSchema(), new MapStoreProperties());
// Then
Streams.toStream(GetAllElementsHandlerTest.getElements()).map(element -> new Pair<>(element, cloner.cloneElement(element, mapStore.getSchema()))).forEach(pair -> assertEquals(pair.getFirst(), pair.getSecond()));
}
Aggregations