use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testIndependentNonExistingCoreFunction.
@Test
public void testIndependentNonExistingCoreFunction() {
Survey survey = survey(attributeDef("region"));
assertInvalidExpression(survey, "root/region", "wrong()");
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testMissingSpatialReferenceSystemForLatLongFunction.
@Test
public void testMissingSpatialReferenceSystemForLatLongFunction() {
Survey survey = survey(attributeDef("location"));
assertInvalidExpression(survey, "root/location", "idm:latlong($this)");
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testInvalidExpression.
// @Test
// @Ignore
// public void testCircularDependencies() {
// Schema schema = survey.getSchema();
// EntityDefinition clusterDefn = schema.getRootEntityDefinition("cluster");
// NodeDefinition regionDefn = clusterDefn.getChildDefinition("region");
//
// assertTrue(validator.validateCircularReferenceAbsence(clusterDefn, regionDefn, "region").isError());
// assertTrue(validator.validateCircularReferenceAbsence(clusterDefn, regionDefn, "region_district").isError());
// assertTrue(validator.validateCircularReferenceAbsence(clusterDefn, regionDefn, "district").isOk());
// }
@Test
public void testInvalidExpression() {
Survey survey = survey(attributeDef("region"));
assertInvalidExpression(survey, "root/region", "1++1/^fhdj)(_");
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testValidAttributeInSampingPointDataFunction.
@Test
public void testValidAttributeInSampingPointDataFunction() {
Survey survey = survey(attributeDef("location"));
samplingPointDataAttribute(survey, "valid_attribute");
assertValidExpression(survey, "root/location", "idm:samplingPointData('valid_attribute', '1')");
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testContextVariable.
@Test
public void testContextVariable() {
Survey survey = survey(entityDef("plot", attributeDef("accessible"), entityDef("tree", attributeDef("status"), attributeDef("species")).multiple()), entityDef("enumerated", attributeDef("status"), attributeDef("count")).multiple());
assertValidExpression(survey, "root/enumerated/count", "count(parent()/plot/tree[status=$this/parent()/status])");
assertValidExpression(survey, "root/enumerated/count", "count(parent()/plot/tree[status=$context/status])");
}
Aggregations