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);
}
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();
}
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();
}
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();
}
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();
}
Aggregations