directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1064412 - in /directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2: searchRequest/ searchResponse/searchResultDone/ searchResponse/searchResultEntry/ searchResponse/searchResultReference/
Date Fri, 28 Jan 2011 01:29:38 GMT
Author: elecharny
Date: Fri Jan 28 01:29:37 2011
New Revision: 1064412

URL: http://svn.apache.org/viewvc?rev=1064412&view=rev
Log:
Fixed DSML SearchRequest/Response tests

Modified:
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchRequest/SearchRequestTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultReference/SearchResultReferenceTest.java

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchRequest/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchRequest/SearchRequestTest.java?rev=1064412&r1=1064411&r2=1064412&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchRequest/SearchRequestTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchRequest/SearchRequestTest.java
Fri Jan 28 01:29:37 2011
@@ -23,11 +23,13 @@ package org.apache.directory.shared.dsml
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -159,9 +161,13 @@ public class SearchRequestTest extends A
         }
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = searchRequest.getCurrentControl();
+        Map<String, Control> controls = searchRequest.getControls();
 
         assertEquals( 1, searchRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertEquals( "Some text", Strings.utf8ToString((byte[]) control.getValue()) );
@@ -190,9 +196,13 @@ public class SearchRequestTest extends A
         }
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = searchRequest.getCurrentControl();
+        Map<String, Control> controls = searchRequest.getControls();
 
         assertEquals( 1, searchRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString((byte[]) control.getValue())
);
@@ -221,9 +231,13 @@ public class SearchRequestTest extends A
         }
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = searchRequest.getCurrentControl();
+        Map<String, Control> controls = searchRequest.getControls();
 
         assertEquals( 1, searchRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertFalse( control.hasValue() );
@@ -252,9 +266,13 @@ public class SearchRequestTest extends A
         }
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = searchRequest.getCurrentControl();
+        Map<String, Control> controls = searchRequest.getControls();
 
         assertEquals( 2, searchRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.789" );
+
+        assertNotNull( control );
         assertFalse( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
         assertEquals( "Some other text", Strings.utf8ToString((byte[]) control.getValue())
);
@@ -283,9 +301,13 @@ public class SearchRequestTest extends A
         }
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = searchRequest.getCurrentControl();
+        Map<String, Control> controls = searchRequest.getControls();
 
         assertEquals( 3, searchRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.456" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
         assertFalse( control.hasValue() );
@@ -992,7 +1014,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof ApproximateNode );
 
-        ApproximateNode approxMatchFilter = ( ApproximateNode ) filter;
+        ApproximateNode<?> approxMatchFilter = ( ApproximateNode<?> ) filter;
 
         assertEquals( "sn", approxMatchFilter.getAttribute() );
 
@@ -1027,7 +1049,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof ApproximateNode );
 
-        ApproximateNode approxMatchFilter = ( ApproximateNode ) filter;
+        ApproximateNode<?> approxMatchFilter = ( ApproximateNode<?> ) filter;
 
         assertEquals( "sn", approxMatchFilter.getAttribute() );
 
@@ -1062,7 +1084,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof ApproximateNode );
 
-        ApproximateNode approxMatchFilter = ( ApproximateNode ) filter;
+        ApproximateNode<?> approxMatchFilter = ( ApproximateNode<?> ) filter;
 
         assertEquals( "sn", approxMatchFilter.getAttribute() );
 
@@ -1127,7 +1149,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof GreaterEqNode );
 
-        GreaterEqNode greaterEqFilter = ( GreaterEqNode ) filter;
+        GreaterEqNode<?> greaterEqFilter = ( GreaterEqNode<?> ) filter;
 
         assertEquals( "sn", greaterEqFilter.getAttribute() );
 
@@ -1162,7 +1184,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof GreaterEqNode );
 
-        GreaterEqNode greaterEqFilter = ( GreaterEqNode ) filter;
+        GreaterEqNode<?> greaterEqFilter = ( GreaterEqNode<?> ) filter;
 
         assertEquals( "sn", greaterEqFilter.getAttribute() );
 
@@ -1197,7 +1219,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof GreaterEqNode );
 
-        GreaterEqNode greaterEqFilter = ( GreaterEqNode ) filter;
+        GreaterEqNode<?> greaterEqFilter = ( GreaterEqNode<?> ) filter;
 
         assertEquals( "sn", greaterEqFilter.getAttribute() );
 
