Search in sources :

Example 26 with MapStoreProperties

use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.

the class JobControllerIT method setupGraph.

@Before
public void setupGraph() {
    StoreProperties properties = new MapStoreProperties();
    properties.setStoreClass(SingleUseMapStore.class);
    properties.setJobTrackerEnabled(true);
    properties.set(CACHE_SERVICE_CLASS, HashMapCacheService.class.getName());
    properties.set(OPERATION_DECLARATIONS, "ResultCacheExportOperations.json");
    Graph graph = new Graph.Builder().config(new GraphConfig("myGraph")).storeProperties(properties).addSchema(Schema.fromJson(StreamUtil.schema(JobControllerIT.class))).build();
    when(graphFactory.getGraph()).thenReturn(graph);
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) HashMapCacheService(uk.gov.gchq.gaffer.cache.impl.HashMapCacheService) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) Before(org.junit.Before)

Example 27 with MapStoreProperties

use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.

the class ProxyStoreIT method setUpGraph.

@Before
public void setUpGraph() {
    delegateRestApiGraph = new Graph.Builder().storeProperties(new MapStoreProperties()).config(new GraphConfig("myGraph")).addSchema(Schema.fromJson(StreamUtil.openStream(getClass(), "/schema/schema.json"))).build();
    when(graphFactory.getGraph()).thenReturn(delegateRestApiGraph);
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) Before(org.junit.Before)

Example 28 with MapStoreProperties

use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.

the class GraphConfigurationControllerIT method shouldReturn200WithAllStoreTraits.

@Test
public void shouldReturn200WithAllStoreTraits() {
    // 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/storeTraits", Set.class);
    // The response will come back as a Set of strings. We'll convert these to store traits
    Set<StoreTrait> responseTraits = new HashSet<>();
    response.getBody().forEach(trait -> responseTraits.add(StoreTrait.valueOf((String) trait)));
    // Then
    checkResponse(response, 200);
    assertThat(responseTraits).isEqualTo(MapStore.TRAITS);
}
Also used : Graph(uk.gov.gchq.gaffer.graph.Graph) Set(java.util.Set) HashSet(java.util.HashSet) StoreTrait(uk.gov.gchq.gaffer.store.StoreTrait) Schema(uk.gov.gchq.gaffer.store.schema.Schema) MapStoreProperties(uk.gov.gchq.gaffer.mapstore.MapStoreProperties) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 29 with MapStoreProperties

use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.

the class GraphConfigurationControllerIT method shouldReturn200WithListOfAllObjectGenerators.

@Test
public void shouldReturn200WithListOfAllObjectGenerators() {
    // 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/objectGenerators", 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 30 with MapStoreProperties

use of uk.gov.gchq.gaffer.mapstore.MapStoreProperties in project Gaffer by gchq.

the class GraphConfigurationControllerIT method shouldReturn500WhenANonExistentClassIsProvidedForGetSerialiseFields.

@Test
public void shouldReturn500WhenANonExistentClassIsProvidedForGetSerialiseFields() {
    // 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/serialisedFields/a.random.class", Error.class);
    // Then
    checkResponse(response, 500);
    assertThat(response.getBody().getSimpleMessage()).isEqualTo("Class name was not recognised: a.random.class");
}
Also used : 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) 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