directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r483066 [9/10] - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src: main/java/org/apache/directory/ldapstudio/dsmlv2/ main/java/org/apache/directory/ldapstudio/dsmlv2/engine/ main/java/org/apache/directory/ldapstudio/ds...
Date Wed, 06 Dec 2006 13:17:46 GMT
Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java?view=diff&rev=483066&r1=483065&r2=483066
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java Wed Dec  6 05:17:42 2006
@@ -20,6 +20,7 @@
 
 package org.apache.directory.ldapstudio.dsmlv2.searchRequest;
 
+
 import java.util.ArrayList;
 
 import javax.naming.NamingEnumeration;
@@ -43,11 +44,12 @@
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
 import org.apache.directory.shared.ldap.util.StringTools;
 
+
 /**
  * Tests for the Del Request parsing
  */
 public class SearchRequestTest extends AbstractTest
-{ 
+{
     /**
      * Test parsing of a request without the dn attribute
      */
@@ -55,7 +57,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_without_dn_attribute.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with the dn attribute
      */
@@ -65,21 +68,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_dn_attribute.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( "ou=marketing,dc=microsoft,dc=com", searchRequest.getBaseObject().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with the (optional) requestID attribute
      */
@@ -89,21 +93,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_requestID_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( 456, searchRequest.getMessageId() );
     }
-    
+
 
     /**
      * Test parsing of a request with a (optional) Control element
@@ -114,29 +119,63 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_1_control.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( 1, searchRequest.getControls().size() );
-        
+
         Control control = searchRequest.getCurrentControl();
-        
+
         assertTrue( control.getCriticality() );
-        
+
         assertEquals( "1.2.840.113556.1.4.643", control.getControlType() );
-        
+
         assertEquals( "Some text", StringTools.utf8ToString( ( byte[] ) control.getControlValue() ) );
     }
-    
+
+
+    /**
+     * Test parsing of a request with a (optional) Control element with empty value
+     */
+    public void testRequestWith1ControlEmptyValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_1_control_empty_value.xml" )
+                .getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        assertEquals( 1, searchRequest.getControls().size() );
+
+        Control control = searchRequest.getCurrentControl();
+
+        assertTrue( control.getCriticality() );
+
+        assertEquals( "1.2.840.113556.1.4.643", control.getControlType() );
+
+        assertEquals( StringTools.EMPTY_BYTES, control.getControlValue() );
+    }
+
 
     /**
      * Test parsing of a request with 2 (optional) Control elements
@@ -147,29 +186,30 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_2_controls.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( 2, searchRequest.getControls().size() );
-        
+
         Control control = searchRequest.getCurrentControl();
-        
+
         assertFalse( control.getCriticality() );
-        
+
         assertEquals( "1.2.840.113556.1.4.789", control.getControlType() );
-        
+
         assertEquals( "Some other text", StringTools.utf8ToString( ( byte[] ) control.getControlValue() ) );
     }
-    
+
+
     /**
      * Test parsing of a request with 3 (optional) Control elements without value
      */
@@ -179,29 +219,31 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_3_controls_without_value.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_3_controls_without_value.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( 3, searchRequest.getControls().size() );
-        
+
         Control control = searchRequest.getCurrentControl();
-        
+
         assertTrue( control.getCriticality() );
-        
+
         assertEquals( "1.2.840.113556.1.4.456", control.getControlType() );
-        
+
         assertEquals( StringTools.EMPTY_BYTES, control.getControlValue() );
     }
-    
+
+
     /**
      * Test parsing of a request without the Filter element
      */
@@ -209,7 +251,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_without_filter.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request without scope attribute
      */
@@ -217,7 +260,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_without_scope_attribute.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with scope attribute to BaseObject value
      * @throws NamingException 
@@ -228,21 +272,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_scope_baseObject.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.SCOPE_BASE_OBJECT, searchRequest.getScope() );
     }
-    
+
+
     /**
      * Test parsing of a request with scope attribute to SingleLevel value
      * @throws NamingException 
@@ -253,21 +298,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_scope_singleLevel.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, searchRequest.getScope() );
     }
-    
+
+
     /**
      * Test parsing of a request with scope attribute to WholeSubtree value
      * @throws NamingException 
@@ -278,21 +324,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_scope_wholeSubtree.xml" ).getFile() );
-        
+
+            parser
+                .setInputFile( SearchRequestTest.class.getResource( "request_with_scope_wholeSubtree.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, searchRequest.getScope() );
     }
-    
+
+
     /**
      * Test parsing of a request with scope attribute to Error value
      */
@@ -300,7 +348,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_scope_error.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request without derefAliases attribute
      */
@@ -308,7 +357,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_without_derefAliases_attribute.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with derefAliases attribute to derefAlways value
      * @throws NamingException 
