use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.
the class FilterExpressionCheckEvaluationVisitor method visitAndExpression.
@Override
public Boolean visitAndExpression(AndFilterExpression expression) {
FilterExpression left = expression.getLeft();
FilterExpression right = expression.getRight();
return left.accept(this) && right.accept(this);
}
use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.
the class PermissionToFilterExpressionVisitorTest method testSingleFilterExpression.
@ParameterizedTest
@MethodSource("identityProvider")
public void testSingleFilterExpression(String permission, FilterExpression expected) {
FilterExpression computed = filterExpressionForPermissions(permission);
assertEquals(expected, computed, String.format("%s != %s", permission, expected.toString()));
}
use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.
the class PermissionToFilterExpressionVisitorTest method testSimpleExpression.
@ParameterizedTest
@MethodSource("simpleAndProvider")
public void testSimpleExpression(String left, String op, String right, FilterExpression expected) {
String permission = String.format("%s %s %s", left, op, right);
FilterExpression computed = filterExpressionForPermissions(permission);
assertEquals(expected, computed, String.format("%s != %s", permission, expected));
boolean specialCase = isSpecialCase(computed);
boolean isFilterable = containsOnlyFilterableExpressions(computed);
assertTrue(specialCase || isFilterable, String.format("compound expression contains unfilterable clause '%s'", computed));
}
use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.
the class PermissionToFilterExpressionVisitorTest method testNotFilterExpression.
@ParameterizedTest
@MethodSource("notExpressionProvider")
public void testNotFilterExpression(String permission, FilterExpression expected) {
String expression = String.format("NOT %s", permission);
FilterExpression computed = filterExpressionForPermissions(expression);
assertEquals(expected, computed);
}
use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.
the class PermissionToFilterExpressionVisitorTest method testNestedExpressions.
@ParameterizedTest
@MethodSource("nestedExpressionProvider")
public void testNestedExpressions(String left, String join, String compound, FilterExpression expected) {
String permission = String.format("%s %s (%s)", left, join, compound);
FilterExpression computed = filterExpressionForPermissions(permission);
assertEquals(expected, computed, String.format("%s != %s", permission, computed));
boolean specialCase = isSpecialCase(computed);
boolean isFilterable = containsOnlyFilterableExpressions(computed);
assertTrue(specialCase || isFilterable, String.format("compound expression contains unfilterable clause '%s'", computed));
}
Aggregations