@@ -1262,7 +1284,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof LessEqNode );
 
-        LessEqNode lessOrEqFilter = (LessEqNode) filter;
+        LessEqNode<?> lessOrEqFilter = (LessEqNode<?>) filter;
 
         assertEquals( "sn", lessOrEqFilter.getAttribute() );
 
@@ -1297,7 +1319,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof LessEqNode );
 
-        LessEqNode lessOrEqFilter = ( LessEqNode ) filter;
+        LessEqNode<?> lessOrEqFilter = ( LessEqNode<?> ) filter;
 
         assertEquals( "sn", lessOrEqFilter.getAttribute() );
 
@@ -1332,7 +1354,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof LessEqNode );
 
-        LessEqNode lessOrEqFilter = ( LessEqNode ) filter;
+        LessEqNode<?> lessOrEqFilter = ( LessEqNode<?> ) filter;
 
         assertEquals( "sn", lessOrEqFilter.getAttribute() );
 
@@ -1397,7 +1419,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof EqualityNode );
 
-        EqualityNode equalityFilter = ( EqualityNode ) filter;
+        EqualityNode<?> equalityFilter = ( EqualityNode<?> ) filter;
 
         assertEquals( "sn", equalityFilter.getAttribute() );
         assertEquals( "foobar", equalityFilter.getValue().getString() );
@@ -1431,7 +1453,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof EqualityNode );
 
-        EqualityNode equalityFilter = ( EqualityNode ) filter;
+        EqualityNode<?> equalityFilter = ( EqualityNode<?> ) filter;
 
         assertEquals( "sn", equalityFilter.getAttribute() );
 
@@ -1466,7 +1488,7 @@ public class SearchRequestTest extends A
 
         assertTrue( filter instanceof EqualityNode );
 
-        EqualityNode equalityFilter = (EqualityNode) filter;
+        EqualityNode<?> equalityFilter = (EqualityNode<?>) filter;
 
         assertEquals( "sn", equalityFilter.getAttribute() );
 

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java?rev=1064412&r1=1064411&r2=1064412&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
Fri Jan 28 01:29:37 2011
@@ -23,11 +23,13 @@ package org.apache.directory.shared.dsml
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Collection;
+import java.util.Map;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
@@ -77,15 +79,15 @@ public class SearchResultDoneTest extend
 
         SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getSearchResultDone();
+        Map<String, Control> controls = searchResultDone.getControls();
 
         assertEquals( 1, searchResultDone.getControls().size() );
 
-        Control control = searchResultDone.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
-
         assertEquals( "Some text", Strings.utf8ToString((byte[]) control.getValue()) );
     }
 
@@ -113,9 +115,13 @@ public class SearchResultDoneTest extend
 
         SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getSearchResultDone();
-        Control control = searchResultDone.getCurrentControl();
+        Map<String, Control> controls = searchResultDone.getControls();
 
         assertEquals( 1, searchResultDone.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertFalse( control.hasValue() );
@@ -145,15 +151,15 @@ public class SearchResultDoneTest extend
 
         SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getSearchResultDone();
+        Map<String, Control> controls = searchResultDone.getControls();
 
         assertEquals( 2, searchResultDone.getControls().size() );
 
-        Control control = searchResultDone.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.789" );
 
+        assertNotNull( control );
         assertFalse( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
-
         assertEquals( "Some other text", Strings.utf8ToString((byte[]) control.getValue())
);
     }
 
@@ -181,15 +187,15 @@ public class SearchResultDoneTest extend
 
         SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getSearchResultDone();
+        Map<String, Control> controls = searchResultDone.getControls();
 
         assertEquals( 3, searchResultDone.getControls().size() );
 
-        Control control = searchResultDone.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.456" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
-
         assertFalse( control.hasValue() );
     }
 

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java?rev=1064412&r1=1064411&r2=1064412&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
Fri Jan 28 01:29:37 2011
@@ -23,11 +23,13 @@ package org.apache.directory.shared.dsml
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.UnsupportedEncodingException;
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
@@ -76,15 +78,15 @@ public class SearchResultEntryTest exten
 
         SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getCurrentSearchResultEntry();
+        Map<String, Control> controls = searchResultEntry.getControls();
 
         assertEquals( 1, searchResultEntry.getControls().size() );
 
