use of org.openforis.idm.metamodel.EntityDefinition in project collect by openforis.
the class UIOptionsTest method testDetachedNodeAssignableTabs.
// @Test
public void testDetachedNodeAssignableTabs() throws InvalidPathException {
EntityDefinition clusterDefn = schema.getRootEntityDefinition("cluster");
EntityDefinition plotDefn = (EntityDefinition) clusterDefn.getChildDefinition("plot");
List<UITab> assignableTabs = uiOptions.getTabsAssignableToChildren(plotDefn);
assertEquals(6, assignableTabs.size());
UITab treeTab = assignableTabs.get(2);
assertEquals("tree", treeTab.getName());
}
use of org.openforis.idm.metamodel.EntityDefinition in project collect by openforis.
the class CalculatedAttributeDependencyGraphTest method testChainWithMultiplePaths.
@Test
public void testChainWithMultiplePaths() {
EntityDefinition rootEntityDef = rootEntity.getDefinition();
Attribute<?, ?> qty = attribute(rootEntity, "qty");
calculatedAttributeDefinition(rootEntityDef, "t1", "qty + 1");
calculatedAttributeDefinition(rootEntityDef, "t2", "t1 + qty");
Attribute<?, ?> t2 = calculatedAttribute(rootEntity, "t2", "qty + t1");
Attribute<?, ?> t1 = calculatedAttribute(rootEntity, "t1", "qty + 1");
assertDependents(qty, t1, t2);
}
use of org.openforis.idm.metamodel.EntityDefinition in project collect by openforis.
the class CalculatedAttributeDependencyGraphTest method testAggregateFunctionsInSameEntity.
@Test
public void testAggregateFunctionsInSameEntity() {
Entity plot = entity(rootEntity, "plot");
EntityDefinition treeDef = entityDefinition(plot.getDefinition(), "tree");
attributeDefinition(treeDef, "dbh");
Entity tree1 = entity(plot, "tree");
Attribute<?, ?> dbh1 = attribute(tree1, "dbh");
Attribute<?, ?> dbhsum1 = calculatedAttribute(tree1, "dbhsum", "sum(parent()/tree/dbh)");
Entity tree2 = entity(plot, "tree");
Attribute<?, ?> dbh2 = attribute(tree2, "dbh");
Attribute<?, ?> dbhsum2 = calculatedAttribute(tree2, "dbhsum", "sum(parent()/tree/dbh)");
assertCalculatedDependentsInAnyOrder(dbh1, dbhsum1, dbhsum2);
assertCalculatedDependentsInAnyOrder(dbh2, dbhsum1, dbhsum2);
}
use of org.openforis.idm.metamodel.EntityDefinition in project collect by openforis.
the class CalculatedAttributeDependencyGraphTest method testAddDetachedEntity.
@Test
public void testAddDetachedEntity() {
EntityDefinition plotDef = entityDefinition(rootEntity.getDefinition(), "plot");
Entity plot = (Entity) plotDef.createNode();
Attribute<?, ?> plotNo = attribute(plot, "plot_no");
Attribute<?, ?> total = calculatedAttribute(plot, "total", "plot_no + 1");
rootEntity.add(plot);
assertDependents(plotNo, total);
}
use of org.openforis.idm.metamodel.EntityDefinition in project collect by openforis.
the class CalculatedAttributeDependencyGraphTest method testAggregateFunctionWithFilter.
@Test
public void testAggregateFunctionWithFilter() {
Entity plot = entity(rootEntity, "plot");
EntityDefinition treeDef = entityDefinition(plot.getDefinition(), "tree");
attributeDefinition(treeDef, "dbh");
Entity tree1 = entity(plot, "tree");
Attribute<?, ?> dbh1 = attribute(tree1, "dbh");
Entity tree2 = entity(plot, "tree");
Attribute<?, ?> dbh2 = attribute(tree2, "dbh");
Attribute<?, ?> total = calculatedAttribute(plot, "total", "sum(tree[idm:position() = 2]/dbh)");
assertDependents(dbh1, total);
assertDependents(dbh2, total);
}
Aggregations