directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r575783 [4/4] - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ apacheds/trunk/core/src/main/java/org/apache/directory/server...
Date Fri, 14 Sep 2007 20:15:03 GMT
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
Fri Sep 14 13:14:59 2007
@@ -111,7 +111,7 @@
         SimpleNode node = ( SimpleNode ) parser.parse( "( ou ~= people )" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "people", node.getValue() );
-        assertEquals( AssertionEnum.APPROXIMATE, node.getAssertionType() );
+        assertTrue( node instanceof ApproximateNode );
     }
 
 
@@ -119,7 +119,7 @@
     {
         BranchNode node = ( BranchNode ) parser.parse( "(& ( ou ~= people ) (age>=30)
) " );
         assertEquals( 2, node.getChildren().size() );
-        assertEquals( AssertionEnum.AND, node.getOperator() );
+        assertTrue( node instanceof AndNode );
     }
 
 
@@ -127,7 +127,7 @@
     {
         BranchNode node = ( BranchNode ) parser.parse( "(& ( ou ~= people ) ) " );
         assertEquals( 1, node.getChildren().size() );
-        assertEquals( AssertionEnum.AND, node.getOperator() );
+        assertTrue( node instanceof AndNode );
     }
 
 
@@ -135,7 +135,7 @@
     {
         BranchNode node = ( BranchNode ) parser.parse( "(| ( ou ~= people ) (age>=30)
) " );
         assertEquals( 2, node.getChildren().size() );
-        assertEquals( AssertionEnum.OR, node.getOperator() );
+                assertTrue( node instanceof OrNode );
     }
 
 
@@ -143,7 +143,7 @@
     {
         BranchNode node = ( BranchNode ) parser.parse( "(| (age>=30) ) " );
         assertEquals( 1, node.getChildren().size() );
-        assertEquals( AssertionEnum.OR, node.getOperator() );
+                assertTrue( node instanceof OrNode );
     }
 
 
@@ -151,7 +151,7 @@
     {
         BranchNode node = ( BranchNode ) parser.parse( "( ! (& ( ou ~= people ) (age>=30)
) )" );
         assertEquals( 1, node.getChildren().size() );
-        assertEquals( AssertionEnum.NOT, node.getOperator() );
+                assertTrue( node instanceof NotNode );
     }
 
 
@@ -183,27 +183,27 @@
     {
         PresenceNode node = ( PresenceNode ) parser.parse( "( ou =*)" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( ou =* )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( ou =  * )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "(  ou = *)" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( ou =* ) " );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( ou =*)" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
     }
 
 
@@ -211,23 +211,24 @@
     {
         PresenceNode node = ( PresenceNode ) parser.parse( "( 1.2.3.4 = * )" );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( 1.2.3.4 =  * )" );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "(  1.2.3.4 = *)" );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+                assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( 1.2.3.4 =* ) " );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+        assertTrue( node instanceof PresenceNode );
+        assertTrue( node instanceof PresenceNode );
 
         node = ( PresenceNode ) parser.parse( "( 1.2.3.4 =*)" );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( AssertionEnum.PRESENCE, node.getAssertionType() );
+        assertTrue( node instanceof PresenceNode );
     }
 
 
@@ -236,7 +237,7 @@
         SimpleNode node = ( SimpleNode ) parser.parse( "( ou = people )" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "people", node.getValue() );
-        assertEquals( AssertionEnum.EQUALITY, node.getAssertionType() );
+                assertTrue( node instanceof EqualityNode );
     }
 
 
@@ -260,7 +261,7 @@
         SimpleNode node = ( SimpleNode ) parser.parse( "( ou = people/in/my/company )" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "people/in/my/company", node.getValue() );
-        assertEquals( AssertionEnum.EQUALITY, node.getAssertionType() );
+                assertTrue( node instanceof EqualityNode );
     }
 
 
@@ -271,7 +272,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -283,7 +284,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -294,7 +295,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -321,7 +322,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -332,7 +333,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -343,7 +344,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -370,7 +371,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -381,7 +382,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -392,7 +393,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -403,7 +404,7 @@
         assertEquals( "dummyAssertion", StringTools.utf8ToString( node.getValue() ) );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -414,7 +415,7 @@
         assertEquals( "dummyAssertion\\23\\ac", StringTools.utf8ToString( node.getValue()
) );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
-        assertEquals( AssertionEnum.EXTENSIBLE, node.getAssertionType() );
+                assertTrue( node instanceof ExtensibleNode );
     }
 
 
@@ -503,7 +504,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou = foo* )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 0, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -516,7 +517,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou = foo*bar )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 0, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -529,7 +530,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou = *bar )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 0, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -542,7 +543,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou = foo*guy*bar )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 1, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -556,7 +557,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou =a*b*c*d*e*f )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 4, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -573,7 +574,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou =*b*c*d*e*f )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 4, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -590,7 +591,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou =a*b*c*d*e* )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 4, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -607,7 +608,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou =*b*c*d*e* )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 4, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -624,7 +625,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou = foo* *bar )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 0, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -638,7 +639,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou = foo* a *bar )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 1, node.getAny().size() );
         assertFalse( node.getAny().contains( "" ) );
@@ -657,7 +658,7 @@
     {
         SubstringNode node = ( SubstringNode ) parser.parse( "( ou =*foo*)" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( AssertionEnum.SUBSTRING, node.getAssertionType() );
+                assertTrue( node instanceof SubstringNode );
 
         assertEquals( 1, node.getAny().size() );
         assertTrue( node.getAny().contains( "foo" ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationParserTest.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationParserTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationParserTest.java
Fri Sep 14 13:14:59 2007
@@ -27,10 +27,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
+import org.apache.directory.shared.ldap.filter.NotNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
@@ -273,19 +276,19 @@
     {
         SubtreeSpecification ss = parser.parse( SPEC_WITH_REFINEMENT );
 
-        SimpleNode n1 = new SimpleNode( "objectClass", "1.2.3", AssertionEnum.EQUALITY );
-        SimpleNode n2 = new SimpleNode( "objectClass", "4.5.6", AssertionEnum.EQUALITY );
-        SimpleNode n3 = new SimpleNode( "objectClass", "person-7", AssertionEnum.EQUALITY
);
-        BranchNode n4 = new BranchNode( AssertionEnum.OR );
+        SimpleNode n1 = new EqualityNode( "objectClass", "1.2.3" );
+        SimpleNode n2 = new EqualityNode( "objectClass", "4.5.6" );
+        SimpleNode n3 = new EqualityNode( "objectClass", "person-7" );
+        BranchNode n4 = new OrNode();
         n4.addNode( n2 );
         n4.addNode( n3 );
-        BranchNode n5 = new BranchNode( AssertionEnum.AND );
+        BranchNode n5 = new AndNode();
         n5.addNode( n1 );
         n5.addNode( n4 );
-        SimpleNode n6 = new SimpleNode( "objectClass", "10.11.12", AssertionEnum.EQUALITY
);
-        BranchNode n7 = new BranchNode( AssertionEnum.NOT );
+        SimpleNode n6 = new EqualityNode( "objectClass", "10.11.12" );
+        BranchNode n7 = new NotNode();
         n7.addNode( n6 );
-        BranchNode n8 = new BranchNode( AssertionEnum.AND );
+        BranchNode n8 = new AndNode();
         n8.addNode( n5 );
         n8.addNode( n7 );
 



Mime
View raw message