use of uk.gov.gchq.koryphe.impl.predicate.CollectionContains in project gaffer-doc by gchq.
the class CollectionContainsExample method collectionContains.
public void collectionContains() {
// ---------------------------------------------------------
final CollectionContains function = new CollectionContains(1);
// ---------------------------------------------------------
runExample(function, null, createSet(1, 2, 3), createSet(1), createSet(2), createSet());
}
use of uk.gov.gchq.koryphe.impl.predicate.CollectionContains in project Gaffer by gchq.
the class NamedViewDetailTest method shouldTestAccessUsingCustomAccessPredicatesWhenConfigured.
@Test
public void shouldTestAccessUsingCustomAccessPredicatesWhenConfigured() {
// Given
final User testUser = new User.Builder().userId("testUserId").build();
final User differentUser = new User.Builder().userId("differentUserId").opAuth("different").build();
final String adminAuth = "adminAuth";
final AccessPredicate readAccessPredicate = new AccessPredicate(new AdaptedPredicate(new CallMethod("getUserId"), new IsEqual("testUserId")));
final AccessPredicate writeAccessPredicate = new AccessPredicate(new AdaptedPredicate(new CallMethod("getOpAuths"), new CollectionContains("different")));
// When
final NamedViewDetail namedViewDetail = createNamedViewDetailBuilder().readAccessPredicate(readAccessPredicate).writeAccessPredicate(writeAccessPredicate).build();
// Then
assertTrue(namedViewDetail.hasReadAccess(testUser, adminAuth));
assertFalse(namedViewDetail.hasReadAccess(differentUser, adminAuth));
assertFalse(namedViewDetail.hasWriteAccess(testUser, adminAuth));
assertTrue(namedViewDetail.hasWriteAccess(differentUser, adminAuth));
}
use of uk.gov.gchq.koryphe.impl.predicate.CollectionContains in project Gaffer by gchq.
the class GetWalksIT method shouldFilterAllWalksWhenNoneContainProperty.
@Test
public void shouldFilterAllWalksWhenNoneContainProperty() throws Exception {
final Iterable<Walk> walks = getWalksThatPassPredicateTest(new CollectionContains(6));
assertThat(getPaths(walks)).isEmpty();
}
use of uk.gov.gchq.koryphe.impl.predicate.CollectionContains in project Gaffer by gchq.
the class GetWalksIT method shouldNotFilterAnyWalksWhenAllContainProperty.
@Test
public void shouldNotFilterAnyWalksWhenAllContainProperty() throws Exception {
final Iterable<Walk> walks = getWalksThatPassPredicateTest(new CollectionContains(1));
assertThat(getPaths(walks)).isEqualTo("AED,ABC");
}
use of uk.gov.gchq.koryphe.impl.predicate.CollectionContains in project Gaffer by gchq.
the class GetWalksIT method shouldFilterWalksThatDoNotContainProperty5.
@Test
public void shouldFilterWalksThatDoNotContainProperty5() throws Exception {
final Iterable<Walk> walks = getWalksThatPassPredicateTest(new CollectionContains(5));
assertThat(getPaths(walks)).isEqualTo("AED");
}
Aggregations