directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r619902 - /directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
Date Fri, 08 Feb 2008 15:00:07 GMT
Author: elecharny
Date: Fri Feb  8 07:00:04 2008
New Revision: 619902

URL: http://svn.apache.org/viewvc?rev=619902&view=rev
Log:
Removed toString() comparisons, and replaced them by atomic tests on Nodes structure

Modified:
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java?rev=619902&r1=619901&r2=619902&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
Fri Feb  8 07:00:04 2008
@@ -57,7 +57,14 @@
         
         assertNotNull( node );
         assertTrue( node instanceof BranchNode );
-        assertEquals( "{Branch: {Leaf: 'dc=example, dc=com'}}", node.toString() );
+        assertTrue( ((BranchNode)node).contains( "dc=com" ) );
+        
+        Node child = ((BranchNode)node).getChild( "dc=com" );
+        assertTrue( child instanceof BranchNode );
+        assertTrue( ((BranchNode)child).contains( "dc=example" ) );
+
+        child = ((BranchNode)child).getChild( "dc=example" );
+        assertEquals( "dc=example, dc=com", ((LeafNode)child).getPartition().getSuffix()
);
     }
 
 
@@ -83,7 +90,20 @@
 
         assertNotNull( node );
         assertTrue( node instanceof BranchNode );
-        assertEquals( "{Leaf: 'ou=system', Branch: {Leaf: 'dc=example, dc=com'}}", node.toString()
);
+        assertTrue( ((BranchNode)node).contains( "ou=system" ) );
+        assertTrue( ((BranchNode)node).contains( "dc=com" ) );
+        
+        Node child = ((BranchNode)node).getChild( "ou=system" );
+        assertTrue( child instanceof LeafNode );
+        assertEquals( "ou=system", ((LeafNode)child).getPartition().getSuffix() );
+
+        child = ((BranchNode)node).getChild( "dc=com" );
+        assertTrue( child instanceof BranchNode );
+        assertTrue( ((BranchNode)child).contains( "dc=example" ) );
+        
+        child = ((BranchNode)child).getChild( "dc=example" );
+        assertTrue( child instanceof LeafNode );
+        assertEquals( "dc=example, dc=com", ((LeafNode)child).getPartition().getSuffix()
);
     }
 
 
@@ -138,7 +158,24 @@
         Node node = partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix2,
0, partition2 );
 
         assertNotNull( node );
+        
         assertTrue( node instanceof BranchNode );
-        assertEquals( "{Branch: {Leaf: 'dc=example2, dc=com', Leaf: 'dc=example1, dc=com'}}",
node.toString() );
+        assertTrue( ((BranchNode)node).contains( "dc=com" ) );
+        
+        Node child = ((BranchNode)node).getChild( "dc=com" );
+        assertTrue( child instanceof BranchNode );
+
+        child = ((BranchNode)node).getChild( "dc=com" );
+        assertTrue( child instanceof BranchNode );
+        assertTrue( ((BranchNode)child).contains( "dc=example1" ) );
+        assertTrue( ((BranchNode)child).contains( "dc=example2" ) );
+        
+        Node child1 = ((BranchNode)child).getChild( "dc=example1" );
+        assertTrue( child1 instanceof LeafNode );
+        assertEquals( "dc=example1, dc=com", ((LeafNode)child1).getPartition().getSuffix()
);
+
+        Node child2 = ((BranchNode)child).getChild( "dc=example1" );
+        assertTrue( child2 instanceof LeafNode );
+        assertEquals( "dc=example1, dc=com", ((LeafNode)child2).getPartition().getSuffix()
);
     }
 }



Mime
View raw message