directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r494858 [2/2] - in /directory/trunks/ldapstudio/ldapstudio-dsml-parser: ./ src/main/java/org/apache/directory/ldapstudio/dsmlv2/ src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/ src/main/java/org/apache/directory/ldapstudio/dsml...
Date Wed, 10 Jan 2007 15:44:53 GMT
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/SearchRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/SearchRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/SearchRequestDsml.java
(added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/SearchRequestDsml.java
Wed Jan 10 07:44:50 2007
@@ -0,0 +1,337 @@
+/*
+ *  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.request;
+
+
+import java.util.List;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
+import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.search.AndFilter;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.NotFilter;
+import org.apache.directory.shared.ldap.codec.search.OrFilter;
+import org.apache.directory.shared.ldap.codec.search.PresentFilter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+
+
+/**
+ * DSML Decorator for SearchRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchRequestDsml extends AbstractRequestDsml
+{
+    /**
+     * Creates a new instance of SearchRequestDsml.
+     *
+     * @param ldapMessage
+     *      the message to decorate
+     */
+    public SearchRequestDsml( LdapMessage ldapMessage )
+    {
+        super( ldapMessage );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getMessageType()
+    {
+        return instance.getSearchRequest().getMessageType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Element toDsml( Element root )
+    {
+        Element element = super.toDsml( root );
+
+        SearchRequest request = instance.getSearchRequest();
+
+        // DN
+        if ( request.getBaseObject() != null )
+        {
+            element.addAttribute( "dn", request.getBaseObject().toString() );
+        }
+
+        // Scope
+        ScopeEnum scope = request.getScope();
+        if ( scope != null )
+        {
+            if ( scope == ScopeEnum.BASE_OBJECT )
+            {
+                element.addAttribute( "scope", "baseObject" );
+            }
+            else if ( scope == ScopeEnum.SINGLE_LEVEL )
+            {
+                element.addAttribute( "scope", "singleLevel" );
+            }
+            else if ( scope == ScopeEnum.WHOLE_SUBTREE )
+            {
+                element.addAttribute( "scope", "wholeSubtree" );
+            }
+        }
+
+        // DerefAliases
+        int derefAliases = request.getDerefAliases();
+        if ( derefAliases == LdapConstants.NEVER_DEREF_ALIASES )
+        {
+            element.addAttribute( "derefAliases", "neverDerefAliases" );
+        }
+        else if ( derefAliases == LdapConstants.DEREF_IN_SEARCHING )
+        {
+            element.addAttribute( "derefAliases", "derefInSearching" );
+        }
+        else if ( derefAliases == LdapConstants.DEREF_FINDING_BASE_OBJ )
+        {
+            element.addAttribute( "derefAliases", "derefFindingBaseObj" );
+        }
+        else if ( derefAliases == LdapConstants.DEREF_ALWAYS )
+        {
+            element.addAttribute( "derefAliases", "derefAlways" );
+        }
+
+        // SizeLimit
+        if ( request.getSizeLimit() != 0 )
+        {
+            element.addAttribute( "sizeLimit", "" + request.getSizeLimit() );
+        }
+
+        // TimeLimit
+        if ( request.getTimeLimit() != 0 )
+        {
+            element.addAttribute( "timeLimit", "" + request.getTimeLimit() );
+        }
+
+        // TypesOnly
+        if ( request.isTypesOnly() )
+        {
+            element.addAttribute( "typesOnly", "true" );
+        }
+
+        // Filter
+        toDsml( element, request.getFilter() );
+
+        // Attributes
+        Attributes attributes = request.getAttributes();
+        if ( attributes.size() > 0 )
+        {
+            Element attributesElement = element.addElement( "attributes" );
+
+            NamingEnumeration<String> ids = attributes.getIDs();
+            while ( ids.hasMoreElements() )
+            {
+                attributesElement.addElement( "attribute" ).addAttribute( "name", ids.nextElement()
);
+            }
+        }
+
+        return element;
+    }
+
+
+    /**
+     * Recursively converts the filter of the Search Request into a DSML representation and
adds 
+     * it to the XML Element corresponding to the Search Request
+     *
+     * @param element
+     *      the parent Element
+     * @param filter
+     *      the filter to convert
+     */
+    private void toDsml( Element element, Filter filter )
+    {
+        // AND FILTER
+        if ( filter instanceof AndFilter )
+        {
+            Element newElement = element.addElement( "and" );
+
+            List<Filter> filterList = ( ( AndFilter ) filter ).getAndFilter();
+            for ( int i = 0; i < filterList.size(); i++ )
+            {
+                toDsml( newElement, filterList.get( i ) );
+            }
+        }
+        
+        // OR FILTER
+        else if ( filter instanceof OrFilter )
+        {
+            Element newElement = element.addElement( "or" );
+
+            List<Filter> filterList = ( ( OrFilter ) filter ).getOrFilter();
+            for ( int i = 0; i < filterList.size(); i++ )
+            {
+                toDsml( newElement, filterList.get( i ) );
+            }
+        }
+        
+        // NOT FILTER
+        else if ( filter instanceof NotFilter )
+        {
+            Element newElement = element.addElement( "not" );
+
+            toDsml( newElement, ( ( NotFilter ) filter ).getNotFilter() );
+        }
+        
+        // SUBSTRING FILTER
+        else if ( filter instanceof SubstringFilter )
+        {
+            Element newElement = element.addElement( "substrings" );
+            
+            SubstringFilter substringFilter = ( SubstringFilter ) filter;
+            
+            newElement.addAttribute("name", substringFilter.getType() );
+            
+            String initial = substringFilter.getInitialSubstrings();
+            if ( ( initial != null ) && ( !"".equals( initial ) ) )
+            {
+                newElement.addElement( "initial" ).setText( initial );
+            }
+            
+            List<String> anyList = substringFilter.getAnySubstrings();
+            for ( int i = 0; i < anyList.size(); i++ )
+            {
+                newElement.addElement( "any" ).setText( anyList.get( i ) );
+            }
+            
+            String finalString = substringFilter.getFinalSubstrings();
+            if ( ( finalString != null ) && ( !"".equals( finalString ) ) )
+            {
+                newElement.addElement( "final" ).setText( finalString );
+            }
+        }
+        
+        // APPROXMATCH, EQUALITYMATCH, GREATEROREQUALS & LESSOREQUAL FILTERS
+        else if ( filter instanceof AttributeValueAssertionFilter )
+        {  
+            AttributeValueAssertionFilter avaFilter = ( AttributeValueAssertionFilter ) filter;
+            
+            Element newElement = null;
+            int filterType = avaFilter.getFilterType();
+            if ( filterType == LdapConstants.APPROX_MATCH_FILTER )
+            {
+                newElement = element.addElement( "approxMatch" );
+            }
+            else if ( filterType == LdapConstants.EQUALITY_MATCH_FILTER )
+            {
+                newElement = element.addElement( "equalityMatch" );
+            }
+            else if ( filterType == LdapConstants.GREATER_OR_EQUAL_FILTER )
+            {
+                newElement = element.addElement( "greaterOrEqual" );
+            }
+            else if ( filterType == LdapConstants.LESS_OR_EQUAL_FILTER )
+            {
+                newElement = element.addElement( "lessOrEqual" );
+            }
+            
+            AttributeValueAssertion assertion = avaFilter.getAssertion();
+            if ( assertion != null )
+            {
+                newElement.addAttribute( "name", assertion.getAttributeDesc() );
+                
+                Object value = assertion.getAssertionValue();
+                if ( value != null )
+                {
+                    if ( ParserUtils.needsBase64Encoding( value ) )
+                    {
+                        Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI
);
+                        Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI
);
+                        element.getDocument().getRootElement().add( xsdNamespace );
+                        element.getDocument().getRootElement().add( xsiNamespace );
+
+                        Element valueElement = 
+                            newElement.addElement( "value" ).addText(  ParserUtils.base64Encode(
value ) );
+                        valueElement
+                            .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY
);
+                    }
+                    else
+                    {
+                        newElement.addElement( "value" ).setText( (String)  value );
+                    }
+                }
+            }
+        }
+        
+        // PRESENT FILTER
+        else if ( filter instanceof PresentFilter )
+        {
+            Element newElement = element.addElement( "present" );
+            
+            newElement.addAttribute( "name", ( ( PresentFilter ) filter ).getAttributeDescription()
);
+        }
+        
+        // EXTENSIBLEMATCH
+        else if ( filter instanceof ExtensibleMatchFilter )
+        {
+            Element newElement = element.addElement( "extensibleMatch" );
+            
+            ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
+            
+            Object value = extensibleMatchFilter.getMatchValue();
+            if ( value != null )
+            {
+                if ( ParserUtils.needsBase64Encoding( value ) )
+                {
+                    Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI
);
+                    Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI
);
+                    element.getDocument().getRootElement().add( xsdNamespace );
+                    element.getDocument().getRootElement().add( xsiNamespace );
+
+                    Element valueElement = 
+                        newElement.addElement( "value" ).addText(  ParserUtils.base64Encode(
value ) );
+                    valueElement
+                        .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY
);
+                }
+                else
+                {
+                    newElement.addElement( "value" ).setText( (String)  value );
+                }
+            }
+            
+            if ( extensibleMatchFilter.isDnAttributes() )
+            {
+                newElement.addAttribute( "dnAttributes", "true" );
+            }
+            
+            String matchingRule = extensibleMatchFilter.getMatchingRule();
+            if ( ( matchingRule != null ) && ( "".equals( matchingRule ) ) )
+            {
+                newElement.addAttribute( "matchingRule", matchingRule );
+            }
+        }
+    }
+}

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -30,6 +30,7 @@
 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.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -246,7 +247,7 @@
 
         LdapResult ldapResult = addResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -30,6 +30,7 @@
 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.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -248,7 +249,7 @@
 
         LdapResult ldapResult = bindResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/compareResponse/CompareResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/compareResponse/CompareResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/compareResponse/CompareResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/compareResponse/CompareResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.compare.CompareResponse;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -248,7 +249,7 @@
 
         LdapResult ldapResult = compareResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/delResponse/DelResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/delResponse/DelResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/delResponse/DelResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/delResponse/DelResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.del.DelResponse;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -248,7 +249,7 @@
 
         LdapResult ldapResult = delResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/extendedResponse/ExtendedResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/extendedResponse/ExtendedResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/extendedResponse/ExtendedResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/extendedResponse/ExtendedResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -32,6 +32,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -250,7 +251,7 @@
 
         LdapResult ldapResult = extendedResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modDNResponse/ModifyDNResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modDNResponse/ModifyDNResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modDNResponse/ModifyDNResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modDNResponse/ModifyDNResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNResponse;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -248,7 +249,7 @@
 
         LdapResult ldapResult = modifyDNResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyRequest/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyRequest/ModifyRequestTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyRequest/ModifyRequestTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyRequest/ModifyRequestTest.java
Wed Jan 10 07:44:50 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.ldapstudio.dsmlv2.modifyRequest;
 
 
-import java.util.ArrayList;
+import java.util.List;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -32,6 +32,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -259,7 +260,7 @@
 
         assertEquals( "directreport", modifyRequest.getCurrentAttributeType() );
 
-        ArrayList modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 
@@ -296,7 +297,7 @@
 
         assertEquals( "directreport", modifyRequest.getCurrentAttributeType() );
 
-        ArrayList modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 
@@ -334,7 +335,7 @@
 
         assertEquals( "sn", modifyRequest.getCurrentAttributeType() );
 
-        ArrayList modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl>  modifications = modifyRequest.getModifications();
 
         assertEquals( 2, modifications.size() );
 
@@ -478,7 +479,7 @@
 
         assertEquals( "directreport", modifyRequest.getCurrentAttributeType() );
 
-        ArrayList modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl>  modifications = modifyRequest.getModifications();
 
         ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
 
@@ -515,7 +516,7 @@
 
         assertEquals( "directreport", modifyRequest.getCurrentAttributeType() );
 
-        ArrayList modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl>  modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 
@@ -556,7 +557,7 @@
 
         assertEquals( "directreport", modifyRequest.getCurrentAttributeType() );
 
