use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project Gaffer by gchq.
the class GetAllElementsIT method shouldGetAllTransformedFilteredElements.
@Test
@TraitRequirement({ StoreTrait.TRANSFORMATION, StoreTrait.PRE_AGGREGATION_FILTERING })
public void shouldGetAllTransformedFilteredElements() throws Exception {
final GetAllElements op = new GetAllElements.Builder().view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(IdentifierType.VERTEX.name()).execute(new IsEqual("A1")).build()).transientProperty(TestPropertyNames.TRANSIENT_1, String.class).transformer(new ElementTransformer.Builder().select(IdentifierType.VERTEX.name(), TestPropertyNames.SET).execute(new Concat()).project(TestPropertyNames.TRANSIENT_1).build()).build()).build()).build();
// When
final CloseableIterable<? extends Element> results = graph.execute(op, getUser());
// Then
final List<Element> resultList = Lists.newArrayList(results);
assertThat(resultList).hasSize(1);
assertThat(resultList.get(0).getProperties()).containsEntry(TestPropertyNames.TRANSIENT_1, "A1,[3]");
}
use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project Gaffer by gchq.
the class FederatedAddGraphWithHooksHandlerTest method shouldAddGraphWithCustomReadAccessPredicate.
@Test
public void shouldAddGraphWithCustomReadAccessPredicate() throws Exception {
store.initialise(FEDERATEDSTORE_GRAPH_ID, null, federatedStoreProperties);
final Schema expectedSchema = new Schema.Builder().build();
assertEquals(0, store.getGraphs(testUser, null, ignore).size());
final AccessPredicate allowBlankUserAndTestUserReadAccess = new AccessPredicate(new AdaptedPredicate(new CallMethod("getUserId"), new Or<>(new IsEqual(testUser.getUserId()), new IsEqual(blankUser.getUserId()))));
new FederatedAddGraphWithHooksHandler().doOperation(new AddGraphWithHooks.Builder().graphId(EXPECTED_GRAPH_ID).schema(expectedSchema).storeProperties(PROPERTIES).readAccessPredicate(allowBlankUserAndTestUserReadAccess).build(), new Context(testUser), store);
assertEquals(1, store.getGraphs(blankUser, null, ignore).size());
assertEquals(1, store.getGraphs(testUser, null, ignore).size());
}
Aggregations