@@ -319,21 +369,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_derefAliases_derefAlways.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_derefAliases_derefAlways.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.DEREF_ALWAYS, searchRequest.getDerefAliases() );
     }
-    
+
+
     /**
      * Test parsing of a request with derefAliases attribute to derefFindingBaseObj value
      * @throws NamingException 
@@ -344,21 +396,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_derefAliases_derefFindingBaseObj.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "request_with_derefAliases_derefFindingBaseObj.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, searchRequest.getDerefAliases() );
     }
-    
+
+
     /**
      * Test parsing of a request with derefAliases attribute to derefinSearching value
      * @throws NamingException 
@@ -369,21 +423,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_derefAliases_derefInSearching.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_derefAliases_derefInSearching.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.DEREF_IN_SEARCHING, searchRequest.getDerefAliases() );
     }
-    
+
+
     /**
      * Test parsing of a request with derefAliases attribute to neverDerefAliases value
      * @throws NamingException 
@@ -394,21 +450,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_derefAliases_neverDerefAliases.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class
+                .getResource( "request_with_derefAliases_neverDerefAliases.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( LdapConstants.NEVER_DEREF_ALIASES, searchRequest.getDerefAliases() );
     }
-    
+
+
     /**
      * Test parsing of a request with derefAliases attribute to Error value
      * @throws NamingException 
@@ -417,7 +475,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_derefAliases_error.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with the sizeLimit (optional) attribute
      * @throws NamingException 
@@ -428,21 +487,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_sizeLimit_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_sizeLimit_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( 1000, searchRequest.getSizeLimit() );
     }
-    
+
+
     /**
      * Test parsing of a request with sizeLimit attribute to Error value
      * @throws NamingException 
@@ -451,8 +512,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_sizeLimit_error.xml" );
     }
-    
-    
+
+
     /**
      * Test parsing of a request with the timeLimit (optional) attribute
      * @throws NamingException 
@@ -463,21 +524,23 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_timeLimit_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_timeLimit_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertEquals( 60, searchRequest.getTimeLimit() );
     }
-    
+
+
     /**
      * Test parsing of a request with timeLimit attribute to Error value
      * @throws NamingException 
@@ -486,7 +549,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_timeLimit_error.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with typesOnly to true
      */
@@ -496,22 +560,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_typesOnly_true.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertTrue( searchRequest.isTypesOnly() );
     }
-    
-    
+
+
     /**
      * Test parsing of a request with typesOnly to 1
      */
@@ -521,21 +585,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_typesOnly_1.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertTrue( searchRequest.isTypesOnly() );
     }
-    
+
+
     /**
      * Test parsing of a request with typesOnly to false
      */
@@ -545,21 +610,21 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_typesOnly_false.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertFalse( searchRequest.isTypesOnly() );
     }
-    
+
 
     /**
      * Test parsing of a request with typesOnly to 0
@@ -570,21 +635,22 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "request_with_typesOnly_0.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         assertFalse( searchRequest.isTypesOnly() );
     }
-    
+
+
     /**
      * Test parsing of a request with typesOnly to an error value
      */
@@ -592,7 +658,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_typesOnly_error.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with 2 Filter elements
      */
@@ -600,7 +667,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_2_filters.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with Attibutes Element but not any Attribute element
      */
@@ -610,19 +678,21 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_attributes_but_no_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_attributes_but_no_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         assertTrue( true );
     }
-    
+
+
     /**
      * Test parsing of a request with 2 Attributes elements
      */
@@ -630,7 +700,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_2_attributes_elements.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an Attributes element with 1 Attribute element
      * @throws NamingException 
@@ -641,29 +712,31 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_attributes_1_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_attributes_1_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Attributes attributes = searchRequest.getAttributes();
-        
+
         assertEquals( 1, attributes.size() );
-        
+
         NamingEnumeration ne = attributes.getAll();
-        
+
         Attribute attribute = ( Attribute ) ne.next();
-        
+
         assertEquals( "sn", attribute.getID() );
     }
-    
+
+
     /**
      * Test parsing of a request with an Attributes element with 2 Attribute elements
      * @throws NamingException 
@@ -674,33 +747,35 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_attributes_2_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "request_with_attributes_2_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Attributes attributes = searchRequest.getAttributes();
-        
+
         assertEquals( 2, attributes.size() );
-        
+
         NamingEnumeration ne = attributes.getAll();
-        
+
         Attribute attribute = ( Attribute ) ne.next();
-        
+
         assertEquals( "givenname", attribute.getID() );
-        
+
         attribute = ( Attribute ) ne.next();
-        
+
         assertEquals( "sn", attribute.getID() );
     }
-    
+
+
     /**
      * Test parsing of a request with 1 Attribute without name attribute
      */
@@ -708,7 +783,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_attribute_without_name_attribute.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with empty Filter element
      */