-        ArrayList modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl>  modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyResponse/ModifyResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyResponse/ModifyResponseTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyResponse/ModifyResponseTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyResponse/ModifyResponseTest.java
Wed Jan 10 07:44:50 2007
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.modify.ModifyResponse;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -248,7 +249,7 @@
 
         LdapResult ldapResult = modifyResponse.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java
Wed Jan 10 07:44:50 2007
@@ -22,6 +22,7 @@
 
 
 import java.util.ArrayList;
+import java.util.List;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -42,6 +43,7 @@
 import org.apache.directory.shared.ldap.codec.search.PresentFilter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequest;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -308,7 +310,7 @@
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
 
-        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, searchRequest.getScope() );
+        assertEquals( ScopeEnum.BASE_OBJECT, searchRequest.getScope() );
     }
 
 
@@ -334,7 +336,7 @@
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
 
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, searchRequest.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, searchRequest.getScope() );
     }
 
 
@@ -361,7 +363,7 @@
 
         SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
 
-        assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, searchRequest.getScope() );
+        assertEquals( ScopeEnum.WHOLE_SUBTREE, searchRequest.getScope() );
     }
 
 
@@ -792,11 +794,11 @@
 
         Attribute attribute = ( Attribute ) ne.next();
 
-        assertEquals( "givenname", attribute.getID() );
+        assertEquals( "sn", attribute.getID() );
 
         attribute = ( Attribute ) ne.next();
 
