You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/08/29 22:55:29 UTC

svn commit: r570930 [4/4] - in /directory/sandbox/akarasulu: refactoring-apacheds-trunk/ refactoring-apacheds-trunk/benchmarks/ refactoring-apacheds-trunk/bootstrap-plugin/src/main/resources/ refactoring-apacheds-trunk/core-unit/src/test/java/org/apach...

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSup2.schema
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSup2.schema?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSup2.schema (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSup2.schema Wed Aug 29 13:55:22 2007
@@ -1,3 +1,19 @@
+#############################################################################
+#    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.
+#############################################################################
 # =============================================================================
 #                ApacheDS schema for storing DNS zones in LDAP
 # =============================================================================

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupMany.schema
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupMany.schema?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupMany.schema (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupMany.schema Wed Aug 29 13:55:22 2007
@@ -1,3 +1,19 @@
+#############################################################################
+#    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.
+#############################################################################
 # =============================================================================
 #                ApacheDS schema for storing DNS zones in LDAP
 # =============================================================================

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupOne.schema
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupOne.schema?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupOne.schema (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/convert/src/test/resources/org/apache/directory/shared/converter/schema/testOCSupOne.schema Wed Aug 29 13:55:22 2007
@@ -1,3 +1,19 @@
+#############################################################################
+#    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.
+#############################################################################
 # =============================================================================
 #                ApacheDS schema for storing DNS zones in LDAP
 # =============================================================================

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java Wed Aug 29 13:55:22 2007
@@ -29,6 +29,16 @@
  */
 public interface SchemaConstants
 {
+    // Special attributes 1.1 , * and + for search operations
+    String NO_ATTRIBUTE = "1.1";
+    String[] NO_ATTRIBUTE_ARRAY = new String[]{ NO_ATTRIBUTE };
+    
+    String ALL_USER_ATTRIBUTES = "*";
+    String[] ALL_USER_ATTRIBUTES_ARRAY = new String[]{ ALL_USER_ATTRIBUTES };
+    
+    String ALL_OPERATIONAL_ATTRIBUTES = "+";
+    String[] ALL_OPERATIONAL_ATTRIBUTES_ARRAY = new String[]{ ALL_OPERATIONAL_ATTRIBUTES };
+    
     // ---- ObjectClasses -----------------------------------------------------
 	// Krb5Principal
     String KRB5_PRINCIPAL_OC = "krb5Principal";

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java Wed Aug 29 13:55:22 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.shared.ldap.codec.actions;
 
 
+import javax.naming.directory.Attributes;
+
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
@@ -62,20 +64,11 @@
         TLV tlv = ldapMessageContainer.getCurrentTLV();
         String attributeDescription = null;
 
-        byte[] value = null;
-
-        if ( tlv.getLength() == 0 )
+        if ( tlv.getLength() != 0 )
         {
-            value = new byte[]
-                { '*' };
+            attributeDescription = StringTools.utf8ToString( tlv.getValue().getData() );
+            searchRequest.addAttribute( attributeDescription );
         }
-        else
-        {
-            value = tlv.getValue().getData();
-        }
-
-        attributeDescription = StringTools.utf8ToString( value );
-        searchRequest.addAttribute( attributeDescription );
 
         // We can have an END transition
         ldapMessageContainer.grammarEndAllowed( true );

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java Wed Aug 29 13:55:22 2007
@@ -412,7 +412,7 @@
                 
                 // We have a special case with PresentFilter, which has not been 
                 // pushed on the stack, so we need to get its parent's parent
-                if ( localFilter instanceof Filter )
+                if ( localFilter instanceof PresentFilter )
                 {
                     filterParent = filterParent.getParent();
                 }

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java Wed Aug 29 13:55:22 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.shared.ldap.schema.syntax;
 
 

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java Wed Aug 29 13:55:22 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.shared.ldap.schema.syntax.parser;
 
 import java.io.StringReader;

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaLexer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaLexer.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaLexer.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaLexer.java Wed Aug 29 13:55:22 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.shared.ldap.schema.syntax.parser;
 
 import java.io.Reader;

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaParser.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaParser.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/ReusableAntlrSchemaParser.java Wed Aug 29 13:55:22 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.shared.ldap.schema.syntax.parser;
 
 import org.apache.directory.shared.ldap.schema.syntax.AntlrSchemaParser;

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java Wed Aug 29 13:55:22 2007
@@ -20,6 +20,8 @@
 
 package org.apache.directory.shared.ldap.sp;
 
+import java.io.Serializable;
+
 
 
 /**
@@ -28,8 +30,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev:$
  */
-public class LdapContextParameter
+public class LdapContextParameter implements Serializable
 {
+    private static final long serialVersionUID = -8703671542595407603L;
+    
     private String name;
 
     public LdapContextParameter( String name )
@@ -37,12 +41,7 @@
         this.name = name;
     }
     
-    public String getType()
-    {
-        return "$ldapContext";
-    }
-    
-    public Object getValue()
+    public String getValue()
     {
         return name;
     }

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java Wed Aug 29 13:55:22 2007
@@ -383,12 +383,7 @@
 
         Attributes attributes = sr.getAttributes();
 
-        assertEquals( 1, attributes.size() );
-
-        for ( int i = 0; i < attributes.size(); i++ )
-        {
-            assertNotNull( attributes.get( "*" ) );
-        }
+        assertEquals( 0, attributes.size() );
     }
 
 
@@ -670,11 +665,6 @@
 
         Attributes attributes = sr.getAttributes();
 
-        assertEquals( 1, attributes.size() );
-
-        for ( int i = 0; i < attributes.size(); i++ )
-        {
-            assertNull( attributes.get( "" ) );
-        }
+        assertEquals( 0, attributes.size() );
     }
 }

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java Wed Aug 29 13:55:22 2007
@@ -679,6 +679,172 @@
         }
     }
 
