directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r752915 - in /directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended: ./ operations/
Date Thu, 12 Mar 2009 16:11:44 GMT
Author: elecharny
Date: Thu Mar 12 16:11:42 2009
New Revision: 752915

URL: http://svn.apache.org/viewvc?rev=752915&view=rev
Log:
o Switched to Junit 4.4 for all the Extended tests
o Added tests for the CancelRequest operation

Added:
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/CancelTest.java
Modified:
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java?rev=752915&r1=752914&r2=752915&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java
Thu Mar 12 16:11:42 2009
@@ -33,8 +33,11 @@
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequest;
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Test;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -42,11 +45,12 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ExtendedRequestTest extends TestCase
+public class ExtendedRequestTest
 {
     /**
      * Test the decoding of a full ExtendedRequest
      */
+    @Test
     public void testDecodeExtendedRequestSuccess()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -113,6 +117,7 @@
     /**
      * Test the decoding of a full ExtendedRequest with controls
      */
+    @Test
     public void testDecodeExtendedRequestWithControls()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -194,6 +199,7 @@
      * Test the decoding of a full ExtendedRequest with no value and with
      * controls
      */
+    @Test
     public void testDecodeExtendedRequestNoValueWithControls()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -274,6 +280,7 @@
     /**
      * Test the decoding of an empty ExtendedRequest
      */
+    @Test
     public void testDecodeExtendedRequestEmpty()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -309,6 +316,7 @@
     /**
      * Test the decoding of an empty OID
      */
+    @Test
     public void testDecodeEmptyOID()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -344,6 +352,7 @@
     /**
      * Test the decoding of a bad name 
      */
+    @Test
     public void testDecodeExtendedBadRequestName()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -381,6 +390,7 @@
     /**
      * Test the decoding of a name only ExtendedRequest
      */
+    @Test
     public void testDecodeExtendedRequestName()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -445,6 +455,7 @@
     /**
      * Test the decoding of an empty name ExtendedRequest
      */
+    @Test
     public void testDecodeExtendedRequestEmptyName()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java?rev=752915&r1=752914&r2=752915&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
Thu Mar 12 16:11:42 2009
@@ -34,8 +34,11 @@
 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 org.junit.Test;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -43,11 +46,12 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ExtendedResponseTest extends TestCase
+public class ExtendedResponseTest
 {
     /**
      * Test the decoding of a full ExtendedResponse
      */
+    @Test
     public void testDecodeExtendedResponseSuccess()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -123,6 +127,7 @@
     /**
      * Test the decoding of a full ExtendedResponse with controls
      */
+    @Test
     public void testDecodeExtendedResponseSuccessWithControls()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -217,6 +222,7 @@
     /**
      * Test the decoding of a ExtendedRequest with no name
      */
+    @Test
     public void testDecodeExtendedRequestNoName()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -288,6 +294,7 @@
     /**
      * Test the decoding of a ExtendedRequest with no name and a control
      */
+    @Test
     public void testDecodeExtendedRequestNoNameWithControls()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -370,6 +377,7 @@
     /**
      * Test the decoding of an empty ExtendedResponse
      */
+    @Test
     public void testDecodeExtendedResponseEmpty()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -404,6 +412,7 @@
     /**
      * Test the decoding of an ExtendedResponse with an empty ResponseName
      */
+    @Test
     public void testDecodeExtendedResponseEmptyResponseName()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -447,6 +456,7 @@
     /**
      * Test the decoding of an ExtendedResponse with a bad responseName
      */
+    @Test
     public void testDecodeExtendedResponseBadOIDResponseName()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -490,6 +500,7 @@
     /**
      * Test the decoding of an ExtendedResponse with no response
      */
+    @Test
     public void testDecodeExtendedResponseNoResponse()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -563,6 +574,7 @@
     /**
      * Test the decoding of an ExtendedResponse with no response with controls
      */
+    @Test
     public void testDecodeExtendedResponseNoResponseWithControls()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -648,6 +660,7 @@
     /**
      * Test the decoding of an ExtendedResponse with an empty response
      */
+    @Test
     public void testDecodeExtendedResponseEmptyResponse()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -723,6 +736,7 @@
      * Test the decoding of an ExtendedResponse with an empty response with
      * controls
      */
+    @Test
     public void testDecodeExtendedResponseEmptyResponseWithControls()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();

Added: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/CancelTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/CancelTest.java?rev=752915&view=auto
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/CancelTest.java
(added)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/CancelTest.java
Thu Mar 12 16:11:42 2009
@@ -0,0 +1,227 @@
+/*
+ *  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.codec.extended.operations;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.codec.extended.operations.cancel.Cancel;
+import org.apache.directory.shared.ldap.codec.extended.operations.cancel.CancelContainer;
+import org.apache.directory.shared.ldap.codec.extended.operations.cancel.CancelDecoder;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
+/*
+ * TestCase for a Cancel Extended Operation
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CancelTest
+{
+	/**
+	 * Test the normal Cancel message
+	 */
+	@Test
+    public void testDecodeCancel()
+    {
+        Asn1Decoder cancelDecoder = new CancelDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x05 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x03,
+                    0x02, 0x01, 0x01
+            } ).flip();
+
+        String decodedPdu = StringTools.dumpBytes( stream.array() );
+
+        // Allocate a Cancel Container
+        IAsn1Container cancelContainer = new CancelContainer();
+
+        // Decode a Cancel message
+        try
+        {
+        	cancelDecoder.decode( stream, cancelContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            fail( de.getMessage() );
+        }
+
+        Cancel cancel = ( ( CancelContainer ) cancelContainer ).getCancel();
+
+        assertEquals( 1, cancel.getCancelId() );
+
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = cancel.encode( null );
+
+            String encodedPdu = StringTools.dumpBytes( bb.array() );
+
+            assertEquals( encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            fail( ee.getMessage() );
+        }
+    }
+
+	
+	/**
+	 * Test a Cancel message with no cancelId
+	 */
+	@Test
+    public void testDecodeCancelNoCancelId()
+    {
+        Asn1Decoder cancelDecoder = new CancelDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x02 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x00
+            } ).flip();
+
+        // Allocate a Cancel Container
+        IAsn1Container cancelContainer = new CancelContainer();
+        
+        // Decode a Cancel message
+        try
+        {
+        	cancelDecoder.decode( stream, cancelContainer );
+        	fail( "CancelID expected" );
+        }
+        catch ( DecoderException de )
+        {
+        	assertTrue( true );
+        }
+    }
+
+	
+	/**
+	 * Test a Cancel message with an empty cancelId
+	 */
+	@Test
+    public void testDecodeCancelEmptyCancelId()
+    {
+        Asn1Decoder cancelDecoder = new CancelDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x04 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x02,
+                  0x02, 0x00
+            } ).flip();
+
+        // Allocate a Cancel Container
+        IAsn1Container cancelContainer = new CancelContainer();
+
+        // Decode a Cancel message
+        try
+        {
+        	cancelDecoder.decode( stream, cancelContainer );
+        	fail( "CancelID expected" );
+        }
+        catch ( DecoderException de )
+        {
+        	assertTrue( true );
+        }
+    }
+
+	
+	/**
+	 * Test a Cancel message with a bad cancelId
+	 */
+	@Test
+    public void testDecodeCancelBadCancelId()
+    {
+        Asn1Decoder cancelDecoder = new CancelDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x08 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x06,
+                  0x02, 0x04, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF
+            } ).flip();
+
+        // Allocate a Cancel Container
+        IAsn1Container cancelContainer = new CancelContainer();
+
+        // Decode a Cancel message
+        try
+        {
+        	cancelDecoder.decode( stream, cancelContainer );
+        	fail( "CancelID expected" );
+        }
+        catch ( DecoderException de )
+        {
+        	assertTrue( true );
+        }
+    }
+
+	
+	/**
+	 * Test a Cancel message with more than one cancelId
+	 */
+	@Test
+    public void testDecodeCancelMoreThanOneCancelId()
+    {
+        Asn1Decoder cancelDecoder = new CancelDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x08 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x06,
+                  0x02, 0x01, 0x01,
+                  0x02, 0x01, 0x02
+            } ).flip();
+
+        // Allocate a Cancel Container
+        IAsn1Container cancelContainer = new CancelContainer();
+
+        // Decode a Cancel message
+        try
+        {
+        	cancelDecoder.decode( stream, cancelContainer );
+        	fail( "CancelID expected" );
+        }
+        catch ( DecoderException de )
+        {
+        	assertTrue( true );
+        }
+    }
+}

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java?rev=752915&r1=752914&r2=752915&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java
Thu Mar 12 16:11:42 2009
@@ -31,8 +31,9 @@
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -40,7 +41,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class GracefulDisconnectTest extends TestCase
+public class GracefulDisconnectTest
 {
     /**
      * Test the decoding of a GracefulDisconnect
@@ -76,7 +77,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();
@@ -132,7 +133,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();
@@ -186,7 +187,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();
@@ -241,7 +242,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();
@@ -303,7 +304,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();
@@ -358,7 +359,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownTest.java?rev=752915&r1=752914&r2=752915&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownTest.java
Thu Mar 12 16:11:42 2009
@@ -29,10 +29,11 @@
 import org.apache.directory.shared.ldap.codec.extended.operations.gracefulShutdown.GracefulShutdown;
 import org.apache.directory.shared.ldap.codec.extended.operations.gracefulShutdown.GracefulShutdownContainer;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.junit.Test;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 
 /**
@@ -40,7 +41,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class GracefulShutdownTest extends TestCase
+public class GracefulShutdownTest
 {
     /**
      * Test the decoding of a GracefulShutdown
@@ -70,7 +71,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
@@ -122,7 +123,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
@@ -175,7 +176,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
@@ -226,7 +227,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
@@ -280,7 +281,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
@@ -334,7 +335,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
@@ -390,7 +391,7 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         GracefulShutdown gracefulShutdown = container.getGracefulShutdown();

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java?rev=752915&r1=752914&r2=752915&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java
Thu Mar 12 16:11:42 2009
@@ -23,9 +23,6 @@
 
 import java.nio.ByteBuffer;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -35,6 +32,9 @@
 import org.apache.directory.shared.ldap.codec.extended.operations.storedProcedure.StoredProcedureDecoder;
 import org.apache.directory.shared.ldap.codec.extended.operations.storedProcedure.StoredProcedure.StoredProcedureParameter;
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 
 /*
@@ -42,8 +42,9 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoredProcedureTest extends TestCase
+public class StoredProcedureTest
 {
+	@Test
     public void testDecodeStoredProcedureNParams()
     {
         Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
@@ -81,31 +82,31 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer
).getStoredProcedure();
 
-        Assert.assertEquals("Java", storedProcedure.getLanguage());
+        assertEquals("Java", storedProcedure.getLanguage());
         
-        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure()
) );
+        assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure()
) );
 
-        Assert.assertEquals( 3, storedProcedure.getParameters().size() );
+        assertEquals( 3, storedProcedure.getParameters().size() );
 
         StoredProcedureParameter param = storedProcedure.getParameters().get( 0 );
 
-        Assert.assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( 1, param.getValue()[0] );
+        assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
+        assertEquals( 1, param.getValue()[0] );
 
         param = storedProcedure.getParameters().get( 1 );
 
-        Assert.assertEquals( "boolean", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( "true", StringTools.utf8ToString( param.getValue() ) );
+        assertEquals( "boolean", StringTools.utf8ToString( param.getType() ) );
+        assertEquals( "true", StringTools.utf8ToString( param.getValue() ) );
 
         param = storedProcedure.getParameters().get( 2 );
 
-        Assert.assertEquals( "String", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( "parameter3", StringTools.utf8ToString( param.getValue() ) );
+        assertEquals( "String", StringTools.utf8ToString( param.getType() ) );
+        assertEquals( "parameter3", StringTools.utf8ToString( param.getValue() ) );
 
         // Check the encoding
         try
@@ -123,6 +124,7 @@
         }
     }
 
+	@Test
     public void testDecodeStoredProcedureNoParam()
     {
         Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
@@ -151,16 +153,16 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer
).getStoredProcedure();
 
-        Assert.assertEquals("Java", storedProcedure.getLanguage());
+        assertEquals("Java", storedProcedure.getLanguage());
         
-        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure()
) );
+        assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure()
) );
 
-        Assert.assertEquals( 0, storedProcedure.getParameters().size() );
+        assertEquals( 0, storedProcedure.getParameters().size() );
         
         // Check the encoding
         try
@@ -178,6 +180,8 @@
         }
     }
 
+	
+	@Test
     public void testDecodeStoredProcedureOneParam()
     {
         Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
@@ -209,21 +213,21 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
 
         StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer
).getStoredProcedure();
 
-        Assert.assertEquals("Java", storedProcedure.getLanguage());
+        assertEquals("Java", storedProcedure.getLanguage());
         
-        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure()
) );
+        assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure()
) );
 
-        Assert.assertEquals( 1, storedProcedure.getParameters().size() );
+        assertEquals( 1, storedProcedure.getParameters().size() );
 
         StoredProcedureParameter param = storedProcedure.getParameters().get( 0 );
 
-        Assert.assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( 1, param.getValue()[0] );
+        assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
+        assertEquals( 1, param.getValue()[0] );
 
         // Check the encoding
         try



Mime
View raw message