// 1. create a new tree block with two trees,
// one associated w/ analysis step:
String newName = testName + " test " + Math.random();
PhyloTree tree = new PhyloTree();
tree.setTitle(newName);
tree.setLabel(newName);
tree.setNexusFileName(null);
PhyloTreeNode rootNode = new PhyloTreeNode();
tree.addTreeNode(rootNode);
tree.setRootNode(rootNode);
PhyloTreeNode node1 = new PhyloTreeNode();
rootNode.addChildNode(node1);
PhyloTreeNode node2 = new PhyloTreeNode();
rootNode.addChildNode(node2);
PhyloTreeNode node3 = new PhyloTreeNode();
node1.addChildNode(node3);
PhyloTreeNode node4 = new PhyloTreeNode();
node3.addChildNode(node4);
// tree2:
PhyloTree tree2 = new PhyloTree();
tree2.setLabel(newName + "2");
PhyloTreeNode node21 = new PhyloTreeNode();
tree2.addTreeNode(node21);
tree2.setRootNode(node21);
// treeblock:
TreeBlock block = new TreeBlock();
block.setTitle(newName);
block.addPhyloTree(tree);
block.addPhyloTree(tree2);
// Create an analysis step and associate w/ tree.
Study s = getTestStudy();
Analysis a1 = new Analysis();
a1.setName("1 " + newName);
AnalysisStep step1 = new AnalysisStep();
step1.setName("step1 " + newName);
s.addAnalysis(a1);
a1.addAnalysisStep(step1);
AnalyzedTree treeData = new AnalyzedTree();
treeData.setTree(tree);
treeData.setInput(Boolean.FALSE);
step1.addAnalyzedData(treeData);
getFixture().store(tree);
getFixture().store(tree2);
getFixture().store(block);
// force commit immediately, important:
setComplete();
endTransaction();
logger.info("tree1 created: " + tree.getLabel() + "id = " + tree.getId());
logger.info("tree2 created: " + tree2.getLabel() + "id = " + tree2.getId());
logger.info("treeBlock created: " + block.getTitle() + "id = " + block.getId());
logger.info("analysis step created: " + step1.getName() + "id = " + step1.getId()
+ " associated data count=" + step1.getDataSetReadOnly().size());
// logger.info("treeBlock created: " + block.getTitle() + "id = " + block.getId());