@@ -716,7 +792,8 @@
     {
         testParsingFail( SearchRequestTest.class, "request_with_empty_filter.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an And Filter
      */
@@ -726,23 +803,24 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_and.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
-        assertTrue( filter instanceof AndFilter);
+        assertTrue( filter instanceof AndFilter );
     }
-    
+
+
     /**
      * Test parsing of a request with an Or Filter
      */
@@ -752,23 +830,24 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_or.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
-        assertTrue( filter instanceof OrFilter);
+        assertTrue( filter instanceof OrFilter );
     }
-    
+
+
     /**
      * Test parsing of a request with an Or Filter
      */
@@ -778,23 +857,24 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_not.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
-        assertTrue( filter instanceof NotFilter);
+        assertTrue( filter instanceof NotFilter );
     }
-    
+
+
     /**
      * Test parsing of a request with empty Filter element
      */
@@ -802,7 +882,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_not_with_2_children.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an approxMatch Filter
      */
@@ -812,94 +893,176 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_approxMatch.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_approxMatch.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof AttributeValueAssertionFilter );
-        
+
         AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
-        
+
         assertEquals( LdapConstants.APPROX_MATCH_FILTER, approxMatchFilter.getFilterType() );
-        
+
         AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
-        
+
         assertEquals( "sn", assertion.getAttributeDesc() );
-        
+
         assertEquals( "foobar", assertion.getAssertionValue() );
     }
-    
-    
-    /**
-     * Test parsing of a request with approxMatch Filter but no name attribute
-     */
-    public void testRequestWithApproxMatchFilterWithoutName()
-    {
-        testParsingFail( SearchRequestTest.class, "filters/request_with_approxMatch_without_name.xml" );
-    }
-    
-    /**
-     * Test parsing of a request with approxMatch Filter but no value element
-     */
-    public void testRequestWithApproxMatchFilterWithoutValue()
-    {
-        testParsingFail( SearchRequestTest.class, "filters/request_with_approxMatch_without_value.xml" );
-    }
-    
-    /**
-     * Test parsing of a request with approxMatch Filter with 2 Value elements
-     */
-    public void testRequestWithApproxMatchFilterWith2Values()
-    {
-        testParsingFail( SearchRequestTest.class, "filters/request_with_approxMatch_with_2_values.xml" );
-    }
-    
+
+
     /**
-     * Test parsing of a request with an greaterOrEqual Filter
+     * Test parsing of a request with an approxMatch Filter with empty value
      */
-    public void testRequestWithGreaterOrEqualFilter()
+    public void testRequestWithApproxMatchFilterEmptyValue()
     {
         Dsmlv2Parser parser = null;
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_greaterOrEqual.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_approxMatch_with_empty_value.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof AttributeValueAssertionFilter );
+
+        AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
+
+        assertEquals( LdapConstants.APPROX_MATCH_FILTER, approxMatchFilter.getFilterType() );
+
+        AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
+
+        assertEquals( "sn", assertion.getAttributeDesc() );
+
+        assertNull( assertion.getAssertionValue() );
+    }
+
+
+    /**
+     * Test parsing of a request with approxMatch Filter but no name attribute
+     */
+    public void testRequestWithApproxMatchFilterWithoutName()
+    {
+        testParsingFail( SearchRequestTest.class, "filters/request_with_approxMatch_without_name.xml" );
+    }
+
+
+    /**
+     * Test parsing of a request with approxMatch Filter but no value element
+     */
+    public void testRequestWithApproxMatchFilterWithoutValue()
+    {
+        testParsingFail( SearchRequestTest.class, "filters/request_with_approxMatch_without_value.xml" );
+    }
+
+
+    /**
+     * Test parsing of a request with approxMatch Filter with 2 Value elements
+     */
+    public void testRequestWithApproxMatchFilterWith2Values()
+    {
+        testParsingFail( SearchRequestTest.class, "filters/request_with_approxMatch_with_2_values.xml" );
+    }
+
+
+    /**
+     * Test parsing of a request with an greaterOrEqual Filter
+     */
+    public void testRequestWithGreaterOrEqualFilter()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_greaterOrEqual.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof AttributeValueAssertionFilter );
-        
+
         AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
-        
+
         assertEquals( LdapConstants.GREATER_OR_EQUAL_FILTER, approxMatchFilter.getFilterType() );
-        
+
         AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
-        
+
         assertEquals( "sn", assertion.getAttributeDesc() );
-        
+
         assertEquals( "foobar", assertion.getAssertionValue() );
     }
-    
+
+
+    /**
+     * Test parsing of a request with an greaterOrEqual Filter with an empty value
+     */
+    public void testRequestWithGreaterOrEqualFilterEmptyValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_greaterOrEqual_with_empty_value.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof AttributeValueAssertionFilter );
+
+        AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
+
+        assertEquals( LdapConstants.GREATER_OR_EQUAL_FILTER, approxMatchFilter.getFilterType() );
+
+        AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
+
+        assertEquals( "sn", assertion.getAttributeDesc() );
+
+        assertNull( assertion.getAssertionValue() );
+    }
+
+
     /**
      * Test parsing of a request with greaterOrEqual Filter but no name attribute
      */