+    /**
+     * Test the decoding of a SearchRequest with an empty attribute. The search
+     * filter is : (objectclass=*)
+     */
+    public void testDecodeSearchRequestOneEmptyAttribute()
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x3F );
+        stream.put( new byte[]
+            { 0x30, 0x3D,                // LDAPMessage ::=SEQUENCE {
+                0x02, 0x01, 0x03,        // messageID MessageID
+                0x63, 0x38,              // CHOICE { ..., searchRequest SearchRequest, ...
+                                         // SearchRequest ::= APPLICATION[3] SEQUENCE {
+                  0x04, 0x12,            // baseObject LDAPDN,
+                    'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', 
+                  0x0A, 0x01, 0x00,      // scope ENUMERATED {
+                                         // baseObject (0),
+                                         // singleLevel (1),
+                                         // wholeSubtree (2) },
+                  0x0A, 0x01, 0x03,      // derefAliases ENUMERATED {
+                                         // neverDerefAliases (0),
+                                         // derefInSearching (1),
+                                         // derefFindingBaseObj (2),
+                                         // derefAlways (3) },
+                                         // sizeLimit INTEGER (0 .. maxInt), (infinite)
+                  0x02, 0x01, 0x00,      // timeLimit INTEGER (0 .. maxInt), (infinite)
+                  0x02, 0x01, 0x00, 
+                  0x01, 0x01,0x00,       // typesOnly
+                                         // BOOLEAN,
+                                         // (FALSE)
+                                         // filter Filter,
+                                         // Filter ::= CHOICE {
+                  ( byte ) 0x87, 0x0B,   // present [7] AttributeDescription,
+                    'o', 'b', 'j', 'e', 'c', 't', 'C', 'l', 'a', 's', 's',
+                                         // attributes AttributeDescriptionList }
+                  0x30, 0x06,            // AttributeDescriptionList ::= SEQUENCE OF
+                                         // AttributeDescription
+                    0x04, 0x02,          // Request for sn
+                      's', 'n', 
+                    0x04, 0x00           // Empty attribute
+            } );
+
+        stream.flip();
+
+        // Allocate a BindRequest Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            fail( de.getMessage() );
+        }
+
+        assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
+        
+        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        SearchRequest sr = message.getSearchRequest();
+
+        assertEquals( 3, message.getMessageId() );
+        assertEquals( "ou=users,ou=system", sr.getBaseObject().toString() );
+        assertEquals( ScopeEnum.BASE_OBJECT, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 0, sr.getSizeLimit() );
+        assertEquals( 0, sr.getTimeLimit() );
+        assertEquals( false, sr.isTypesOnly() );
+
+        // (objectClass = *)
+        PresentFilter presentFilter = ( PresentFilter ) sr.getFilter();
+        assertNotNull( presentFilter );
+        assertEquals( "objectClass", presentFilter.getAttributeDescription() );
+
+        // The attributes
+        Attributes attributes = sr.getAttributes();
+
+        assertEquals( 1, attributes.size() );
+    }
+
+    /**
+     * Test the decoding of a SearchRequest with a star and an attribute. The search
+     * filter is : (objectclass=*)
+     */
+    public void testDecodeSearchRequestWithStarAndAttr()
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x40 );
+        stream.put( new byte[]
+            { 0x30, 0x3E,                // LDAPMessage ::=SEQUENCE {
+                0x02, 0x01, 0x03,        // messageID MessageID
+                0x63, 0x39,              // CHOICE { ..., searchRequest SearchRequest, ...
+                                         // SearchRequest ::= APPLICATION[3] SEQUENCE {
+                  0x04, 0x12,            // baseObject LDAPDN,
+                    'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', 
+                  0x0A, 0x01, 0x00,      // scope ENUMERATED {
+                                         // baseObject (0),
+                                         // singleLevel (1),
+                                         // wholeSubtree (2) },
+                  0x0A, 0x01, 0x03,      // derefAliases ENUMERATED {
+                                         // neverDerefAliases (0),
+                                         // derefInSearching (1),
+                                         // derefFindingBaseObj (2),
+                                         // derefAlways (3) },
+                                         // sizeLimit INTEGER (0 .. maxInt), (infinite)
+                  0x02, 0x01, 0x00,      // timeLimit INTEGER (0 .. maxInt), (infinite)
+                  0x02, 0x01, 0x00, 
+                  0x01, 0x01,0x00,       // typesOnly
+                                         // BOOLEAN,
+                                         // (FALSE)
+                                         // filter Filter,
+                                         // Filter ::= CHOICE {
+                  ( byte ) 0x87, 0x0B,   // present [7] AttributeDescription,
+                    'o', 'b', 'j', 'e', 'c', 't', 'C', 'l', 'a', 's', 's',
+                                         // attributes AttributeDescriptionList }
+                  0x30, 0x07,            // AttributeDescriptionList ::= SEQUENCE OF
+                                         // AttributeDescription
+                    0x04, 0x02,          // Request for sn
+                      's', 'n', 
+                    0x04, 0x01, '*'      // * attribute
+            } );
+
+        stream.flip();
+
+        // Allocate a BindRequest Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            fail( de.getMessage() );
+        }
+
+        assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
+        
+        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        SearchRequest sr = message.getSearchRequest();
+
+        assertEquals( 3, message.getMessageId() );
+        assertEquals( "ou=users,ou=system", sr.getBaseObject().toString() );
+        assertEquals( ScopeEnum.BASE_OBJECT, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 0, sr.getSizeLimit() );
+        assertEquals( 0, sr.getTimeLimit() );
+        assertEquals( false, sr.isTypesOnly() );
+
+        // (objectClass = *)
+        PresentFilter presentFilter = ( PresentFilter ) sr.getFilter();
+        assertNotNull( presentFilter );
+        assertEquals( "objectClass", presentFilter.getAttributeDescription() );
+
+        // The attributes
+        Attributes attributes = sr.getAttributes();
+
+        assertEquals( 2, attributes.size() );
+        assertNotNull( attributes.get( "sn" ) );
+        assertNotNull( attributes.get( "*" ) );
+    }        
+
 
     /**
      * Tests an search request decode with a simple equality match filter.
@@ -2459,14 +2625,26 @@
     public void testDecodeSearchRequestEmptyGreaterOrEqualEmptyAttrValueEmpty()
     {
         byte[] asn1BER = new byte[]
-            { 0x30, 0x43, 0x02, 0x01, 0x04, // messageID
-                0x63, 0x3E, 0x04, 0x1F, // baseObject LDAPDN,
-                'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 0x0A, 0x01, 0x01, 0x0A, 0x01, 0x03, 0x02, 0x01,
-                0x00, 0x02, 0x01, 0x00, 0x01, 0x01, ( byte ) 0xFF, ( byte ) 0xA5, 0x08, 0x04, 0x04, 't', 'e', 's', 't',
-                0x04, 0x00, 0x30, 0x02, // AttributeDescriptionList ::= SEQUENCE
-                                        // OF AttributeDescription
-                0x04, 0x00 };
+            { 
+            0x30, 0x43, 
+              0x02, 0x01, 0x04, // messageID
+              0x63, 0x3E, 
+                0x04, 0x1F,     // baseObject LDAPDN,
+                  'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
+                  'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                0x0A, 0x01, 0x01, 
+                0x0A, 0x01, 0x03, 
+                0x02, 0x01, 0x00, 
+                0x02, 0x01, 0x00, 
+                0x01, 0x01, (byte) 0xFF, 
+                (byte) 0xA5, 0x08, 
+                0x04, 0x04, 
+                  't', 'e', 's', 't',
+                0x04, 0x00, 
+                0x30, 0x02,     // AttributeDescriptionList ::= SEQUENCE
+                                // OF AttributeDescription
+                  0x04, 0x00 
+            };
 
         Asn1Decoder ldapDecoder = new LdapDecoder();
 
@@ -2512,12 +2690,7 @@
 
         Attributes attributes = sr.getAttributes();
 
-        assertEquals( 1, attributes.size() );
-
-        for ( int i = 0; i < attributes.size(); i++ )
-        {
-            assertNotNull( attributes.get( "*" ) );
-        }
+        assertEquals( 0, attributes.size() );
     }
 
 

Modified: directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/resources/log4j.properties?rev=570930&r1=570929&r2=570930&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/resources/log4j.properties (original)
+++ directory/sandbox/akarasulu/refactoring-shared-trunk/ldap/src/test/resources/log4j.properties Wed Aug 29 13:55:22 2007
@@ -1,3 +1,19 @@
+#############################################################################
+#    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.
+#############################################################################
 log4j.rootCategory=OFF, stdout
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender