You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/11/16 17:38:51 UTC

svn commit: r475805 [8/17] - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/direct...

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,102 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.reponse;
+
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
+import org.dom4j.Element;
+
+
+/**
+ * DSML Decorator for SearchResultEntry
+ */
+public class SearchResultEntryDsml extends LdapResponseDecorator implements DsmlDecorator
+{
+    /**
+     * Default constructor
+     * @param ldapMessage the message to decorate
+     */
+    public SearchResultEntryDsml( LdapMessage ldapMessage )
+    {
+        super( ldapMessage );
+    }
+
+
+    /**
+     * Get the message type
+     * @return Returns the type.
+     */
+    public int getMessageType()
+    {
+        return instance.getSearchResultEntry().getMessageType();
+    }
+
+
+    /**
+     * Convert the request to its XML representation in the DSMLv2 format.
+     * @param root the root dom4j Element
+     * @return the dom4j Element corresponding to the entry.
+     */
+    public Element toDsml( Element root )
+    {
+        Element element = root.addElement( "searchResultEntry" );
+        SearchResultEntry searchResultEntry = instance.getSearchResultEntry();
+        element.addAttribute( "dn", searchResultEntry.getObjectName().toString() );
+
+        Attributes attributes = searchResultEntry.getPartialAttributeList();
+        NamingEnumeration ne = attributes.getAll();
+
+        // Looping on Attributes Enumeration
+        while ( ne.hasMoreElements() )
+        {
+            Attribute attribute = ( Attribute ) ne.nextElement();
+
+            Element attributeElement = element.addElement( "attr" );
+            attributeElement.addAttribute( "name", attribute.getID() );
+
+            // Loopint on Values Enumeration
+            try
+            {
+                NamingEnumeration ne2 = attribute.getAll();
+
+                while ( ne2.hasMoreElements() )
+                {
+                    String str = ne2.nextElement().toString();
+                    attributeElement.addElement( "value" ).addText( str );
+                }
+            }
+            catch ( NamingException e )
+            {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+
+        return element;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.reponse;
+
+
+import java.util.ArrayList;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
+import org.dom4j.Element;
+
+
+/**
+ * DSML Decorator for SearchResultReference
+ */
+public class SearchResultReferenceDsml extends LdapResponseDecorator implements DsmlDecorator
+{
+    /**
+     * Default constructor
+     * @param ldapMessage the message to decorate
+     */
+    public SearchResultReferenceDsml( LdapMessage ldapMessage )
+    {
+        super( ldapMessage );
+    }
+
+
+    /**
+     * Get the message type
+     * @return Returns the type.
+     */
+    public int getMessageType()
+    {
+        return instance.getSearchResultReference().getMessageType();
+    }
+
+
+    /**
+     * Convert the request to its XML representation in the DSMLv2 format.
+     * @param root the root dom4j Element
+     * @return the dom4j Element corresponding to the entry.
+     */
+    public Element toDsml( Element root )
+    {
+        Element element = root.addElement( "searchResultReference" );
+        SearchResultReference searchResultReference = instance.getSearchResultReference();
+
+        // Adding References
+        ArrayList refsList = searchResultReference.getSearchResultReferences();
+        for ( int i = 0; i < refsList.size(); i++ )
+        {
+            element.addElement( "ref" ).addText( refsList.get( i ).toString() );
+        }
+
+        return element;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/resources/org/apache/directory/ldapstudio/dsmlv2/engine/DSMLv2.xslt
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/resources/org/apache/directory/ldapstudio/dsmlv2/engine/DSMLv2.xslt?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/resources/org/apache/directory/ldapstudio/dsmlv2/engine/DSMLv2.xslt (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/resources/org/apache/directory/ldapstudio/dsmlv2/engine/DSMLv2.xslt Thu Nov 16 08:38:31 2006
@@ -0,0 +1,30 @@
+<xsl:stylesheet version="1.0" 
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="xml"/>
+   <xsl:param name="indent-increment" select="'   '" />
+
+   <xsl:template match="*">
+      <xsl:param name="indent" select="'&#xA;'"/>
+
+      <xsl:value-of select="$indent"/>
+      <xsl:copy>
+        <xsl:copy-of select="@*" />
+        <xsl:apply-templates>
+          <xsl:with-param name="indent"
+               select="concat($indent, $indent-increment)"/>
+        </xsl:apply-templates>
+        <xsl:if test="*">
+          <xsl:value-of select="$indent"/>
+        </xsl:if>
+      </xsl:copy>
+   </xsl:template>
+
+   <xsl:template match="comment()|processing-instruction()">
+      <xsl:copy />
+   </xsl:template>
+
+   <!-- WARNING: this is dangerous. Handle with care -->
+   <!-- <xsl:template match="text()[normalize-space(.)='']"/> -->
+
+</xsl:stylesheet>
\ No newline at end of file

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractResponseTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractResponseTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractResponseTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractResponseTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+public class AbstractResponseTest extends TestCase
+{
+    public void testParsingFail( Class testClass, String filename )
+    {
+        try
+        {
+            Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
+        
+            parser.setInput( testClass.getResource( filename ).getFile() );
+        
+            parser.parse( );
+        }
+        catch ( XmlPullParserException e )
+        {
+            assertTrue(e.getMessage(), true );
+            return;
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        fail();
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AbstractTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2Parser;
+import org.xmlpull.v1.XmlPullParserException;
+
+/**
+ * This is the Abstract TestCase that each test should extend.
+ */
+public class AbstractTest extends TestCase
+{
+    /**
+     * Asserts that parsing throws a correct XmlPullParserException due to an incorrect file
+     * @param testClass The orignal Test Class
+     * @param filename The filename of file to be parsed
+     */
+    public void testParsingFail( Class testClass, String filename )
+    {
+        try
+        {
+            Dsmlv2Parser parser = new Dsmlv2Parser();
+        
+            parser.setInputFile( testClass.getResource( filename ).getFile() );
+        
+            parser.parse( );
+        }
+        catch ( XmlPullParserException e )
+        {
+            assertTrue(e.getMessage(), true );
+            return;
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        fail();
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AllTests.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AllTests.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AllTests.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/AllTests.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.directory.ldapstudio.dsmlv2.abandonRequest.AbandonRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.addRequest.AddRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.addResponse.AddResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.authRequest.AuthRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.authResponse.AuthResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.batchRequest.BatchRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.batchResponse.BatchResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.compareRequest.CompareRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.compareResponse.CompareResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.delRequest.DelRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.delResponse.DelResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.errorResponse.ErrorResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.extendedRequest.ExtendedRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.extendedResponse.ExtendedResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.modDNRequest.ModifyDNRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.modDNResponse.ModifyDNResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.modifyRequest.ModifyRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.modifyResponse.ModifyResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.searchRequest.SearchRequestTest;
+import org.apache.directory.ldapstudio.dsmlv2.searchResponse.SearchResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.searchResponse.searchResultDone.SearchResultDoneTest;
+import org.apache.directory.ldapstudio.dsmlv2.searchResponse.searchResultEntry.SearchResultEntryTest;
+import org.apache.directory.ldapstudio.dsmlv2.searchResponse.searchResultReference.SearchResultReferenceTest;
+
+/**
+ * This is the complete Test Suite for DSMLv2 Parser (Request and Response)
+ */
+public class AllTests
+{
+    /**
+     * Lauches the Test Suite
+     * @return
+     */
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.directory.ldapstudio.dsmlv2.addRequest" );
+        //$JUnit-BEGIN$
+        suite.addTestSuite( AbandonRequestTest.class );
+        suite.addTestSuite( AddRequestTest.class );
+        suite.addTestSuite( AddResponseTest.class );
+        suite.addTestSuite( AuthRequestTest.class );
+        suite.addTestSuite( AuthResponseTest.class );
+        suite.addTestSuite( BatchRequestTest.class );
+        suite.addTestSuite( BatchResponseTest.class );
+        suite.addTestSuite( CompareRequestTest.class );
+        suite.addTestSuite( CompareResponseTest.class );
+        suite.addTestSuite( DelRequestTest.class );
+        suite.addTestSuite( DelResponseTest.class );
+        suite.addTestSuite( ErrorResponseTest.class );
+        suite.addTestSuite( ExtendedRequestTest.class );
+        suite.addTestSuite( ExtendedResponseTest.class );
+        suite.addTestSuite( ModifyDNRequestTest.class );
+        suite.addTestSuite( ModifyDNResponseTest.class );
+        suite.addTestSuite( ModifyRequestTest.class );
+        suite.addTestSuite( ModifyResponseTest.class );
+        suite.addTestSuite( SearchRequestTest.class );
+        suite.addTestSuite( SearchResponseTest.class );
+        suite.addTestSuite( SearchResultDoneTest.class );
+        suite.addTestSuite( SearchResultEntryTest.class );
+        suite.addTestSuite( SearchResultReferenceTest.class );
+        //$JUnit-END$
+        return suite;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/abandonRequest/AbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/abandonRequest/AbandonRequestTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/abandonRequest/AbandonRequestTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/abandonRequest/AbandonRequestTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,188 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.abandonRequest;
+
+import org.apache.directory.ldapstudio.dsmlv2.AbstractTest;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2Parser;
+import org.apache.directory.shared.ldap.codec.Control;
+import org.apache.directory.shared.ldap.codec.abandon.AbandonRequest;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * Tests for the Abandon Request parsing
+ */
+public class AbandonRequestTest extends AbstractTest
+{    
+    /**
+     * Test parsing of a request without the abandonID attribute
+     */
+    public void testRequestWithoutAbandonId()
+    {
+        testParsingFail( AbandonRequestTest.class, "request_without_abandonID_attribute.xml" );
+    }
+    
+    /**
+     * Test parsing of a request with the abandonID attribute
+     */
+    public void testRequestWithAbandonId()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AbandonRequestTest.class.getResource( "request_with_abandonID_attribute.xml" ).getFile() );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals(123, abandonRequest.getAbandonedMessageId() );
+    }
+    
+    /**
+     * Test parsing of a request with the (optional) requestID attribute
+     */
+    public void testRequestWithRequestId()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AbandonRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).getFile() );        
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 456, abandonRequest.getMessageId() );
+    }
+    
+    /**
+     * Test parsing of a request with a (optional) Control element
+     */
+    public void testRequestWith1Control()
+    {
+        Dsmlv2Parser parser = null;
+    
+        try
+        {
+            parser = new Dsmlv2Parser();
+        
+            parser.setInputFile( AbandonRequestTest.class.getResource( "request_with_1_control.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 1, abandonRequest.getControls().size() );
+        
+        Control control = abandonRequest.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 2 (optional) Control elements
+     */
+    public void testRequestWith2Controls()
+    {
+        Dsmlv2Parser parser = null;
+    
+        try
+        {
+            parser = new Dsmlv2Parser();
+        
+            parser.setInputFile( AbandonRequestTest.class.getResource( "request_with_2_controls.xml" ).getFile() );
+            
+            parser.parse( );
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 2, abandonRequest.getControls().size() );
+        
+        Control control = abandonRequest.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
+     */
+    public void testRequestWith3ControlsWithoutValue()
+    {
+        Dsmlv2Parser parser = null;
+    
+        try
+        {
+            parser = new Dsmlv2Parser();
+        
+            parser.setInputFile( AbandonRequestTest.class.getResource( "request_with_3_controls_without_value.xml" ).getFile() );
+            
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 3, abandonRequest.getControls().size() );
+        
+        Control control = abandonRequest.getCurrentControl();
+        
+        assertTrue( control.getCriticality() );
+        
+        assertEquals( "1.2.840.113556.1.4.456", control.getControlType() );
+        
+        assertEquals( StringTools.EMPTY_BYTES, control.getControlValue() );
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addRequest/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addRequest/AddRequestTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addRequest/AddRequestTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addRequest/AddRequestTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,456 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.addRequest;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.ldapstudio.dsmlv2.AbstractTest;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2Parser;
+import org.apache.directory.shared.ldap.codec.Control;
+import org.apache.directory.shared.ldap.codec.add.AddRequest;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * Tests for the Add Request parsing
+ */
+public class AddRequestTest extends AbstractTest
+{
+    /**
+     * Test parsing of a request without the dn attribute
+     */
+    public void testRequestWithoutDn()
+    {
+        testParsingFail( AddRequestTest.class, "request_without_dn_attribute.xml" );
+    }
+    
+    /**
+     * Test parsing of a request with the dn attribute
+     */
+    public void testRequestWithDn()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_dn_attribute.xml" ).getFile() );
+      
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", addRequest.getEntry().toString() );
+    }
+    
+    /**
+     * Test parsing of a request with the (optional) requestID attribute
+     */
+    public void testRequestWithRequestId()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 456, addRequest.getMessageId() );
+    }
+    
+
+    /**
+     * Test parsing of a request with a (optional) Control element
+     */
+    public void testRequestWith1Control()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_1_control.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 1, addRequest.getControls().size() );
+        
+        Control control = addRequest.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 2 (optional) Control elements
+     */
+    public void testRequestWith2Controls()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_2_controls.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 2, addRequest.getControls().size() );
+        
+        Control control = addRequest.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
+     */
+    public void testRequestWith3ControlsWithoutValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_3_controls_without_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 3, addRequest.getControls().size() );
+        
+        Control control = addRequest.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 with an Attr elements with value
+     */
+    public void testRequestWith1AttrWithoutValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_1_attr_with_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        Attributes attributes = addRequest.getAttributes();
+        
+        assertEquals( 1, attributes.size() );
+        
+        // Getting the Attribute       
+        NamingEnumeration ne = attributes.getAll();
+        
+        Attribute attribute = null;
+        try
+        {
+            attribute = ( Attribute ) ne.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "objectclass", attribute.getID() );
+    }
+    
+    /**
+     * Test parsing of a request with an Attr elements without value
+     */
+    public void testRequestWith1AttrWithValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_1_attr_without_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        Attributes attributes = addRequest.getAttributes();
+        
+        assertEquals( 1, attributes.size() );
+        
+        // Getting the Attribute       
+        NamingEnumeration ne = attributes.getAll();
+        
+        Attribute attribute = null;
+        try
+        {
+            attribute = ( Attribute ) ne.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "objectclass", attribute.getID() );
+        
+        // Getting the Value
+        NamingEnumeration ne2 = null;
+        try
+        {
+            ne2 = attribute.getAll();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        String value = null;
+        try
+        {
+            value = ( String ) ne2.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "top", value );
+    }
+    
+    /**
+     * Test parsing of a request with 2 Attr elements with value
+     */
+    public void testRequestWith2AttrWithValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_2_attr_with_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        Attributes attributes = addRequest.getAttributes();
+        
+        assertEquals( 1, attributes.size() );
+        
+        // Getting the Attribute       
+        NamingEnumeration ne = attributes.getAll();
+        
+        Attribute attribute = null;
+        try
+        {
+            attribute = ( Attribute ) ne.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "objectclass", attribute.getID() );
+        
+        // Getting the Value
+        NamingEnumeration ne2 = null;
+        try
+        {
+            ne2 = attribute.getAll();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        String value = null;
+        try
+        {
+            value = ( String ) ne2.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "top", value );
+        
+        try
+        {
+            value = ( String ) ne2.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "person", value );
+    }
+    
+    /**
+     * Test parsing of a request with 1 Attr element without attribute value
+     */
+    public void testRequestWith1AttrWithoutNameAttribute()
+    {
+        testParsingFail( AddRequestTest.class, "request_with_1_attr_without_name_attribute.xml");
+    }
+    
+
+    /**
+     * Test parsing of a request with 1 Attr element with 2 Values
+     */
+    public void testRequestWith1AttrWith2Values()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AddRequestTest.class.getResource( "request_with_1_attr_with_2_values.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        Attributes attributes = addRequest.getAttributes();
+        
+        assertEquals( 1, attributes.size() );
+        
+        // Getting the Attribute       
+        NamingEnumeration ne = attributes.getAll();
+        
+        Attribute attribute = null;
+        try
+        {
+            attribute = ( Attribute ) ne.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "objectclass", attribute.getID() );
+        
+        // Getting the Value
+        NamingEnumeration ne2 = null;
+        try
+        {
+            ne2 = attribute.getAll();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        String value = null;
+        try
+        {
+            value = ( String ) ne2.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "top", value );
+        
+        try
+        {
+            value = ( String ) ne2.next();
+        }
+        catch ( NamingException e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        assertEquals( "person", value );
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,402 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.addResponse;
+
+import java.util.List;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.ldapstudio.dsmlv2.AbstractResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
+import org.apache.directory.shared.ldap.codec.Control;
+import org.apache.directory.shared.ldap.codec.LdapResult;
+import org.apache.directory.shared.ldap.codec.add.AddResponse;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import com.sun.jndi.ldap.LdapURL;
+
+/**
+ * Tests for the Add Response parsing
+ */
+public class AddResponseTest extends AbstractResponseTest
+{
+    
+    
+    /**
+     * Test parsing of a Response with the (optional) requestID attribute
+     */
+    public void testResponseWithRequestId()
+    {
+        Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_requestID_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 456, addResponse.getMessageId() );
+    }
+    
+
+    /**
+     * Test parsing of a response with a (optional) Control element
+     */
+    public void testResponseWith1Control()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_1_control.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 1, addResponse.getControls().size() );
+        
+        Control control = addResponse.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;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_2_controls.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 2, addResponse.getControls().size() );
+        
+        Control control = addResponse.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;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_3_controls_without_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 3, addResponse.getControls().size() );
+        
+        Control control = addResponse.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 without Result Code element
+     */
+    public void testResponseWithoutResultCode()
+    {
+        testParsingFail( AddResponseTest.class, "response_without_result_code.xml");
+    }
+    
+    /**
+     * Test parsing of a response with Result Code element but a not integer value
+     */
+    public void testResponseWithResultCodeNotInteger()
+    {
+        testParsingFail( AddResponseTest.class, "response_with_result_code_not_integer.xml");
+    }
+    
+    /**
+     * Test parsing of a response with Result Code 
+     */
+    public void testResponseWithResultCode()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_result_code.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = addResponse.getLdapResult();
+        
+        assertEquals( 2, ldapResult.getResultCode() );
+    }
+    
+    /**
+     * Test parsing of a response with Error Message
+     */
+    public void testResponseWithErrorMessage()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_error_message.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = addResponse.getLdapResult();
+        
+        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;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_1_referral.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+        	fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = addResponse.getLdapResult();
+        
+        List referrals = ldapResult.getReferrals();
+        
+        assertEquals( 1, referrals.size() );
+        
+        Object referral = referrals.get( 0 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+    }
+    
+    /**
+     * Test parsing of a response with 2 Referral elements
+     */
+    public void testResponseWith2Referrals()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_2_referrals.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = addResponse.getLdapResult();
+        
+        List referrals = ldapResult.getReferrals();
+        
+        assertEquals( 2, referrals.size() );
+        
+        Object referral = referrals.get( 0 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+        
+        Object referral2 = referrals.get( 1 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apple.com/" ).toString(), referral2.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+    }
+    
+    /**
+     * Test parsing of a response with a Referral and an Error Message
+     */
+    public void testResponseWith1ReferralAndAnErrorMessage()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_1_referral_and_error_message.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = addResponse.getLdapResult();
+        
+        List referrals = ldapResult.getReferrals();
+        
+        assertEquals( 1, referrals.size() );
+        
+        Object referral = referrals.get( 0 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+    }
+    
+    /**
+     * Test parsing of a response with MatchedDN attribute
+     */
+    public void testResponseWithMatchedDNAttribute()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AddResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = addResponse.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( AddResponseTest.class, "response_with_wrong_matchedDN_attribute.xml");
+    }
+    
+    /**
+     * Test parsing of a response with wrong Descr attribute
+     */
+    public void testResponseWithWrongDescr()
+    {
+        testParsingFail( AddResponseTest.class, "response_with_wrong_descr.xml");
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authRequest/AuthRequestTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authRequest/AuthRequestTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authRequest/AuthRequestTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authRequest/AuthRequestTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,189 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.authRequest;
+
+import org.apache.directory.ldapstudio.dsmlv2.AbstractTest;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2Parser;
+import org.apache.directory.shared.ldap.codec.Control;
+import org.apache.directory.shared.ldap.codec.bind.BindRequest;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * Tests for the Auth Request parsing
+ */
+public class AuthRequestTest extends AbstractTest
+{ 
+    /**
+     * Test parsing of a request without the principal attribute
+     */
+    public void testRequestWithoutPrincipal()
+    {
+        testParsingFail( AuthRequestTest.class,"request_without_principal_attribute.xml" );
+    }
+    
+
+    /**
+     * Test parsing of a request with the principal attribute
+     */
+    public void testRequestWithPrincipal()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AuthRequestTest.class.getResource( "request_with_principal_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindRequest bindRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", bindRequest.getName().toString() );
+    }
+    
+
+    /**
+     * Test parsing of a request with the (optional) requestID attribute
+     */
+    public void testRequestWithRequestId()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AuthRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 456, abandonRequest.getMessageId() );
+    }
+
+
+    /**
+     * Test parsing of a request with a (optional) Control element
+     */
+    public void testRequestWith1Control()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AuthRequestTest.class.getResource( "request_with_1_control.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 1, abandonRequest.getControls().size() );
+        
+        Control control = abandonRequest.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 2 (optional) Control elements
+     */
+    public void testRequestWith2Controls()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AuthRequestTest.class.getResource( "request_with_2_controls.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 2, abandonRequest.getControls().size() );
+        
+        Control control = abandonRequest.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
+     */
+    public void testRequestWith3ControlsWithoutValue()
+    {
+        Dsmlv2Parser parser = null;
+        try
+        {
+            parser = new Dsmlv2Parser();
+            
+            parser.setInputFile( AuthRequestTest.class.getResource( "request_with_3_controls_without_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
+        
+        assertEquals( 3, abandonRequest.getControls().size() );
+        
+        Control control = abandonRequest.getCurrentControl();
+        
+        assertTrue( control.getCriticality() );
+        
+        assertEquals( "1.2.840.113556.1.4.456", control.getControlType() );
+        
+        assertEquals( StringTools.EMPTY_BYTES, control.getControlValue() );
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java Thu Nov 16 08:38:31 2006
@@ -0,0 +1,402 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.dsmlv2.authResponse;
+
+import java.util.List;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.ldapstudio.dsmlv2.AbstractResponseTest;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
+import org.apache.directory.shared.ldap.codec.Control;
+import org.apache.directory.shared.ldap.codec.LdapResult;
+import org.apache.directory.shared.ldap.codec.bind.BindResponse;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import com.sun.jndi.ldap.LdapURL;
+
+/**
+ * Tests for the Auth Response parsing
+ */
+public class AuthResponseTest extends AbstractResponseTest
+{
+    
+    
+    /**
+     * Test parsing of a Response with the (optional) requestID attribute
+     */
+    public void testResponseWithRequestId()
+    {
+        Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_requestID_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 456, bindResponse.getMessageId() );
+    }
+    
+
+    /**
+     * Test parsing of a response with a (optional) Control element
+     */
+    public void testResponseWith1Control()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_1_control.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 1, bindResponse.getControls().size() );
+        
+        Control control = bindResponse.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;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_2_controls.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+        
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 2, bindResponse.getControls().size() );
+        
+        Control control = bindResponse.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;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_3_controls_without_value.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        assertEquals( 3, bindResponse.getControls().size() );
+        
+        Control control = bindResponse.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 without Result Code element
+     */
+    public void testResponseWithoutResultCode()
+    {
+        testParsingFail( AuthResponseTest.class, "response_without_result_code.xml");
+    }
+    
+    /**
+     * Test parsing of a response with Result Code element but a not integer value
+     */
+    public void testResponseWithResultCodeNotInteger()
+    {
+        testParsingFail( AuthResponseTest.class, "response_with_result_code_not_integer.xml");
+    }
+    
+    /**
+     * Test parsing of a response with Result Code 
+     */
+    public void testResponseWithResultCode()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_result_code.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = bindResponse.getLdapResult();
+        
+        assertEquals( 2, ldapResult.getResultCode() );
+    }
+    
+    /**
+     * Test parsing of a response with Error Message
+     */
+    public void testResponseWithErrorMessage()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_error_message.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = bindResponse.getLdapResult();
+        
+        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;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_1_referral.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = bindResponse.getLdapResult();
+        
+        List referrals = ldapResult.getReferrals();
+        
+        assertEquals( 1, referrals.size() );
+        
+        Object referral = referrals.get( 0 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+    }
+    
+    /**
+     * Test parsing of a response with 2 Referral elements
+     */
+    public void testResponseWith2Referrals()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_2_referrals.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = bindResponse.getLdapResult();
+        
+        List referrals = ldapResult.getReferrals();
+        
+        assertEquals( 2, referrals.size() );
+        
+        Object referral = referrals.get( 0 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+        
+        Object referral2 = referrals.get( 1 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apple.com/" ).toString(), referral2.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+    }
+    
+    /**
+     * Test parsing of a response with a Referral and an Error Message
+     */
+    public void testResponseWith1ReferralAndAnErrorMessage()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_1_referral_and_error_message.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = bindResponse.getLdapResult();
+        
+        List referrals = ldapResult.getReferrals();
+        
+        assertEquals( 1, referrals.size() );
+        
+        Object referral = referrals.get( 0 );
+        
+        try 
+        {
+			assertEquals( new LdapURL( "ldap://www.apache.org/" ).toString(), referral.toString() );
+		} 
+        catch (NamingException e)
+        {
+			fail();
+		}
+    }
+    
+    /**
+     * Test parsing of a response with MatchedDN attribute
+     */
+    public void testResponseWithMatchedDNAttribute()
+    {
+    	Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser();
+            
+            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ).getFile() );
+        
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
+        
+        LdapResult ldapResult = bindResponse.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( AuthResponseTest.class, "response_with_wrong_matchedDN_attribute.xml");
+    }
+    
+    /**
+     * Test parsing of a response with wrong Descr attribute
+     */
+    public void testResponseWithWrongDescr()
+    {
+        testParsingFail( AuthResponseTest.class, "response_with_wrong_matchedDN_attribute.xml");
+    }
+}