@@ -907,7 +1070,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_greaterOrEqual_without_name.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with greaterOrEqual Filter but no value element
      */
@@ -915,7 +1079,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_greaterOrEqual_without_value.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with greaterOrEqual Filter with 2 Value elements
      */
@@ -923,7 +1088,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_greaterOrEqual_with_2_values.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an lessOrEqual Filter
      */
@@ -933,33 +1099,73 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_lessOrEqual.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_lessOrEqual.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof AttributeValueAssertionFilter );
-        
+
         AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
-        
+
         assertEquals( LdapConstants.LESS_OR_EQUAL_FILTER, approxMatchFilter.getFilterType() );
-        
+
         AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
-        
+
         assertEquals( "sn", assertion.getAttributeDesc() );
-        
+
         assertEquals( "foobar", assertion.getAssertionValue() );
     }
-    
+
+
+    /**
+     * Test parsing of a request with an lessOrEqual Filter
+     */
+    public void testRequestWithLessOrEqualFilterEmptyValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_lessOrEqual_with_empty_value.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof AttributeValueAssertionFilter );
+
+        AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
+
+        assertEquals( LdapConstants.LESS_OR_EQUAL_FILTER, approxMatchFilter.getFilterType() );
+
+        AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
+
+        assertEquals( "sn", assertion.getAttributeDesc() );
+
+        assertNull( assertion.getAssertionValue() );
+    }
+
+
     /**
      * Test parsing of a request with lessOrEqual Filter but no name attribute
      */
@@ -967,7 +1173,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_lessOrEqual_without_name.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with lessOrEqual Filter but no value element
      */
@@ -975,7 +1182,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_lessOrEqual_without_value.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with lessOrEqual Filter with 2 Value elements
      */
@@ -983,7 +1191,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_lessOrEqual_with_2_values.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an Equality Filter
      */
@@ -993,33 +1202,73 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_equalityMatch.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_equalityMatch.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof AttributeValueAssertionFilter );
-        
+
         AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
-        
+
         assertEquals( LdapConstants.EQUALITY_MATCH_FILTER, approxMatchFilter.getFilterType() );
-        
+
         AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
-        
+
         assertEquals( "sn", assertion.getAttributeDesc() );
-        
+
         assertEquals( "foobar", assertion.getAssertionValue() );
     }
-    
+
+
+    /**
+     * Test parsing of a request with an Equality Filter with an empty value
+     */
+    public void testRequestWithEqualityMatchFilterWithEmptyValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_equalityMatch_with_empty_value.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof AttributeValueAssertionFilter );
+
+        AttributeValueAssertionFilter approxMatchFilter = ( AttributeValueAssertionFilter ) filter;
+
+        assertEquals( LdapConstants.EQUALITY_MATCH_FILTER, approxMatchFilter.getFilterType() );
+
+        AttributeValueAssertion assertion = approxMatchFilter.getAssertion();
+
+        assertEquals( "sn", assertion.getAttributeDesc() );
+
+        assertNull( assertion.getAssertionValue() );
+    }
+
+
     /**
      * Test parsing of a request with EqualityMatch Filter but no name attribute
      */
@@ -1027,7 +1276,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_equalityMatch_without_name.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with EqualityMatch Filter but no value element
      */
@@ -1035,7 +1285,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_equalityMatch_without_value.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with EqualityMatch Filter with 2 Value elements
      */
@@ -1043,7 +1294,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_equalityMatch_with_2_values.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an Present Filter
      */
@@ -1053,27 +1305,28 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
+
             parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_present.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof PresentFilter );
-        
+
         PresentFilter presentFilter = ( PresentFilter ) filter;
-                
+
         assertEquals( "givenName", presentFilter.getAttributeDescription().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with Present Filter without name attribute
      */
@@ -1081,7 +1334,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_present_without_name.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with an ExtensibleMatch Filter
      */
@@ -1091,29 +1345,65 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-                
+
         assertEquals( "A Value", extensibleMatchFilter.getMatchValue() );
-        
+
         assertEquals( false, extensibleMatchFilter.isDnAttributes() );
     }
-    
+
+
+    /**
+     * Test parsing of a request with an ExtensibleMatch Filter with empty value
+     */
+    public void testRequestWithExtensibleMatchWithEmptyValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_empty_value.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof ExtensibleMatchFilter );
+
+        ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
+
+        assertNull( extensibleMatchFilter.getMatchValue() );
+
+        assertEquals( false, extensibleMatchFilter.isDnAttributes() );
+    }
+
+
     /**
      * Test parsing of a request with ExtensibleMatch Filter without Value element
      */
@@ -1121,7 +1411,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_extensibleMatch_without_value.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with ExtensibleMatch Filter with 2 Value elements
      */
@@ -1129,7 +1420,7 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_extensibleMatch_with_2_values.xml" );
     }
-    
+
 
     /**
      * Test parsing of a request with typesOnly to true
@@ -1140,28 +1431,29 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch_with_dnAttributes_true.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_dnAttributes_true.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-        
+
         assertTrue( extensibleMatchFilter.isDnAttributes() );
     }
-    
-    
+
+
     /**
      * Test parsing of a request with typesOnly to 1
      */
@@ -1171,27 +1463,29 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch_with_dnAttributes_1.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_dnAttributes_1.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-        
+
         assertTrue( extensibleMatchFilter.isDnAttributes() );
     }
-    
+
+
     /**
      * Test parsing of a request with typesOnly to false
      */
@@ -1201,27 +1495,28 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch_with_dnAttributes_false.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_dnAttributes_false.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-        
+
         assertFalse( extensibleMatchFilter.isDnAttributes() );
     }
-    
+
 
     /**
      * Test parsing of a request with typesOnly to 0
@@ -1232,27 +1527,29 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch_with_dnAttributes_0.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_dnAttributes_0.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-        
+
         assertFalse( extensibleMatchFilter.isDnAttributes() );
     }
-    
+
+
     /**
      * Test parsing of a request with typesOnly to an error value
      */
@@ -1260,7 +1557,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_extensibleMatch_with_dnAttributes_error.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with a matchingRule attribute
      */
@@ -1270,27 +1568,29 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch_with_matchingRule.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_matchingRule.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-        
+
         assertEquals( "AMatchingRuleName", extensibleMatchFilter.getMatchingRule().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with a name attribute
      */
@@ -1300,27 +1600,29 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_extensibleMatch_with_name.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_extensibleMatch_with_name.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof ExtensibleMatchFilter );
-        
+
         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
-        
+
         assertEquals( "givenName", extensibleMatchFilter.getType().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with an Substrings Filter
      */
@@ -1330,27 +1632,29 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings.xml" ).getFile() );
-        
+
+            parser
+                .setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-                
+
         assertEquals( "sn", substringFilter.getType().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with Substrings Filter without name
      */
@@ -1358,7 +1662,8 @@
     {
         testParsingFail( SearchRequestTest.class, "filters/request_with_substrings_without_name.xml" );
     }
-    
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Initial element
      */
@@ -1368,27 +1673,61 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_initial.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_initial.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         assertEquals( "jack", substringFilter.getInitialSubstrings().toString() );
     }
-    
+
+
+    /**
+     * Test parsing of a request with a Substrings Filter with 1 emptyInitial element
+     */
+    public void testRequestWithSubstrings1EmptyInitial()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_substrings_1_empty_initial.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof SubstringFilter );
+
+        SubstringFilter substringFilter = ( SubstringFilter ) filter;
+
+        assertNull( substringFilter.getInitialSubstrings() );
+    }
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Initial and 1 Any elements
      */
@@ -1398,33 +1737,35 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_initial_1_any.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_substrings_1_initial_1_any.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         assertEquals( "jack", substringFilter.getInitialSubstrings().toString() );
-        
+
         ArrayList initials = substringFilter.getAnySubstrings();
-        
+
         assertEquals( 1, initials.size() );
