You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/09/04 22:32:27 UTC

svn commit: r440176 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/messages/bind/BindRequestDecoratorTest.java

Author: elecharny
Date: Mon Sep  4 13:32:26 2006
New Revision: 440176

URL: http://svn.apache.org/viewvc?view=rev&rev=440176
Log:
Added a test for the Ber decorator

Added:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/messages/bind/BindRequestDecoratorTest.java

Added: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/messages/bind/BindRequestDecoratorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/messages/bind/BindRequestDecoratorTest.java?view=auto&rev=440176
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/messages/bind/BindRequestDecoratorTest.java (added)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/messages/bind/BindRequestDecoratorTest.java Mon Sep  4 13:32:26 2006
@@ -0,0 +1,60 @@
+/*
+ *  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.messages.bind;
+
+import org.apache.directory.shared.ldap.codec.asn1ber.messages.bind.BindRequestAsn1Ber;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.utils.StringTools;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ * Test the BindRequest decorator class
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class BindRequestDecoratorTest extends TestCase
+{
+    /**
+     * 
+     * Test that the BER decorator correctly compute the length
+     * of a SimpleAuthentication BindRequest
+     *
+     */
+    public void testBindRequestDecoratorSimple() 
+    {
+        BindRequestOperation bindRequest = new BindRequest( 1 );
+        
+        bindRequest.setName( new LdapDN() );
+        bindRequest.setVersion( 3 );
+        
+        SimpleAuthentication simpleAuthentication = new SimpleAuthentication();
+        simpleAuthentication.setSimple( StringTools.getBytesUtf8( "test" ) );
+        
+        bindRequest.setAuthentication( simpleAuthentication );
+        
+        BindRequestAsn1Ber bindRequestDecorator = new BindRequestAsn1Ber( bindRequest );
+        
+        int length = bindRequestDecorator.computeLength();
+        
+        assertEquals( 13, length );
+    }
+}