use of org.openforis.idm.model.Code in project collect by openforis.
the class ModelPathExpressionTest method testParentFunction.
@Test
public void testParentFunction() throws InvalidExpressionException {
String entityName = "plot";
Entity plot = EntityBuilder.addEntity(cluster, entityName);
EntityBuilder.addValue(cluster, "id", new Code("123_456"));
String expr = "parent()/id";
List<Node<?>> list = iterateExpression(expr, plot);
Assert.assertEquals(1, list.size());
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class RegExFunctionsTest method testAttributeValue.
@Test
public void testAttributeValue() throws InvalidExpressionException {
EntityBuilder.addValue(cluster, "id", new Code("10_114"));
assertTrue((Boolean) evaluateExpression(cluster, REGEX_PREFIX + ":test(id, '[0-9]+_[0-9]+')"));
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class RelevanceExpressionTest method testNotEqStringValue.
@Test
public void testNotEqStringValue() throws InvalidExpressionException {
EntityBuilder.addValue(energySource, "type", new Code("other"));
assertFalse(evaluateExpression("type != 'other'", energySource));
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class RelevanceExpressionTest method testBooleanValue2.
@Test
public void testBooleanValue2() {
Entity plot = EntityBuilder.addEntity(cluster, "plot");
EntityBuilder.addValue(plot, "accessibility", new Code("0"));
EntityBuilder.addValue(plot, "permanent", true);
EntityBuilder.addEntity(plot, "soil");
assertTrue(plot.isRelevant("soil"));
}
use of org.openforis.idm.model.Code in project collect by openforis.
the class RelevanceExpressionTest method testBooleanValue4.
@Test
@Ignore
public void testBooleanValue4() {
Entity plot = EntityBuilder.addEntity(cluster, "plot");
EntityBuilder.addValue(plot, "accessibility", new Code("0"));
EntityBuilder.addValue(plot, "permanent", false);
EntityBuilder.addEntity(plot, "soil");
assertFalse(plot.isRelevant("soil"));
}
Aggregations