use of uk.gov.gchq.gaffer.store.StoreTrait 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.store.StoreTrait 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.store.StoreTrait 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.store.StoreTrait in project Gaffer by gchq.
the class ProxyStore method fetchTraits.
protected Set<StoreTrait> fetchTraits() throws StoreException {
final URL url = getProperties().getGafferUrl("graph/config/storeTraits");
final ResponseDeserialiser<Set<StoreTrait>> responseDeserialiser = getResponseDeserialiserFor(new TypeReferenceStoreImpl.StoreTraits());
Set<StoreTrait> newTraits = doGet(url, responseDeserialiser, null);
if (null == newTraits) {
newTraits = new HashSet<>(0);
} else {
// This proxy store cannot handle visibility due to the simple rest api using a default user.
newTraits.remove(StoreTrait.VISIBILITY);
}
return newTraits;
}
use of uk.gov.gchq.gaffer.store.StoreTrait in project Gaffer by gchq.
the class MapStoreTest method testTraits.
@Test
public void testTraits() throws StoreException {
final MapStore mapStore = new MapStore();
mapStore.initialise("graphId", new Schema(), new MapStoreProperties());
final Set<StoreTrait> expectedTraits = new HashSet<>(Arrays.asList(StoreTrait.VISIBILITY, StoreTrait.QUERY_AGGREGATION, StoreTrait.INGEST_AGGREGATION, StoreTrait.PRE_AGGREGATION_FILTERING, StoreTrait.POST_AGGREGATION_FILTERING, StoreTrait.TRANSFORMATION, StoreTrait.POST_TRANSFORMATION_FILTERING, StoreTrait.MATCHED_VERTEX));
assertEquals(expectedTraits, mapStore.getTraits());
}
Aggregations