-        assertEquals( "sn", attribute.getID() );
+        assertEquals( "givenName", attribute.getID() );
     }
 
 
@@ -1992,9 +1994,9 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        assertEquals( "jack", substringFilter.getInitialSubstrings().toString() );
+        assertEquals( "jack", substringFilter.getInitialSubstrings() );
 
-        ArrayList initials = substringFilter.getAnySubstrings();
+        List<String> initials = substringFilter.getAnySubstrings();
 
         assertEquals( 1, initials.size() );
 
@@ -2030,9 +2032,9 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        assertEquals( "jack", substringFilter.getInitialSubstrings().toString() );
+        assertEquals( "jack", substringFilter.getInitialSubstrings() );
 
-        assertEquals( "john", substringFilter.getFinalSubstrings().toString() );
+        assertEquals( "john", substringFilter.getFinalSubstrings() );
     }
 
 
@@ -2064,10 +2066,10 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        ArrayList initials = substringFilter.getAnySubstrings();
+        List<String>initials = substringFilter.getAnySubstrings();
 
         assertEquals( 1, initials.size() );
-        assertEquals( "kate", initials.get( 0 ).toString() );
+        assertEquals( "kate", initials.get( 0 ) );
     }
     
     /**
@@ -2098,10 +2100,10 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        ArrayList initials = substringFilter.getAnySubstrings();
+        List<String> initials = substringFilter.getAnySubstrings();
 
         assertEquals( 1, initials.size() );
-        assertEquals( "DSMLv2.0 rocks!!", initials.get( 0 ).toString() );
+        assertEquals( "DSMLv2.0 rocks!!", initials.get( 0 ) );
     }
 
 
@@ -2133,7 +2135,7 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        ArrayList initials = substringFilter.getAnySubstrings();
+        List<String> initials = substringFilter.getAnySubstrings();
 
         assertEquals( 0, initials.size() );
     }
@@ -2167,13 +2169,13 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        ArrayList initials = substringFilter.getAnySubstrings();
+        List<String> initials = substringFilter.getAnySubstrings();
 
         assertEquals( 2, initials.size() );
 
-        assertEquals( "kate", initials.get( 0 ).toString() );
+        assertEquals( "kate", initials.get( 0 ) );
 
-        assertEquals( "sawyer", initials.get( 1 ).toString() );
+        assertEquals( "sawyer", initials.get( 1 ) );
     }
 
 
@@ -2205,13 +2207,13 @@
 
         SubstringFilter substringFilter = ( SubstringFilter ) filter;
 
-        ArrayList initials = substringFilter.getAnySubstrings();
+        List<String> initials = substringFilter.getAnySubstrings();
 
         assertEquals( 1, initials.size() );
 
-        assertEquals( "kate", initials.get( 0 ).toString() );
+        assertEquals( "kate", initials.get( 0 ) );
 
-        assertEquals( "john", substringFilter.getFinalSubstrings().toString() );
+        assertEquals( "john", substringFilter.getFinalSubstrings() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
Wed Jan 10 07:44:50 2007
@@ -31,6 +31,7 @@
 import org.apache.directory.shared.ldap.codec.Control;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.search.SearchResultDone;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import com.sun.jndi.ldap.LdapURL;
@@ -254,7 +255,7 @@
 
         LdapResult ldapResult = searchResultDone.getLdapResult();
 
-        assertEquals( 2, ldapResult.getResultCode() );
+        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
     }
 
 

Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
Wed Jan 10 07:44:50 2007
@@ -549,7 +549,7 @@
 
         Attribute attribute = ( Attribute ) ne.nextElement();
 
-        assertEquals( "dc", attribute.getID() );
+        assertEquals( "objectclass", attribute.getID() );
 
         assertEquals( 1, attribute.size() );
 
@@ -565,11 +565,11 @@
 
         String value = ( String ) ne2.nextElement();
 
-        assertEquals( "example", value );
+        assertEquals( "top", value );
 
         attribute = ( Attribute ) ne.nextElement();
 
-        assertEquals( "objectclass", attribute.getID() );
+        assertEquals( "dc", attribute.getID() );
 
         assertEquals( 1, attribute.size() );
 
@@ -585,7 +585,7 @@
 
         value = ( String ) ne2.nextElement();
 
-        assertEquals( "top", value );
+        assertEquals( "example", value );
     }
 
 



Mime
View raw message