-        
+
         assertEquals( "kate", initials.get( 0 ).toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Initial and 1 Final elements
      */
@@ -1434,29 +1775,31 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_initial_1_final.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_substrings_1_initial_1_final.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         assertEquals( "jack", substringFilter.getInitialSubstrings().toString() );
 
         assertEquals( "john", substringFilter.getFinalSubstrings().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Any element
      */
@@ -1466,31 +1809,67 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_any.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_any.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         ArrayList initials = substringFilter.getAnySubstrings();
-        
+
         assertEquals( 1, initials.size() );
-        
+
         assertEquals( "kate", initials.get( 0 ).toString() );
     }
-    
+
+
+    /**
+     * Test parsing of a request with a Substrings Filter with 1 empty Any element
+     */
+    public void testRequestWithSubstrings1EmptyAny()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class
+                .getResource( "filters/request_with_substrings_1_empty_any.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof SubstringFilter );
+
+        SubstringFilter substringFilter = ( SubstringFilter ) filter;
+
+        ArrayList initials = substringFilter.getAnySubstrings();
+
+        assertEquals( 0, initials.size() );
+    }
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Any element
      */
@@ -1500,33 +1879,35 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_2_any.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_2_any.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         ArrayList initials = substringFilter.getAnySubstrings();
-        
+
         assertEquals( 2, initials.size() );
-        
+
         assertEquals( "kate", initials.get( 0 ).toString() );
-        
+
         assertEquals( "sawyer", initials.get( 1 ).toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Any and 1 Final elements
      */
@@ -1536,33 +1917,35 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_any_1_final.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_substrings_1_any_1_final.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         ArrayList initials = substringFilter.getAnySubstrings();
-        
+
         assertEquals( 1, initials.size() );
-        
+
         assertEquals( "kate", initials.get( 0 ).toString() );
-        
+
         assertEquals( "john", substringFilter.getFinalSubstrings().toString() );
     }
-    
+
+
     /**
      * Test parsing of a request with a Substrings Filter with 1 Final element
      */
@@ -1572,24 +1955,92 @@
         try
         {
             parser = new Dsmlv2Parser();
-            
-            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_final.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_final.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
-        
+
         Filter filter = searchRequest.getFilter();
 
         assertTrue( filter instanceof SubstringFilter );
-        
+
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
-        
+
         assertEquals( "john", substringFilter.getFinalSubstrings().toString() );
+    }
+
+
+    /**
+     * Test parsing of a request with a Substrings Filter with 1 empty Final element
+     */
+    public void testRequestWithSubstrings1EmptyFinal()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser.setInputFile( SearchRequestTest.class.getResource(
+                "filters/request_with_substrings_1_empty_final.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        Filter filter = searchRequest.getFilter();
+
+        assertTrue( filter instanceof SubstringFilter );
+
+        SubstringFilter substringFilter = ( SubstringFilter ) filter;
+
+        assertNull( substringFilter.getFinalSubstrings() );
+    }
+
+
+    /**
+     * Test parsing of a request with a SubEntries Control
+     */
+    public void testRequestWithSubEntriesControl()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+
+            parser
+                .setInputFile( SearchRequestTest.class.getResource( "request_with_subentries_control.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
+
+        assertEquals( 1, searchRequest.getControls().size() );
+
+        Control control = searchRequest.getCurrentControl();
+
+        assertTrue( control.getCriticality() );
+
+        assertEquals( "1.3.6.1.4.1.4203.1.10.1", control.getControlType() );
+
+        assertEquals( "Some text", StringTools.utf8ToString( ( byte[] ) control.getControlValue() ) );
+
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/SearchResponseTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/SearchResponseTest.java?view=diff&rev=483066&r1=483065&r2=483066
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/SearchResponseTest.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/SearchResponseTest.java Wed Dec  6 05:17:42 2006
@@ -20,16 +20,18 @@
 
 package org.apache.directory.ldapstudio.dsmlv2.searchResponse;
 
+
 import org.apache.directory.ldapstudio.dsmlv2.AbstractResponseTest;
 import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
 import org.apache.directory.ldapstudio.dsmlv2.reponse.SearchResponse;
 
+
 /**
  * Tests for the Search Result Done Response parsing
  */
 public class SearchResponseTest extends AbstractResponseTest
 {
-	 /**
+    /**
      * Test parsing of a Response with the (optional) requestID attribute
      */
     public void testResponseWithRequestId()
@@ -38,23 +40,24 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_requestID_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_requestID_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 456, searchResponse.getMessageId() );
     }
-    
-    
-	 /**
+
+
+    /**
      * Test parsing of a Response with a Search Result Done
      */
     public void testResponseWithSRD()
@@ -63,22 +66,23 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRD.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
-	 /**
+
+
+    /**
      * Test parsing of a Response with 1 Search Result Entry and a Search Result Done
      */
     public void testResponseWith1SRE1SRD()
@@ -87,25 +91,25 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRE_1_SRD.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 1, searchResponse.getSearchResultEntryList().size() );
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
-    
-	 /**
+
+
+    /**
      * Test parsing of a Response with 1 Search Result Reference and a Search Result Done
      */
     public void testResponseWith1SRR1SRD()
@@ -114,23 +118,24 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRR_1_SRD.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 1, searchResponse.getSearchResultReferenceList().size() );
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
+
+
     /**
      * Test parsing of a Response with 1 Search Result Entry, 1 Search Result Reference and a Search Result Done
      */
@@ -140,25 +145,27 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRE_1_SRR_1_SRD.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRE_1_SRR_1_SRD.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 1, searchResponse.getSearchResultEntryList().size() );
-        
+
         assertEquals( 1, searchResponse.getSearchResultReferenceList().size() );
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
+
+
     /**
      * Test parsing of a Response with 2 Search Result Entry and a Search Result Done
      */
