Search in sources :

Example 1 with TreeNode

use of com.github.drinkjava2.functionstest.entitynet.entities.TreeNode in project jSqlBox by drinkjava2.

the class EntityNetTreeTest method testSearchTreeChild.

@Test
public void testSearchTreeChild() {
    EntityNet net = ctx.netLoad(TreeNode.class);
    Set<TreeNode> TreeNodes = net.findEntitySet(TreeNode.class, new Path("S+", TreeNode.class).where("id=? or id=?", "B", "D").nextPath("C*", TreeNode.class, "pid"));
    for (TreeNode node : TreeNodes) System.out.print(node.getId() + " ");
    Assert.assertEquals(9, TreeNodes.size());
}
Also used : Path(com.github.drinkjava2.jsqlbox.entitynet.Path) TreeNode(com.github.drinkjava2.functionstest.entitynet.entities.TreeNode) EntityNet(com.github.drinkjava2.jsqlbox.entitynet.EntityNet) Test(org.junit.Test)

Example 2 with TreeNode

use of com.github.drinkjava2.functionstest.entitynet.entities.TreeNode in project jSqlBox by drinkjava2.

the class EntityNetTreeTest method testSearchTreeParent.

@Test
public void testSearchTreeParent() {
    EntityNet net = ctx.netLoad(TreeNode.class);
    Set<TreeNode> TreeNodes = net.findEntitySet(TreeNode.class, new Path("S-", TreeNode.class).where("id='F' or id='K'").nextPath("P*", TreeNode.class, "pid"));
    for (TreeNode node : TreeNodes) System.out.print(node.getId() + " ");
    Assert.assertEquals(4, TreeNodes.size());
}
Also used : Path(com.github.drinkjava2.jsqlbox.entitynet.Path) TreeNode(com.github.drinkjava2.functionstest.entitynet.entities.TreeNode) EntityNet(com.github.drinkjava2.jsqlbox.entitynet.EntityNet) Test(org.junit.Test)

Example 3 with TreeNode

use of com.github.drinkjava2.functionstest.entitynet.entities.TreeNode in project jSqlBox by drinkjava2.

the class EntityNetTreeTest method init.

@Before
public void init() {
    super.init();
    // ctx.setAllowShowSQL(true);
    TableModel[] models = TableModelUtils.entity2Models(TreeNode.class);
    dropAndCreateDatabase(models);
    new TreeNode().putFields("id", "comments", "pid");
    new TreeNode().putValues("A", "found a bug", null).insert();
    new TreeNode().putValues("B", "is a worm?", "A").insert();
    new TreeNode().putValues("E", "no", "B").insert();
    new TreeNode().putValues("F", "is a bug", "B").insert();
    new TreeNode().putValues("C", "oh, a bug", "A").insert();
    new TreeNode().putValues("G", "need solve it", "C").insert();
    new TreeNode().putValues("D", "careful it bites", "A").insert();
    new TreeNode().putValues("H", "it does not bite", "D").insert();
    new TreeNode().putValues("J", "found the reason", "H").insert();
    new TreeNode().putValues("K", "solved", "H").insert();
    new TreeNode().putValues("L", "uploaded", "H").insert();
    new TreeNode().putValues("I", "well done!", "D").insert();
    System.out.println();
}
Also used : TreeNode(com.github.drinkjava2.functionstest.entitynet.entities.TreeNode) TableModel(com.github.drinkjava2.jdialects.model.TableModel) Before(org.junit.Before)

Example 4 with TreeNode

use of com.github.drinkjava2.functionstest.entitynet.entities.TreeNode in project jSqlBox by drinkjava2.

the class EntityNetTreeTest method testSearchTreeChild2.

@Test
public void testSearchTreeChild2() {
    EntityNet net = ctx.netLoad(TreeNode.class);
    Set<TreeNode> TreeNodes = net.findEntitySet(TreeNode.class, new Path("C*", TreeNode.class, "pid"), new TreeNode("B"), new TreeNode("D"));
    for (TreeNode node : TreeNodes) System.out.print(node.getId() + " ");
    Assert.assertEquals(7, TreeNodes.size());
}
Also used : Path(com.github.drinkjava2.jsqlbox.entitynet.Path) TreeNode(com.github.drinkjava2.functionstest.entitynet.entities.TreeNode) EntityNet(com.github.drinkjava2.jsqlbox.entitynet.EntityNet) Test(org.junit.Test)

Aggregations

TreeNode (com.github.drinkjava2.functionstest.entitynet.entities.TreeNode)4 EntityNet (com.github.drinkjava2.jsqlbox.entitynet.EntityNet)3 Path (com.github.drinkjava2.jsqlbox.entitynet.Path)3 Test (org.junit.Test)3 TableModel (com.github.drinkjava2.jdialects.model.TableModel)1 Before (org.junit.Before)1