Search in sources :

Example 6 with HashMapGraphLibrary

use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.

the class GraphConfigTest method getTestObject.

@Override
protected GraphConfig getTestObject() {
    final String graphId = "graphId";
    final GraphLibrary library = new HashMapGraphLibrary();
    final View view = new View.Builder().globalElements(new GlobalViewElementDefinition.Builder().groupBy().build()).build();
    final GraphHook hook1 = new AddOperationsToChain();
    final GraphHook hook2 = new OperationChainLimiter();
    return new GraphConfig.Builder().graphId(graphId).library(library).description("testGraphConfig").addHook(hook1).addHook(hook2).view(view).build();
}
Also used : HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) GraphLibrary(uk.gov.gchq.gaffer.store.library.GraphLibrary) GraphHook(uk.gov.gchq.gaffer.graph.hook.GraphHook) AddOperationsToChain(uk.gov.gchq.gaffer.graph.hook.AddOperationsToChain) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) OperationChainLimiter(uk.gov.gchq.gaffer.graph.hook.OperationChainLimiter)

Example 7 with HashMapGraphLibrary

use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.

the class AddSchemaToLibraryHandlerTest method shouldAddSchemaWithGraphLibrary.

@Test
public void shouldAddSchemaWithGraphLibrary() throws Exception {
    // given
    HashMapGraphLibrary library = new HashMapGraphLibrary();
    store.setGraphLibrary(library);
    store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
    // when
    store.execute(new Builder().schema(schema).id(TEST_SCHEMA_ID).build(), new Context(StoreUser.blankUser()));
    // then
    Schema actualSchema = library.getSchema(TEST_SCHEMA_ID);
    assertEquals(schema, actualSchema);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 8 with HashMapGraphLibrary

use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.

the class AddStorePropertiesToLibraryHandlerTest method shouldAddSchemaWithGraphLibrary.

@Test
public void shouldAddSchemaWithGraphLibrary() throws Exception {
    HashMapGraphLibrary library = new HashMapGraphLibrary();
    store.setGraphLibrary(library);
    store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
    store.execute(new Builder().storeProperties(props).id(TEST_PROPS_ID).build(), new Context(StoreUser.blankUser()));
    StoreProperties actualProps = library.getProperties(TEST_PROPS_ID);
    assertEquals(props.getProperties(), actualProps.getProperties());
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.store.operation.add.AddStorePropertiesToLibrary.Builder) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 9 with HashMapGraphLibrary

use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.

the class FederatedStoreWrongGraphIDsTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    CacheServiceLoader.shutdown();
    fedProps = new FederatedStoreProperties();
    fedProps.setCacheProperties(CACHE_SERVICE_CLASS_STRING);
    store = new FederatedStore();
    library = new HashMapGraphLibrary();
    HashMapGraphLibrary.clear();
    library.addProperties(PROP_1, PROPERTIES);
    library.addSchema(SCHEMA_1, new Schema.Builder().entity(E1_GROUP, new SchemaEntityDefinition.Builder().vertex("string").build()).type("string", String.class).build());
    store.setGraphLibrary(library);
    blankContext = new Context(StoreUser.blankUser());
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with HashMapGraphLibrary

use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.

the class FederatedStorePublicAccessTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    CacheServiceLoader.shutdown();
    fedProps = new FederatedStoreProperties();
    fedProps.setCacheProperties(CACHE_SERVICE_CLASS_STRING);
    store = new FederatedStore();
    library = new HashMapGraphLibrary();
    HashMapGraphLibrary.clear();
    library.addProperties(PROP_1, PROPERTIES);
    library.addSchema(SCHEMA_1, new Schema.Builder().build());
    store.setGraphLibrary(library);
}
Also used : HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

HashMapGraphLibrary (uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary)17 Test (org.junit.jupiter.api.Test)11 Schema (uk.gov.gchq.gaffer.store.schema.Schema)11 StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)8 Context (uk.gov.gchq.gaffer.store.Context)6 BeforeEach (org.junit.jupiter.api.BeforeEach)4 Graph (uk.gov.gchq.gaffer.graph.Graph)3 GraphLibrary (uk.gov.gchq.gaffer.store.library.GraphLibrary)3 AddGraph (uk.gov.gchq.gaffer.federatedstore.operation.AddGraph)2 AddSchemaToLibrary (uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary)2 HashMapCacheService (uk.gov.gchq.gaffer.cache.impl.HashMapCacheService)1 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)1 Element (uk.gov.gchq.gaffer.data.element.Element)1 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)1 RoadAndRoadUseWithTimesAndCardinalitiesElementGenerator (uk.gov.gchq.gaffer.doc.user.generator.RoadAndRoadUseWithTimesAndCardinalitiesElementGenerator)1 FederatedStoreProperties (uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties)1 AddGraphWithHooks (uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks)1 GetAllGraphIds (uk.gov.gchq.gaffer.federatedstore.operation.GetAllGraphIds)1 RemoveGraph (uk.gov.gchq.gaffer.federatedstore.operation.RemoveGraph)1 AddOperationsToChain (uk.gov.gchq.gaffer.graph.hook.AddOperationsToChain)1