use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project gaffer-doc by gchq.
the class IsEqualExample method isEqualToString5.
public void isEqualToString5() {
// ---------------------------------------------------------
final IsEqual function = new IsEqual("5");
// ---------------------------------------------------------
runExample(function, null, 5, 5L, "5", '5');
}
use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project gaffer-doc by gchq.
the class IsEqualExample method isEqualLong5.
public void isEqualLong5() {
// ---------------------------------------------------------
final IsEqual function = new IsEqual(5L);
// ---------------------------------------------------------
runExample(function, null, 5, 5L, "5", '5');
}
use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project gaffer-doc by gchq.
the class OrExample method isLessThan2EqualTo5OrIsMoreThan10.
public void isLessThan2EqualTo5OrIsMoreThan10() {
// ---------------------------------------------------------
final Or function = new Or<>(new IsLessThan(2), new IsEqual(5), new IsMoreThan(10));
// ---------------------------------------------------------
runExample(function, "When using an Or predicate with a single selected value you can just use the constructor new Or(predicates))'", 1, 2, 3, 5, 15, 1L, 3L, 5L);
}
use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project Gaffer by gchq.
the class ViewValidatorTest method shouldValidateAndReturnFalseForNotFilterWithIncompatibleProperties.
@Test
public void shouldValidateAndReturnFalseForNotFilterWithIncompatibleProperties() {
// Given
final ViewValidator validator = new ViewValidator();
final View view = new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.PROP_1, TestPropertyNames.PROP_2).execute(new Not<>(new Or.Builder<>().select(0).execute(new IsMoreThan("abcd")).select(1).execute(new IsEqual("some other value")).build())).build()).build()).build();
final Schema schema = new Schema.Builder().type("int", Integer.class).type("string", String.class).entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().property(TestPropertyNames.PROP_1, "int").property(TestPropertyNames.PROP_2, "string").build()).build();
// When
final ValidationResult result = validator.validate(view, schema, ALL_STORE_TRAITS);
// Then
assertFalse(result.isValid());
}
use of uk.gov.gchq.koryphe.impl.predicate.IsEqual in project Gaffer by gchq.
the class ViewValidatorTest method shouldValidateAndReturnFalseForAndFilterWithIncompatibleProperties.
@Test
public void shouldValidateAndReturnFalseForAndFilterWithIncompatibleProperties() {
// Given
final ViewValidator validator = new ViewValidator();
final View view = new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.PROP_1, TestPropertyNames.PROP_2).execute(new And.Builder().select(0).execute(new IsMoreThan(2)).select(1).execute(new IsEqual("some other value")).build()).build()).build()).build();
final Schema schema = new Schema.Builder().type("obj", Object.class).type("string", String.class).entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().property(TestPropertyNames.PROP_1, "obj").property(TestPropertyNames.PROP_2, "string").build()).build();
// When
final ValidationResult result = validator.validate(view, schema, ALL_STORE_TRAITS);
// Then
assertFalse(result.isValid());
}
Aggregations