Search in sources :

Example 16 with GraphConfig

use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.

the class FederatedGraphStorageTraitsTest method shouldGetCurrentTraitsForAddingUserButSelectedGraphsOnly.

@Test
public void shouldGetCurrentTraitsForAddingUserButSelectedGraphsOnly() throws Exception {
    // given
    final GraphSerialisable acc2 = new GraphSerialisable.Builder().graph(acc.getGraph()).config(new GraphConfig(GRAPH_ID_ACCUMULO + 2)).build();
    graphStorage.put(acc, ACCESS_UNUSED_AUTH_AND_USER);
    graphStorage.put(acc2, ACCESS_UNUSED_AUTH_WITH_TEST_USER);
    graphStorage.put(map, ACCESS_UNUSED_AUTH_WITH_TEST_USER);
    getTraits.addOption(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, GRAPH_ID_MAP);
    // when
    final Set<StoreTrait> traits = graphStorage.getTraits(getTraits, testUserContext);
    // then
    assertNotEquals(ACCUMULO_TRAITS, traits, "Returning AccumuloStore traits instead of MapStore");
    assertEquals(Collections.emptySet(), traits.stream().filter(ACCUMULO_TRAITS_EXCLUSIVE_OF_MAP::contains).collect(Collectors.toSet()), "Revealing some hidden traits from the AccumuloStore instead of only MapStore");
    assertEquals(MAP_CURRENT_TRAITS, traits);
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) StoreTrait(uk.gov.gchq.gaffer.store.StoreTrait) Test(org.junit.jupiter.api.Test)

Example 17 with GraphConfig

use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.

the class FederatedGraphStorageTraitsTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    graphStorage = new FederatedGraphStorage();
    acc = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_ACCUMULO)).properties(ACCUMULO_PROPERTIES).schema(new Schema.Builder().entity("entities", new SchemaEntityDefinition.Builder().vertex("string").build()).type("string", String.class).build()).build();
    map = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_MAP)).properties(MAP_PROPERTIES).schema(new Schema.Builder().edge("edges", new SchemaEdgeDefinition.Builder().source("string").destination("string").build()).type("string", String.class).build()).build();
    nullUser = nullUser();
    testUser = testUser();
    authUser = authUser();
    blankUser = blankUser();
    testUserContext = new Context(testUser);
    authUserContext = new Context(authUser);
    blankUserContext = new Context(blankUser);
    blockingAccessPredicate = new NoAccessPredicate();
    permissiveAccessPredicate = new UnrestrictedAccessPredicate();
    getTraits = new GetTraits();
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Context(uk.gov.gchq.gaffer.store.Context) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) GetTraits(uk.gov.gchq.gaffer.store.operation.GetTraits) UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 18 with GraphConfig

use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.

the class FederatedStoreGetTraitsTest method setUp.

@Before
public void setUp() throws Exception {
    federatedStore = new FederatedStore();
    federatedStore.initialise("testFed", new Schema(), new FederatedStoreProperties());
    acc = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_ACCUMULO)).properties(ACCUMULO_PROPERTIES).schema(new Schema.Builder().entity("entities", new SchemaEntityDefinition.Builder().vertex("string").build()).type("string", String.class).build()).build();
    map = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_MAP)).properties(MAP_PROPERTIES).schema(new Schema.Builder().edge("edges", new SchemaEdgeDefinition.Builder().source("string").destination("string").build()).type("string", String.class).build()).build();
    nullUser = nullUser();
    testUser = testUser();
    authUser = authUser();
    blankUser = blankUser();
    testUserContext = new Context(testUser);
    authUserContext = new Context(authUser);
    blankUserContext = new Context(blankUser);
    blockingAccessPredicate = new NoAccessPredicate();
    permissiveAccessPredicate = new UnrestrictedAccessPredicate();
    getTraits = new GetTraits();
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) Schema(uk.gov.gchq.gaffer.store.schema.Schema) UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) GetTraits(uk.gov.gchq.gaffer.store.operation.GetTraits) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) Before(org.junit.Before)

Example 19 with GraphConfig

use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.

the class FederatedStoreCacheTest method setUp.

@BeforeAll
public static void setUp() {
    properties.setProperty(CacheProperties.CACHE_SERVICE_CLASS, CACHE_SERVICE_CLASS_STRING);
    CacheServiceLoader.initialise(properties);
    federatedStoreCache = new FederatedStoreCache();
    testGraph = new Graph.Builder().config(new GraphConfig(MAP_ID_1)).addStoreProperties(PROPERTIES).addSchema(StreamUtil.openStream(FederatedStoreTest.class, PATH_BASIC_EDGE_SCHEMA_JSON)).build();
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 20 with GraphConfig

use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.

the class AddGenericHandlerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    store = mock(FederatedStore.class);
    graph = new Graph.Builder().addStoreProperties(PROPERTIES).config(new GraphConfig("TestGraph")).addSchema(new Schema()).build();
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) Schema(uk.gov.gchq.gaffer.store.schema.Schema) FederatedStore(uk.gov.gchq.gaffer.federatedstore.FederatedStore) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)37 Graph (uk.gov.gchq.gaffer.graph.Graph)19 Schema (uk.gov.gchq.gaffer.store.schema.Schema)19 GraphSerialisable (uk.gov.gchq.gaffer.graph.GraphSerialisable)18 Test (org.junit.jupiter.api.Test)15 Context (uk.gov.gchq.gaffer.store.Context)8 MapStoreProperties (uk.gov.gchq.gaffer.mapstore.MapStoreProperties)7 BeforeEach (org.junit.jupiter.api.BeforeEach)6 StoreTrait (uk.gov.gchq.gaffer.store.StoreTrait)6 Test (org.junit.Test)5 AddGraph (uk.gov.gchq.gaffer.federatedstore.operation.AddGraph)5 FederatedGetTraitsHandlerTest (uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedGetTraitsHandlerTest)5 NoAccessPredicate (uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate)4 FederatedStore (uk.gov.gchq.gaffer.federatedstore.FederatedStore)4 FederatedStoreProperties (uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties)4 RemoveGraph (uk.gov.gchq.gaffer.federatedstore.operation.RemoveGraph)4 ProxyProperties (uk.gov.gchq.gaffer.proxystore.ProxyProperties)4 StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)4 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)4 ArrayList (java.util.ArrayList)3