You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/08/17 23:26:14 UTC
svn commit: r567151 -
/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
Author: akarasulu
Date: Fri Aug 17 14:26:14 2007
New Revision: 567151
URL: http://svn.apache.org/viewvc?view=rev&rev=567151
Log:
adding a couple more complex negation operator tests
Modified:
directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java?view=diff&rev=567151&r1=567150&r2=567151
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java Fri Aug 17 14:26:14 2007
@@ -107,6 +107,7 @@
loadedEntries = super.loadTestLdif( true );
ctx = getWiredContext();
assertNotNull( ctx );
+ assertEquals( 5, loadedEntries.size() );
}
@@ -135,6 +136,7 @@
Set<SearchResult> results = getResults( "(!(ou=drama))" );
assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
assertTrue( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 2, results.size() );
}
@@ -152,6 +154,42 @@
Set<SearchResult> results = getResults( "(!(ou=drama))" );
assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
assertTrue( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 2, results.size() );
+ }
+
+
+ /**
+ * Tests to make sure a negated search for actors without ou
+ * with value 'drama' returns those that do not have the attribute
+ * and do not have a 'drama' value for ou if the attribute still
+ * exists. This test does not build an index on ou for the system
+ * partition.
+ */
+ public void testSearchNotDramaNotNewbie() throws Exception
+ {
+ // jack black has ou but not drama, and joe newbie has no ou what so ever
+ Set<SearchResult> results = getResults( "(& (!(uid=jnewbie)) (!(ou=drama)) )" );
+ assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
+ assertFalse( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 1, results.size() );
+ }
+
+
+ /**
+ * Tests to make sure a negated search for actors without ou
+ * with value 'drama' returns those that do not have the attribute
+ * and do not have a 'drama' value for ou if the attribute still
+ * exists. This test DOES build an index on ou for the system
+ * partition and should have failed if the bug in DIRSERVER-951
+ * was present and reproducable.
+ */
+ public void testSearchNotDramaNotNewbieIndexed() throws Exception
+ {
+ // jack black has ou but not drama, and joe newbie has no ou what so ever
+ Set<SearchResult> results = getResults( "(& (!(uid=jnewbie)) (!(ou=drama)) )" );
+ assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
+ assertFalse( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 1, results.size() );
}