@@ -168,23 +175,24 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResponseTest.class.getResource( "response_with_2_SRE_1_SRD.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 2, searchResponse.getSearchResultEntryList().size() );
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
+
+
     /**
      * Test parsing of a Response with 2 Search Result Reference and a Search Result Done
      */
@@ -194,23 +202,24 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResponseTest.class.getResource( "response_with_2_SRR_1_SRD.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 2, searchResponse.getSearchResultReferenceList().size() );
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
+
+
     /**
      * Test parsing of a Response with 2 Search Result Entry, 2 Search Result Reference and a Search Result Done
      */
@@ -220,47 +229,50 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_2_SRE_2_SRR_1_SRD.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_2_SRE_2_SRR_1_SRD.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
+
         SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();
-        
+
         assertEquals( 2, searchResponse.getSearchResultEntryList().size() );
-        
+
         assertEquals( 2, searchResponse.getSearchResultReferenceList().size() );
-        
+
         assertNotNull( searchResponse.getSearchResultDone() );
     }
-    
-    
+
+
     /**
      * Test parsing of a response with no Search Result Done
      */
     public void testResponseWith0SRD()
     {
-        testParsingFail( SearchResponseTest.class, "response_with_0_SRD.xml");
+        testParsingFail( SearchResponseTest.class, "response_with_0_SRD.xml" );
     }
-    
+
+
     /**
      * Test parsing of a response with 1 Search Result Entry but no Search Result Done
      */
     public void testResponseWith1SRE0SRD()
     {
-        testParsingFail( SearchResponseTest.class, "response_with_1_SRE_0_SRD.xml");
+        testParsingFail( SearchResponseTest.class, "response_with_1_SRE_0_SRD.xml" );
     }
-    
+
+
     /**
      * Test parsing of a response with 1 Search Result Reference but no Search Result Done
      */
     public void testResponseWith1SRR0SRD()
     {
-        testParsingFail( SearchResponseTest.class, "response_with_1_SRR_0_SRD.xml");
+        testParsingFail( SearchResponseTest.class, "response_with_1_SRR_0_SRD.xml" );
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java?view=diff&rev=483066&r1=483065&r2=483066
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java Wed Dec  6 05:17:42 2006
@@ -20,6 +20,7 @@
 
 package org.apache.directory.ldapstudio.dsmlv2.searchResponse.searchResultDone;
 
+
 import java.util.List;
 
 import javax.naming.NamingException;
@@ -34,6 +35,7 @@
 
 import com.sun.jndi.ldap.LdapURL;
 
+
 /**
  * Tests for the Search Result Done Response parsing
  */
@@ -44,13 +46,13 @@
      */
     public void testResponseWith1Control()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_1_control.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
@@ -58,64 +60,68 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         assertEquals( 1, searchResultDone.getControls().size() );
-        
+
         Control control = searchResultDone.getCurrentControl();
-        
+
         assertTrue( control.getCriticality() );
-        
+
         assertEquals( "1.2.840.113556.1.4.643", control.getControlType() );
-        
+
         assertEquals( "Some text", StringTools.utf8ToString( ( byte[] ) control.getControlValue() ) );
     }
-    
+
 
     /**
      * Test parsing of a response with 2 (optional) Control elements
      */
     public void testResponseWith2Controls()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_2_controls.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         assertEquals( 2, searchResultDone.getControls().size() );
-        
+
         Control control = searchResultDone.getCurrentControl();
-        
+
         assertFalse( control.getCriticality() );
-        
+
         assertEquals( "1.2.840.113556.1.4.789", control.getControlType() );
-        
+
         assertEquals( "Some other text", StringTools.utf8ToString( ( byte[] ) control.getControlValue() ) );
     }
-    
+
+
     /**
      * Test parsing of a response with 3 (optional) Control elements without value
      */
     public void testResponseWith3ControlsWithoutValue()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_3_controls_without_value.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_3_controls_without_value.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
@@ -123,19 +129,20 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         assertEquals( 3, searchResultDone.getControls().size() );
-        
+
         Control control = searchResultDone.getCurrentControl();
-        
+
         assertTrue( control.getCriticality() );
-        
+
         assertEquals( "1.2.840.113556.1.4.456", control.getControlType() );
-        
+
         assertEquals( StringTools.EMPTY_BYTES, control.getControlValue() );
     }
-    
+
 
     /**
      * Test parsing of a Response with the (optional) requestID attribute
@@ -146,50 +153,54 @@
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_requestID_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_requestID_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
         {
             fail( e.getMessage() );
         }
-        
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         assertEquals( 456, searchResultDone.getMessageId() );
     }
-       
-    
+
+
     /**
      * Test parsing of a response without Result Code element
      */
     public void testResponseWithoutResultCode()
     {
-        testParsingFail( SearchResultDoneTest.class, "response_without_result_code.xml");
+        testParsingFail( SearchResultDoneTest.class, "response_without_result_code.xml" );
     }
-    
+
+
     /**
      * Test parsing of a response with Result Code element but a not integer value
      */
     public void testResponseWithResultCodeNotInteger()
     {
-        testParsingFail( SearchResultDoneTest.class, "response_with_result_code_not_integer.xml");
+        testParsingFail( SearchResultDoneTest.class, "response_with_result_code_not_integer.xml" );
     }
