use of org.openforis.idm.model.Code in project collect by openforis.
the class IDMFunctionsTest method testBlankWithBlankValue.
@Test
public void testBlankWithBlankValue() throws InvalidExpressionException {
EntityBuilder.addValue(cluster, "id", new Code(""));
assertTrue(evaluateBooleanExpression(cluster, null, "idm:blank(id)"));
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class IDMFunctionsTest method testCountDistinctFunction.
// start of distinct-count test
@Test
public void testCountDistinctFunction() throws InvalidExpressionException {
Entity plot1 = EntityBuilder.addEntity(cluster, "plot");
EntityBuilder.addValue(plot1, "no", new Code("1"));
Entity plot2 = EntityBuilder.addEntity(cluster, "plot");
EntityBuilder.addValue(plot2, "no", new Code("2"));
String expr = ExpressionFactory.IDM_PREFIX + ":" + "count-distinct(plot/no)";
Object result = evaluateExpression(expr);
Assert.assertEquals(2, result);
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class IDMFunctionsTest method testBlankValidCode.
@Test
public void testBlankValidCode() throws InvalidExpressionException {
EntityBuilder.addValue(cluster, "id", new Code("001"));
Assert.assertFalse(evaluateBooleanExpression(cluster, null, "idm:blank(id)"));
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class LookupFunctionTest method testSamplingPointLookupFunction.
@Test
public void testSamplingPointLookupFunction() throws InvalidExpressionException {
EntityBuilder.addValue(cluster, "id", new Code("205_128"));
String expr = "idm:samplingPointData('region', id)";
Object object = expressionEvaluator.evaluateValue(cluster, null, expr);
Assert.assertEquals(TEST_SAMPLING_POINT_DATA, object);
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class LookupFunctionTest method testLookupFunctionWithPath.
@Test
public void testLookupFunctionWithPath() throws InvalidExpressionException {
EntityBuilder.addValue(cluster, "id", new Code("205_128"));
String expr = "idm:lookup('sampling_design', 'location', 'cluster', id, 'plot', '0')";
Object object = expressionEvaluator.evaluateValue(cluster, null, expr);
Assert.assertEquals(TEST_COORDINATE, object);
}
Aggregations