// |_|___________| | | |
// |_____________| | |
// |_______________| |
// |_________________|
Graph treeIII =
TreeImpl.valueByResourceNode(resNode);
System.out.println("BEGIN TREEIII");
String s = treeIII.toString();
System.out.println(s);
System.out.println("END TREEIII");
assertTrue(TreeImpl.isTree(treeIII));
assertFalse(treeIII.isContentContainedBy(burst));
assertFalse(burst.isContentContainedBy(treeIII));
assertFalse(treeIII.getNamenode().isContentContainedBy(burst));
assertTrue(burst.isContentContainedBy(treeIII.getNamenode()));
Map map = GraphInformation.recursivelyAnalyzeGraph(resNode);
List<BaseProperty> pRops = GraphInformation.getBaseProperties(map);
Burst burst2 = new BurstImpl(pRops, false);
assertTrue(burst2.getProperties().containsAll(burst.getProperties()));
assertTrue(burst.getProperties().containsAll(burst2.getProperties()));
// this makes sense ... tree1 only has A, B, C but tree2 has A, B, ... L.
assertFalse(this.treeI.hasSameContents(treeIII));
assertTrue(this.treeI.isContentContainedBy(treeIII));
// Same paths for tree2 as for tree1
Set<Path> pathsTreeIII = treeIII.getPathset();
assertTrue(pathsTreeIII.size()==this.numberOfTerminatingNodes);
Set<Path> pathsTreeI = treeI.getPathset();
assertTrue(pathsTreeI.size()==this.numberOfTerminatingNodes);
assertFalse(pathsTreeI.containsAll(pathsTreeIII));
Path[] treeIPaths = new Path[pathsTreeI.size()];
pathsTreeI.toArray(treeIPaths);
Path[] treeIIIPaths = new Path[pathsTreeIII.size()];
pathsTreeIII.toArray(treeIIIPaths);
List<BaseProperty> propertiesInTreeI = new ArrayList<BaseProperty>();
for (Path path : treeIPaths)
{
propertiesInTreeI.addAll(path.getProperties());
}
List<BaseProperty> propertiesInTreeIII = new ArrayList<BaseProperty>();
for (Path path : treeIIIPaths)
{
propertiesInTreeIII.addAll(path.getProperties());
}
assertTrue(propertiesInTreeI.containsAll(propertiesInTreeIII));
assertTrue(propertiesInTreeIII.containsAll(propertiesInTreeI));
assertTrue(propertiesInTreeI.size() == this.numberOfTerminatingNodes*2);
assertTrue(propertiesInTreeIII.size() == this.numberOfTerminatingNodes*2);
Set<BaseProperty> propSetTI = new HashSet<BaseProperty>(propertiesInTreeI);
assertTrue(propSetTI.size() == this.numberOfProperties);
Set<BaseProperty> propSetTIII = new HashSet<BaseProperty>(propertiesInTreeIII);
assertTrue(propSetTIII.size() == this.numberOfProperties);
Set<BaseProperty> AtoL = new HashSet<BaseProperty>(properties);
assertTrue(AtoL.containsAll(propSetTI));
assertTrue(propSetTI.containsAll(AtoL));
assertTrue(AtoL.containsAll(propSetTIII));
assertTrue(propSetTIII.containsAll(AtoL));
// Can we verify that the paths in treeIII are:
// [nTIII, A, D], [nTIII, A, E], [nTIII, A, F],
// [nTIII, B, G], [nTIII, B, H], [nTIII, B, I],
// [nTIII, C, J], [nTIII, C, K], [nTIII, C, L]
List<Path> pathsInTreeIII = new ArrayList<Path>(9);
for ( int ndx1 = TreeImplTest.PROPERTIES.A.ordinal();
ndx1 < TreeImplTest.PROPERTIES.C.ordinal() + 1;
ndx1++)
{
// 0 -> 3,4,5, 1 -> 6,7,8, 2 -> 9,10,11
int start = (ndx1 + 1) * 3;
for (int ndx2 = 0; ndx2 < 3; ndx2++)
{
List<BaseProperty> theProps = new ArrayList<BaseProperty>(2);
theProps.add(getProperty(TreeImplTest.PROPERTIES.values()[ndx1]));
theProps.add(getProperty(TreeImplTest.PROPERTIES.values()[start + ndx2]));
Path aPathInTreeIII = PathImpl.newInstance(treeIII.getNamenode(), theProps);
pathsInTreeIII.add(aPathInTreeIII);
assertTrue(pathsTreeIII.contains(aPathInTreeIII));
}
}