directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1064387 - in /directory/shared/trunk/dsml-parser/src: main/java/org/apache/directory/shared/dsmlv2/ main/java/org/apache/directory/shared/dsmlv2/request/ test/java/org/apache/directory/shared/dsmlv2/abandonRequest/ test/java/org/apache/dir...
Date Fri, 28 Jan 2011 00:40:31 GMT
Author: elecharny
Date: Fri Jan 28 00:40:30 2011
New Revision: 1064387

URL: http://svn.apache.org/viewvc?rev=1064387&view=rev
Log:
Made AddRequest tests working

Modified:
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/Dsmlv2Container.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/abandonRequest/AbandonRequestTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/addRequest/AddRequestTest.java

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/Dsmlv2Container.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/Dsmlv2Container.java?rev=1064387&r1=1064386&r2=1064387&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/Dsmlv2Container.java
(original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/Dsmlv2Container.java
Fri Jan 28 00:40:30 2011
@@ -49,9 +49,6 @@ public class Dsmlv2Container implements 
     /** The BatchRequest of the parsing */
     private BatchRequest batchRequest;
 
-    /** The BatchRequestDecorator of the parsing */
-    private BatchRequest batchRequestDecorator;
-
     /** The BatchResponse of the parsing */
     private BatchResponse batchResponse;
 
@@ -72,18 +69,6 @@ public class Dsmlv2Container implements 
 
 
     /**
-     * Gets the DSML Batch Request decorator
-     * 
-     * @return
-     *      Returns the Batch Request decorator
-     */
-    public BatchRequest getBatchRequestDecorator()
-    {
-        return batchRequestDecorator;
-    }
-
-
-    /**
      * Sets the DSML Batch Request
      * 
      * @param batchRequest
@@ -96,18 +81,6 @@ public class Dsmlv2Container implements 
 
 
     /**
-     * Sets the DSML Batch Request decorator
-     * 
-     * @param batchRequest decorator
-     *      the Batch Request decorator to set
-     */
-    public void setBatchRequestDecorator( BatchRequest batchRequest )
-    {
-        this.batchRequestDecorator = batchRequest;
-    }
-
-
-    /**
      * Gets the DSML Batch Response
      * 
      * @return

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java?rev=1064387&r1=1064386&r2=1064387&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
(original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
Fri Jan 28 00:40:30 2011
@@ -21,13 +21,14 @@ package org.apache.directory.shared.dsml
 
 
 import org.apache.directory.shared.dsmlv2.ParserUtils;
+import org.apache.directory.shared.ldap.codec.decorators.AddRequestDecorator;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.model.entry.Value;
-import org.apache.directory.shared.ldap.model.message.AddRequestImpl;
-import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.AddRequest;
+import org.apache.directory.shared.ldap.model.message.AddRequestImpl;
+import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.dom4j.Element;
 import org.dom4j.Namespace;
@@ -149,7 +150,7 @@ public class AddRequestDsml extends Abst
      */
     public void addAttributeType( String type ) throws LdapException
     {
-        ( ( AddRequest ) instance ).addAttributeType( type );
+        ( ( AddRequestDecorator ) instance ).addAttributeType( type );
     }
 
 
@@ -162,15 +163,15 @@ public class AddRequestDsml extends Abst
     {
         if ( value instanceof Value<?> )
         {
-            ( ( AddRequest ) instance ).addAttributeValue( (Value<?>) value );
+            ( ( AddRequestDecorator ) instance ).addAttributeValue( (Value<?>) value
);
         }
         else if ( value instanceof String )
         {
-            ( ( AddRequest ) instance ).addAttributeValue( ( String ) value );
+            ( ( AddRequestDecorator ) instance ).addAttributeValue( ( String ) value );
         }
         else if ( value instanceof byte[] )
         {
-            ( ( AddRequest ) instance ).addAttributeValue( ( byte[] ) value );
+            ( ( AddRequestDecorator ) instance ).addAttributeValue( ( byte[] ) value );
         }
     }
 
@@ -214,6 +215,6 @@ public class AddRequestDsml extends Abst
      */
     public String getCurrentAttributeType()
     {
-        return ( ( AddRequest ) instance ).getCurrentAttributeType();
+        return ( ( AddRequestDecorator ) instance ).getCurrentAttributeType();
     }
 }

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java?rev=1064387&r1=1064386&r2=1064387&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
(original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
Fri Jan 28 00:40:30 2011
@@ -41,7 +41,10 @@ import org.apache.directory.shared.dsmlv
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
+import org.apache.directory.shared.ldap.codec.decorators.AddRequestDecorator;
+import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.ModifyRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator;
 import org.apache.directory.shared.ldap.codec.search.AndFilter;
@@ -60,14 +63,12 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.filter.SearchScope;
 import org.apache.directory.shared.ldap.model.message.AbandonRequest;
 import org.apache.directory.shared.ldap.model.message.AbandonRequestImpl;
-import org.apache.directory.shared.ldap.model.message.AddRequest;
 import org.apache.directory.shared.ldap.model.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 import org.apache.directory.shared.ldap.model.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.model.message.CompareRequest;
 import org.apache.directory.shared.ldap.model.message.CompareRequestImpl;
-import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.DeleteRequest;
 import org.apache.directory.shared.ldap.model.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
@@ -1192,8 +1193,8 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            AddRequest addRequest = new AddRequestImpl();
-            container.getBatchRequest().addRequest( addRequest );
+            AddRequestDecorator addRequestDecorator = new AddRequestDecorator( new AddRequestImpl()
);
+            container.getBatchRequest().addRequest( addRequestDecorator );
 
             XmlPullParser xpp = container.getParser();
 
@@ -1203,7 +1204,7 @@ public final class Dsmlv2Grammar extends
             attributeValue = xpp.getAttributeValue( "", "requestID" );
             if ( attributeValue != null )
             {
-                addRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue,
xpp ) );
+                addRequestDecorator.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue,
xpp ) );
             }
             else
             {
@@ -1218,7 +1219,7 @@ public final class Dsmlv2Grammar extends
             {
                 try
                 {
-                    addRequest.setEntryDn( new Dn( attributeValue ) );
+                    addRequestDecorator.setEntryDn( new Dn( attributeValue ) );
                 }
                 catch ( LdapInvalidDnException e )
                 {
@@ -1239,7 +1240,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            AddRequest addRequest = ( AddRequest ) container.getBatchRequest().getCurrentRequest();
+            AddRequestDecorator addRequest = ( AddRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -1247,6 +1248,7 @@ public final class Dsmlv2Grammar extends
             String attributeValue;
             // name
             attributeValue = xpp.getAttributeValue( "", "name" );
+            
             if ( attributeValue != null )
             {
                 try
@@ -1272,9 +1274,10 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            AddRequest addRequest = ( AddRequest ) container.getBatchRequest().getCurrentRequest();
+            AddRequestDecorator addRequest = ( AddRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
+            
             try
             {
                 // We have to catch the type Attribute Value before going to the next Text
node
@@ -1743,10 +1746,8 @@ public final class Dsmlv2Grammar extends
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
             ModifyRequest modifyRequest = new ModifyRequestImpl();
-            container.getBatchRequest().addRequest( modifyRequest );
             ModifyRequestDecorator modifyRequestDecorator = new ModifyRequestDecorator( modifyRequest
);
-            container.setBatchRequestDecorator( new BatchRequest() );
-            container.getBatchRequestDecorator().addRequest( modifyRequestDecorator );
+            container.getBatchRequest().addRequest( modifyRequestDecorator );
 
             XmlPullParser xpp = container.getParser();
 
@@ -1795,7 +1796,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            ModifyRequestDecorator modifyRequest = ( ModifyRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            ModifyRequestDecorator modifyRequest = ( ModifyRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -1851,7 +1852,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            ModifyRequestDecorator modifyRequest = ( ModifyRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            ModifyRequestDecorator modifyRequest = ( ModifyRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -1888,10 +1889,8 @@ public final class Dsmlv2Grammar extends
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
             SearchRequest searchRequest = new SearchRequestImpl();
-            container.getBatchRequest().addRequest( searchRequest );
             SearchRequestDecorator searchRequestDecorator = new SearchRequestDecorator( searchRequest
);
-            container.setBatchRequestDecorator( new BatchRequest() );
-            container.getBatchRequestDecorator().addRequest( searchRequestDecorator );
+            container.getBatchRequest().addRequest( searchRequestDecorator );
 
             XmlPullParser xpp = container.getParser();
 
@@ -2085,7 +2084,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2126,7 +2125,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
 
@@ -2167,7 +2166,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
 
@@ -2207,7 +2206,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
 
@@ -2248,7 +2247,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             searchRequestDecorator.setTerminalFilter( null );
         }
@@ -2261,7 +2260,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2286,7 +2285,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             Filter filter = searchRequestDecorator.getCurrentFilter();
 
@@ -2301,7 +2300,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2326,7 +2325,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2351,7 +2350,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2395,7 +2394,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2439,7 +2438,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2485,7 +2484,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             XmlPullParser xpp = container.getParser();
 
@@ -2528,7 +2527,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = (SearchRequestDecorator)container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = (SearchRequestDecorator)container.getBatchRequest().getCurrentRequest();
             AttributeValueAssertionFilter filter = ( AttributeValueAssertionFilter ) searchRequestDecorator.getTerminalFilter();
             AttributeValueAssertion assertion = filter.getAssertion();
 
@@ -2575,7 +2574,7 @@ public final class Dsmlv2Grammar extends
             XmlPullParser xpp = container.getParser();
 
             // Adding the filter to the Search Filter
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             try
             {
@@ -2610,7 +2609,7 @@ public final class Dsmlv2Grammar extends
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
             // Adding the filter to the Search Filter
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
             SearchRequest searchRequest = searchRequestDecorator.getSearchRequest();
 
             searchRequest.setFilter( searchRequestDecorator.getFilterNode() );
@@ -2629,7 +2628,7 @@ public final class Dsmlv2Grammar extends
             XmlPullParser xpp = container.getParser();
 
             // Adding the filter to the Search Filter
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
 
             try
             {
@@ -2692,7 +2691,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequestDecorator().getCurrentRequest();
+            SearchRequestDecorator searchRequestDecorator = ( SearchRequestDecorator ) container.getBatchRequest().getCurrentRequest();
             ExtensibleMatchFilter filter = ( ExtensibleMatchFilter ) searchRequestDecorator.getTerminalFilter();
 
             XmlPullParser xpp = container.getParser();
@@ -2730,7 +2729,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            Control control = null;
+            ControlDecorator control = null;
 
             XmlPullParser xpp = container.getParser();
 
@@ -2746,7 +2745,7 @@ public final class Dsmlv2Grammar extends
                     throw new XmlPullParserException( I18n.err( I18n.ERR_03034 ), xpp, null
);
                 }
 
-                control = new ControlImpl( attributeValue );
+                control = new ControlDecorator( new ControlImpl( attributeValue ) );
                 container.getBatchRequest().getCurrentRequest().addControl( control );
             }
             else
@@ -2782,7 +2781,7 @@ public final class Dsmlv2Grammar extends
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {
-            Control control = container.getBatchRequest().getCurrentRequest().getCurrentControl();
+            ControlDecorator control = (ControlDecorator)((MessageDecorator)container.getBatchRequest().getCurrentRequest()).getCurrentControl();
 
             XmlPullParser xpp = container.getParser();
 

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/abandonRequest/AbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/abandonRequest/AbandonRequestTest.java?rev=1064387&r1=1064386&r2=1064387&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/abandonRequest/AbandonRequestTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/abandonRequest/AbandonRequestTest.java
Fri Jan 28 00:40:30 2011
@@ -23,9 +23,12 @@ package org.apache.directory.shared.dsml
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.util.Map;
+
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.dsmlv2.AbstractTest;
@@ -143,9 +146,13 @@ public class AbandonRequestTest extends 
         }
 
         AbandonRequest abandonRequest = (AbandonRequest) parser.getBatchRequest().getCurrentRequest();
-        Control control = abandonRequest.getCurrentControl();
+        Map<String, Control> controls = abandonRequest.getControls();
 
         assertEquals( 1, abandonRequest.getControls().size() );
+        
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertEquals( "Some text", Strings.utf8ToString((byte[]) control.getValue()) );
@@ -175,9 +182,13 @@ public class AbandonRequestTest extends 
         }
 
         AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = abandonRequest.getCurrentControl();
+        Map<String, Control> controls = abandonRequest.getControls();
 
         assertEquals( 1, abandonRequest.getControls().size() );
+        
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString((byte[]) control.getValue())
);
@@ -207,9 +218,13 @@ public class AbandonRequestTest extends 
         }
 
         AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = abandonRequest.getCurrentControl();
+        Map<String, Control> controls = abandonRequest.getControls();
 
         assertEquals( 1, abandonRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertFalse( control.hasValue() );
@@ -239,9 +254,13 @@ public class AbandonRequestTest extends 
         }
 
         AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = abandonRequest.getCurrentControl();
+        Map<String, Control> controls = abandonRequest.getControls();
 
         assertEquals( 2, abandonRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.789" );
+
+        assertNotNull( control );
         assertFalse( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
         assertEquals( "Some other text", Strings.utf8ToString((byte[]) control.getValue())
);
@@ -271,9 +290,13 @@ public class AbandonRequestTest extends 
         }
 
         AbandonRequest abandonRequest = ( AbandonRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = abandonRequest.getCurrentControl();
+        Map<String, Control> controls = abandonRequest.getControls();
 
         assertEquals( 3, abandonRequest.getControls().size() );
+
+        Control control = controls.get( "1.2.840.113556.1.4.456" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
         assertFalse( control.hasValue() );

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/addRequest/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/addRequest/AddRequestTest.java?rev=1064387&r1=1064386&r2=1064387&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/addRequest/AddRequestTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/addRequest/AddRequestTest.java
Fri Jan 28 00:40:30 2011
@@ -23,10 +23,12 @@ package org.apache.directory.shared.dsml
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
@@ -141,19 +143,20 @@ public class AddRequestTest extends Abst
         }
         catch ( Exception e )
         {
+            e.printStackTrace();
             fail( e.getMessage() );
         }
 
         AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
+        Map<String, Control> controls = addRequest.getControls();
 
         assertEquals( 1, addRequest.getControls().size() );
 
-        Control control = addRequest.getCurrentControl();
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
 
+        assertNotNull( control );
         assertTrue( control.isCritical() );
-
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
-
         assertEquals( "Some text", Strings.utf8ToString((byte[]) control.getValue()) );
     }
 
@@ -180,9 +183,13 @@ public class AddRequestTest extends Abst
         }
 
         AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = addRequest.getCurrentControl();
+        Map<String, Control> controls = addRequest.getControls();
 
         assertEquals( 1, addRequest.getControls().size() );
+        
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString((byte[]) control.getValue())
);
@@ -211,9 +218,13 @@ public class AddRequestTest extends Abst
         }
 
         AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = addRequest.getCurrentControl();
+        Map<String, Control> controls = addRequest.getControls();
 
         assertEquals( 1, addRequest.getControls().size() );
+        
+        Control control = controls.get( "1.2.840.113556.1.4.643" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
         assertFalse( control.hasValue() );
@@ -241,9 +252,13 @@ public class AddRequestTest extends Abst
         }
 
         AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = addRequest.getCurrentControl();
+        Map<String, Control> controls = addRequest.getControls();
 
         assertEquals( 2, addRequest.getControls().size() );
+        
+        Control control = controls.get( "1.2.840.113556.1.4.789" );
+
+        assertNotNull( control );
         assertFalse( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
         assertEquals( "Some other text", Strings.utf8ToString((byte[]) control.getValue())
);
@@ -272,9 +287,13 @@ public class AddRequestTest extends Abst
         }
 
         AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
-        Control control = addRequest.getCurrentControl();
+        Map<String, Control> controls = addRequest.getControls();
 
         assertEquals( 3, addRequest.getControls().size() );
+        
+        Control control = controls.get( "1.2.840.113556.1.4.456" );
+
+        assertNotNull( control );
         assertTrue( control.isCritical() );
         assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
         assertFalse( control.hasValue() );



Mime
View raw message