-    
+
+
     /**
      * Test parsing of a response with Result Code 
      */
     public void testResponseWithResultCode()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_result_code.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
@@ -197,25 +208,27 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         LdapResult ldapResult = searchResultDone.getLdapResult();
-        
+
         assertEquals( 2, ldapResult.getResultCode() );
     }
-    
+
+
     /**
      * Test parsing of a response with Error Message
      */
     public void testResponseWithErrorMessage()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_error_message.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
@@ -223,25 +236,28 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         LdapResult ldapResult = searchResultDone.getLdapResult();
-        
-        assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult.getErrorMessage() );
+
+        assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult
+            .getErrorMessage() );
     }
-    
+
+
     /**
      * Test parsing of a response with a Referral
      */
     public void testResponseWith1Referral()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_1_referral.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
@@ -249,38 +265,40 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         LdapResult ldapResult = searchResultDone.getLdapResult();
-        
+
         List referrals = ldapResult.getReferrals();
-        
+
         assertEquals( 1, referrals.size() );
-        
+
         Object referral = referrals.get( 0 );
-        
-        try 
+
+        try
         {
-			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
-		} 
-        catch (NamingException e)
+            assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+        }
+        catch ( NamingException e )
         {
-			fail();
-		}
+            fail();
+        }
     }
-    
+
+
     /**
      * Test parsing of a response with 2 Referral elements
      */
     public void testResponseWith2Referrals()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
+
             parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_2_referrals.xml" ).getFile() );
-        
+
             parser.parse();
         }
         catch ( Exception e )
@@ -288,49 +306,52 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         LdapResult ldapResult = searchResultDone.getLdapResult();
-        
+
         List referrals = ldapResult.getReferrals();
-        
+
         assertEquals( 2, referrals.size() );
-        
+
         Object referral = referrals.get( 0 );
-        
-        try 
+
+        try
+        {
+            assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+        }
+        catch ( NamingException e )
         {
-			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
-		} 
-        catch (NamingException e)
-        {
-			fail();
-		}
-        
+            fail();
+        }
+
         Object referral2 = referrals.get( 1 );
-        
-        try 
+
+        try
         {
-			assertEquals( new LdapURL( "ldap://www.apple.com/" ).toString(), referral2.toString() );
-		} 
-        catch (NamingException e)
+            assertEquals( new LdapURL( "ldap://www.apple.com/" ).toString(), referral2.toString() );
+        }
+        catch ( NamingException e )
         {
-			fail();
-		}
+            fail();
+        }
     }
-    
+
+
     /**
      * Test parsing of a response with a Referral and an Error Message
      */
     public void testResponseWith1ReferralAndAnErrorMessage()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_1_referral_and_error_message.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResultDoneTest.class.getResource(
+                "response_with_1_referral_and_error_message.xml" ).getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
@@ -338,38 +359,41 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         LdapResult ldapResult = searchResultDone.getLdapResult();
-        
+
         List referrals = ldapResult.getReferrals();
-        
+
         assertEquals( 1, referrals.size() );
-        
+
         Object referral = referrals.get( 0 );
-        
-        try 
+
+        try
         {
-			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
-		} 
-        catch (NamingException e)
+            assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+        }
+        catch ( NamingException e )
         {
-			fail();
-		}
+            fail();
+        }
     }
-    
+
+
     /**
      * Test parsing of a response with MatchedDN attribute
      */
     public void testResponseWithMatchedDNAttribute()
     {
-    	Dsmlv2ResponseParser parser = null;
+        Dsmlv2ResponseParser parser = null;
         try
         {
             parser = new Dsmlv2ResponseParser();
-            
-            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_matchedDN_attribute.xml" ).getFile() );
-        
+
+            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_matchedDN_attribute.xml" )
+                .getFile() );
+
             parser.parse();
         }
         catch ( Exception e )
@@ -377,26 +401,29 @@
             fail( e.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() ).getSearchResultDone();
-        
+        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
+            .getSearchResultDone();
+
         LdapResult ldapResult = searchResultDone.getLdapResult();
-        
+
         assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", ldapResult.getMatchedDN() );
     }
-    
+
+
     /**
      * Test parsing of a response with wrong matched DN
      */
     public void testResponseWithWrongMatchedDN()
     {
-        testParsingFail( SearchResultDoneTest.class, "response_with_wrong_matchedDN_attribute.xml");
+        testParsingFail( SearchResultDoneTest.class, "response_with_wrong_matchedDN_attribute.xml" );
     }
-    
+
+
     /**
      * Test parsing of a response with wrong Descr attribute
      */
     public void testResponseWithWrongDescr()
     {
-        testParsingFail( SearchResultDoneTest.class, "response_with_wrong_descr.xml");
+        testParsingFail( SearchResultDoneTest.class, "response_with_wrong_descr.xml" );
     }
 }



Mime
View raw message