use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class FederatedGraphStorageTraitsTest method shouldGetNonCurrentTraitsForAddingUserButSelectedGraphsOnly.
@Test
public void shouldGetNonCurrentTraitsForAddingUserButSelectedGraphsOnly() 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);
getTraits.setCurrentTraits(false);
// 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_TRAITS, traits);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class FederatedStoreGetTraitsTest method shouldGetNonCurrentTraitsForAddingUserButSelectedGraphsOnly.
@Test
public void shouldGetNonCurrentTraitsForAddingUserButSelectedGraphsOnly() throws Exception {
// given
final GraphSerialisable acc2 = new GraphSerialisable.Builder().graph(acc.getGraph()).config(new GraphConfig(GRAPH_ID_ACCUMULO + 2)).build();
federatedStore.addGraphs(ACCESS_UNUSED_AUTH_AND_USER, acc);
federatedStore.addGraphs(ACCESS_UNUSED_AUTH_WITH_TEST_USER, acc2);
federatedStore.addGraphs(ACCESS_UNUSED_AUTH_WITH_TEST_USER, map);
getTraits.addOption(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, GRAPH_ID_MAP);
getTraits.setCurrentTraits(false);
// when
final Set<StoreTrait> traits = federatedStore.execute(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_TRAITS, traits);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class FederatedStoreGetTraitsTest 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();
federatedStore.addGraphs(ACCESS_UNUSED_AUTH_AND_USER, acc);
federatedStore.addGraphs(ACCESS_UNUSED_AUTH_WITH_TEST_USER, acc2);
federatedStore.addGraphs(ACCESS_UNUSED_AUTH_WITH_TEST_USER, map);
getTraits.addOption(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, GRAPH_ID_MAP);
// when
final Set<StoreTrait> traits = federatedStore.execute(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 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);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class ProxyStoreIT method createProxy.
private Graph createProxy() {
ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setGafferHost("localhost");
proxyProperties.setGafferPort(getPort());
proxyProperties.setGafferContextRoot(getContextPath());
// When
return new Graph.Builder().config(new GraphConfig("proxy")).addSchema(new Schema()).storeProperties(proxyProperties).build();
}
Aggregations