use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class GraphConfigurationControllerIT method shouldReturn200WhenReturningSchema.
@Test
public void shouldReturn200WhenReturningSchema() {
// 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<Schema> response = get("/graph/config/schema", Schema.class);
// Then
checkResponse(response, 200);
assertThat(response.getBody()).isEqualTo(new Schema());
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class GraphConfigurationControllerIT method shouldReturn200WithListOfAllTransformFunctions.
@Test
public void shouldReturn200WithListOfAllTransformFunctions() {
// 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<Set> response = get("/graph/config/transformFunctions", Set.class);
// Then
checkResponse(response, 200);
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class OperationControllerIT method shouldPropagateStatusInformationContainedInOperationExceptionsThrownByOperationHandlers.
@Test
public void shouldPropagateStatusInformationContainedInOperationExceptionsThrownByOperationHandlers() throws IOException {
// Given
final StoreProperties storeProperties = new MapStoreProperties();
storeProperties.set(StoreProperties.JOB_TRACKER_ENABLED, Boolean.FALSE.toString());
final Graph graph = new Graph.Builder().config(StreamUtil.graphConfig(this.getClass())).storeProperties(storeProperties).addSchema(new Schema()).build();
when(getGraphFactory().getGraph()).thenReturn(graph);
// When
final ResponseEntity<Error> response = post("/graph/operations/execute", new GetAllJobDetails(), Error.class);
// Then
assertEquals(SERVICE_UNAVAILABLE.getStatusCode(), response.getStatusCode().value());
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class OperationControllerIT method shouldCorrectlyStreamExecuteChunked.
@Test
public void shouldCorrectlyStreamExecuteChunked() throws Exception {
// Given
final Schema schema = new Schema.Builder().entity("g1", new SchemaEntityDefinition.Builder().vertex("string").build()).type("string", new TypeDefinition.Builder().clazz(String.class).aggregateFunction(new StringConcat()).build()).build();
Graph graph = new Graph.Builder().config(new GraphConfig("id")).storeProperties(new MapStoreProperties()).addSchema(schema).build();
when(getGraphFactory().getGraph()).thenReturn(graph);
Entity ent1 = new Entity.Builder().group("g1").vertex("v1").build();
Entity ent2 = new Entity.Builder().group("g1").vertex("v2").build();
final ObjectMapper mapper = createDefaultMapper();
graph.execute(new AddElements.Builder().input(ent1).build(), new Context());
graph.execute(new AddElements.Builder().input(ent2).build(), new Context());
// When
final ResponseEntity<String> response = post("/graph/operations/execute/chunked", new GetAllElements.Builder().build(), String.class);
// Then
String expected = mapper.writeValueAsString(ent1) + "\r\n" + mapper.writeValueAsString(ent2) + "\r\n";
assertEquals(expected, response.getBody());
}
use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.
the class StatusControllerIT method shouldReturn200WhenGraphFactoryCreatesGraph.
@Test
public void shouldReturn200WhenGraphFactoryCreatesGraph() {
// 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<SystemStatus> response = get("/graph/status", SystemStatus.class);
// Then
checkResponse(response, 200);
assertThat(response.getBody()).isEqualTo(SystemStatus.UP);
}
Aggregations