Search in sources :

Example 6 with MapStoreProperties

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());
}
Also used : Graph(uk.gov.gchq.gaffer.graph.Graph) Schema(uk.gov.gchq.gaffer.store.schema.Schema) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) Test(org.junit.Test)

Example 7 with MapStoreProperties

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);
}
Also used : Graph(uk.gov.gchq.gaffer.graph.Graph) Set(java.util.Set) HashSet(java.util.HashSet) Schema(uk.gov.gchq.gaffer.store.schema.Schema) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) Test(org.junit.Test)

Example 8 with MapStoreProperties

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());
}
Also used : GetAllJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetAllJobDetails) Graph(uk.gov.gchq.gaffer.graph.Graph) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Error(uk.gov.gchq.gaffer.core.exception.Error) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) Test(org.junit.Test)

Example 9 with MapStoreProperties

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());
}
Also used : AddElements(uk.gov.gchq.gaffer.operation.impl.add.AddElements) Context(uk.gov.gchq.gaffer.store.Context) Entity(uk.gov.gchq.gaffer.data.element.Entity) HttpEntity(org.springframework.http.HttpEntity) ResponseEntity(org.springframework.http.ResponseEntity) StringConcat(uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat) Schema(uk.gov.gchq.gaffer.store.schema.Schema) SchemaEntityDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition) TypeDefinition(uk.gov.gchq.gaffer.store.schema.TypeDefinition) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 10 with MapStoreProperties

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);
}
Also used : SystemStatus(uk.gov.gchq.gaffer.rest.SystemStatus) Graph(uk.gov.gchq.gaffer.graph.Graph) Schema(uk.gov.gchq.gaffer.store.schema.Schema) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) Test(org.junit.Test)

Aggregations

MapStoreProperties (uk.gov.gchq.gaffer.mapstore.MapStoreProperties)42 Schema (uk.gov.gchq.gaffer.store.schema.Schema)34 Graph (uk.gov.gchq.gaffer.graph.Graph)28 Test (org.junit.Test)19 Test (org.junit.jupiter.api.Test)15 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)10 Set (java.util.Set)7 Error (uk.gov.gchq.gaffer.core.exception.Error)7 HashSet (java.util.HashSet)6 AddElements (uk.gov.gchq.gaffer.operation.impl.add.AddElements)5 LinkedHashMap (java.util.LinkedHashMap)4 Element (uk.gov.gchq.gaffer.data.element.Element)4 TypeDefinition (uk.gov.gchq.gaffer.store.schema.TypeDefinition)4 Map (java.util.Map)3 HashMapCacheService (uk.gov.gchq.gaffer.cache.impl.HashMapCacheService)3 Edge (uk.gov.gchq.gaffer.data.element.Edge)3 Entity (uk.gov.gchq.gaffer.data.element.Entity)3 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)3 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)3 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)3