Search in sources :

Example 31 with RealAttribute

use of org.openforis.idm.model.RealAttribute in project collect by openforis.

the class ComparisonCheckTest method testRealFailGt.

@Test
public void testRealFailGt() {
    RealAttribute plotDir = EntityBuilder.addValue(cluster, "plot_direction", 552.345d);
    ValidationResults results = validate(plotDir);
    assertTrue(containsComparisonCheck(results.getErrors()));
}
Also used : RealAttribute(org.openforis.idm.model.RealAttribute) Test(org.junit.Test)

Example 32 with RealAttribute

use of org.openforis.idm.model.RealAttribute in project collect by openforis.

the class ComparisonCheckTest method testLteWithNormalizedValuesFailOnLt.

@Test
public void testLteWithNormalizedValuesFailOnLt() {
    RealAttribute plotDistance = EntityBuilder.addValue(cluster, "plot_distance", 25000d);
    Unit unit = survey.getUnit("m");
    plotDistance.setUnit(unit);
    ValidationResults results = validate(plotDistance);
    assertTrue(containsComparisonCheck(results.getErrors()));
}
Also used : RealAttribute(org.openforis.idm.model.RealAttribute) Unit(org.openforis.idm.metamodel.Unit) Test(org.junit.Test)

Example 33 with RealAttribute

use of org.openforis.idm.model.RealAttribute in project collect by openforis.

the class ComparisonCheckTest method testRealFailLt.

@Test
public void testRealFailLt() {
    RealAttribute plotDir = EntityBuilder.addValue(cluster, "plot_direction", -52.345d);
    ValidationResults results = validate(plotDir);
    assertTrue(containsComparisonCheck(results.getErrors()));
}
Also used : RealAttribute(org.openforis.idm.model.RealAttribute) Test(org.junit.Test)

Example 34 with RealAttribute

use of org.openforis.idm.model.RealAttribute in project collect by openforis.

the class CustomCheckTest method testPassLtEqWithCondition1.

@Test
public void testPassLtEqWithCondition1() {
    Entity plot = EntityBuilder.addEntity(cluster, "plot");
    Entity tree = EntityBuilder.addEntity(plot, "tree");
    EntityBuilder.addValue(tree, "health", new Code("1"));
    RealAttribute totalHeight = EntityBuilder.addValue(tree, "total_height", 16.0);
    EntityBuilder.addValue(tree, "dbh", 16.0);
    ValidationResults results = validate(totalHeight);
    assertFalse(containsCustomCheck(results.getWarnings()));
}
Also used : Entity(org.openforis.idm.model.Entity) RealAttribute(org.openforis.idm.model.RealAttribute) Code(org.openforis.idm.model.Code) Test(org.junit.Test)

Example 35 with RealAttribute

use of org.openforis.idm.model.RealAttribute in project collect by openforis.

the class CustomCheckTest method testPassLtEqWithCondition.

@Test
public void testPassLtEqWithCondition() {
    Entity plot = EntityBuilder.addEntity(cluster, "plot");
    Entity tree = EntityBuilder.addEntity(plot, "tree");
    RealAttribute totalHeight = EntityBuilder.addValue(tree, "total_height", 2.0);
    EntityBuilder.addValue(tree, "dbh", 16.5);
    EntityBuilder.addValue(tree, "health", new Code("2"));
    ValidationResults results = validate(totalHeight);
    assertFalse(containsCustomCheck(results.getWarnings()));
}
Also used : Entity(org.openforis.idm.model.Entity) RealAttribute(org.openforis.idm.model.RealAttribute) Code(org.openforis.idm.model.Code) Test(org.junit.Test)

Aggregations

RealAttribute (org.openforis.idm.model.RealAttribute)39 Test (org.junit.Test)33 Entity (org.openforis.idm.model.Entity)25 AbstractTest (org.openforis.idm.AbstractTest)14 CollectRecord (org.openforis.collect.model.CollectRecord)9 Code (org.openforis.idm.model.Code)9 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)8 CollectIntegrationTest (org.openforis.collect.CollectIntegrationTest)6 Node (org.openforis.idm.model.Node)6 RealValue (org.openforis.idm.model.RealValue)6 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)5 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)5 Coordinate (org.openforis.idm.model.Coordinate)4 Date (org.openforis.idm.model.Date)4 Time (org.openforis.idm.model.Time)4 Unit (org.openforis.idm.metamodel.Unit)2 IntegerAttribute (org.openforis.idm.model.IntegerAttribute)2 TextAttribute (org.openforis.idm.model.TextAttribute)2 GregorianCalendar (java.util.GregorianCalendar)1 Ignore (org.junit.Ignore)1