-        Control control = searchResultEntry.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
-
         assertEquals( "Some text", Strings.utf8ToString((byte[]) control.getValue()) );
     }
 
@@ -112,9 +114,13 @@ public class SearchResultEntryTest exten
 
         SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getCurrentSearchResultEntry();
-        Control control = searchResultEntry.getCurrentControl();
+        Map<String, Control> controls = searchResultEntry.getControls();
 
         assertEquals( 1, searchResultEntry.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertFalse( control.hasValue() );
@@ -144,15 +150,15 @@ public class SearchResultEntryTest exten
 
         SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getCurrentSearchResultEntry();
+        Map<String, Control> controls = searchResultEntry.getControls();
 
         assertEquals( 2, searchResultEntry.getControls().size() );
 
-        Control control = searchResultEntry.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.789" );
 
+        assertNotNull( control );
         assertFalse( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
-
         assertEquals( "Some other text", Strings.utf8ToString((byte[]) control.getValue())
);
     }
 
@@ -180,15 +186,15 @@ public class SearchResultEntryTest exten
 
         SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getCurrentSearchResultEntry();
+        Map<String, Control> controls = searchResultEntry.getControls();
 
         assertEquals( 3, searchResultEntry.getControls().size() );
 
-        Control control = searchResultEntry.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.456" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
-
         assertFalse( control.hasValue() );
     }
 

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultReference/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultReference/SearchResultReferenceTest.java?rev=1064412&r1=1064411&r2=1064412&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultReference/SearchResultReferenceTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultReference/SearchResultReferenceTest.java
Fri Jan 28 01:29:37 2011
@@ -23,10 +23,12 @@ package org.apache.directory.shared.dsml
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Collection;
+import java.util.Map;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
@@ -35,8 +37,8 @@ import org.apache.directory.shared.dsmlv
 import org.apache.directory.shared.dsmlv2.reponse.SearchResponse;
 import org.apache.directory.shared.ldap.model.exception.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.model.filter.LdapURL;
-import org.apache.directory.shared.ldap.model.message.SearchResultReference;
 import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.SearchResultReference;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -74,15 +76,15 @@ public class SearchResultReferenceTest e
 
         SearchResultReference searchResultReference = ( ( SearchResponse ) parser.getBatchResponse()
             .getCurrentResponse() ).getCurrentSearchResultReference();
+        Map<String, Control> controls = searchResultReference.getControls();
 
         assertEquals( 1, searchResultReference.getControls().size() );
 
-        Control control = searchResultReference.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
-
         assertEquals( "Some text", Strings.utf8ToString((byte[]) control.getValue()) );
     }
 
@@ -110,15 +112,15 @@ public class SearchResultReferenceTest e
 
         SearchResultReference searchResultReference = ( ( SearchResponse ) parser.getBatchResponse()
             .getCurrentResponse() ).getCurrentSearchResultReference();
+        Map<String, Control> controls = searchResultReference.getControls();
 
         assertEquals( 1, searchResultReference.getControls().size() );
 
-        Control control = searchResultReference.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
-
         assertFalse( control.hasValue() );
     }
 
@@ -146,15 +148,14 @@ public class SearchResultReferenceTest e
 
         SearchResultReference searchResultReference = ( ( SearchResponse ) parser.getBatchResponse()
             .getCurrentResponse() ).getCurrentSearchResultReference();
+        Map<String, Control> controls = searchResultReference.getControls();
 
         assertEquals( 2, searchResultReference.getControls().size() );
 
-        Control control = searchResultReference.getCurrentControl();
-
-        assertFalse( control.isCritical() );
+        Control control = controls.get( "1.2.840.113556.1.4.789" );
 
+        assertNotNull( control );
         assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
-
         assertEquals( "Some other text", Strings.utf8ToString((byte[]) control.getValue())
);
     }
 
@@ -182,15 +183,15 @@ public class SearchResultReferenceTest e
 
         SearchResultReference searchResultReference = ( ( SearchResponse ) parser.getBatchResponse()
             .getCurrentResponse() ).getCurrentSearchResultReference();
+        Map<String, Control> controls = searchResultReference.getControls();
 
         assertEquals( 3, searchResultReference.getControls().size() );
 
-        Control control = searchResultReference.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.456" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
-
         assertFalse( control.hasValue() );
     }
 



Mime
View raw message