directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 9609 - in incubator/directory: eve/trunk/eve/frontend/decoder/merlin-impl/src/test/org/apache/eve/decoder/impl eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl eve/trunk/eve/frontend/processor/merlin-impl/src/test/org/apache/eve/processor/impl eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl eve/trunk/eve/frontend/processor/spi/src/java/org/apache/eve/processor snickers/trunk/ber/src/java/org/apache/snickers snickers/trunk/ber/src/test/org/apache/snickers snickers/trunk/ber/src/test/org/apache/snickers/ber snickers/trunk/codec-stateful/src/java/org/apache/commons/codec/stateful
Date Fri, 19 Mar 2004 07:08:47 GMT
Author: akarasulu
Date: Thu Mar 18 23:08:46 2004
New Revision: 9609

Added:
   incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultHandlerRegistry.java
Modified:
   incubator/directory/eve/trunk/eve/frontend/decoder/merlin-impl/src/test/org/apache/eve/decoder/impl/MerlinDecoderManagerTest.java
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
   incubator/directory/eve/trunk/eve/frontend/processor/merlin-impl/src/test/org/apache/eve/processor/impl/MerlinRequestProcessorTest.java
   incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultRequestProcessor.java
   incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/SearchHandler.java
   incubator/directory/eve/trunk/eve/frontend/processor/spi/src/java/org/apache/eve/processor/ManyReplyHandler.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/SnickersDecoder.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/SnickersDecoderTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/EncodeDecodeTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/LdapMessageTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
   incubator/directory/snickers/trunk/codec-stateful/src/java/org/apache/commons/codec/stateful/DecoderMonitorAdapter.java
Log:
more cleanup

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/merlin-impl/src/test/org/apache/eve/decoder/impl/MerlinDecoderManagerTest.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/merlin-impl/src/test/org/apache/eve/decoder/impl/MerlinDecoderManagerTest.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/merlin-impl/src/test/org/apache/eve/decoder/impl/MerlinDecoderManagerTest.java
Thu Mar 18 23:08:46 2004
@@ -16,7 +16,6 @@
  */
 package org.apache.eve.decoder.impl;
 
-import java.math.BigInteger;
 import java.nio.ByteBuffer;
 
 import org.apache.avalon.merlin.unit.AbstractMerlinTestCase ;
@@ -72,9 +71,8 @@
     
     public void testDecoderByteBuffer() throws Exception
     {
-        AbandonRequestImpl req = new AbandonRequestImpl( 
-                new BigInteger( "7" ) ) ;
-        req.setAbandoned( BigInteger.ONE ) ;
+        AbandonRequestImpl req = new AbandonRequestImpl( 7 ) ;
+        req.setAbandoned( 1 ) ;
         MessageEncoder encoder = new MessageEncoder() ;
         ByteBuffer buf = ByteBuffer.wrap( encoder.encode( req ) ) ;
         AbandonRequestImpl regen = (AbandonRequestImpl) decman.decode( buf ) ;

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
Thu Mar 18 23:08:46 2004
@@ -17,8 +17,6 @@
 package org.apache.eve.decoder.impl ;
 
 
-import java.math.BigInteger ;
-
 import java.nio.ByteBuffer ;
 import java.util.EventObject ;
 
@@ -130,8 +128,8 @@
     
     public void testDefaultDecoderManager() throws Exception
     {
-        AbandonRequest request = new AbandonRequestImpl( new BigInteger("6") ) ;
-        request.setAbandoned( new BigInteger("44") ) ;
+        AbandonRequest request = new AbandonRequestImpl( 6 ) ;
+        request.setAbandoned( 44 ) ;
         MessageEncoder encoder = new MessageEncoder() ;
         
         byte [] encoded = encoder.encode( request ) ;

Modified: incubator/directory/eve/trunk/eve/frontend/processor/merlin-impl/src/test/org/apache/eve/processor/impl/MerlinRequestProcessorTest.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/processor/merlin-impl/src/test/org/apache/eve/processor/impl/MerlinRequestProcessorTest.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/processor/merlin-impl/src/test/org/apache/eve/processor/impl/MerlinRequestProcessorTest.java
Thu Mar 18 23:08:46 2004
@@ -65,10 +65,4 @@
         super.tearDown() ;
         processor = null ;
     }
-
-
-    public void testDummy()
-    {
-        processor.dummy() ;
-    }
 }

Added: incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultHandlerRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultHandlerRegistry.java
Thu Mar 18 23:08:46 2004
@@ -0,0 +1,87 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed 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.eve.processor.impl ;
+
+
+import java.util.Map ;
+import java.util.HashMap ;
+
+import org.apache.eve.processor.RequestHandler ;
+import org.apache.eve.processor.HandlerRegistry ;
+
+import org.apache.ldap.common.message.MessageTypeEnum ;
+
+
+/**
+ * A registry of handlers.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultHandlerRegistry implements HandlerRegistry
+{
+    /** a map of handler request types to the handler */ 
+    private final Map map = new HashMap() ; 
+    
+    
+    /**
+     * Creates a default handler with all the handlers set.
+     */
+    public DefaultHandlerRegistry()
+    {
+        RequestHandler handler = new AbandonHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new AddHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new BindHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new CompareHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new DeleteHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new ExtendedHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new ModifyDnHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new ModifyHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new SearchHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+        
+        handler = new UnbindHandler() ;
+        map.put( handler.getRequestType(), handler ) ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.processor.HandlerRegistry#lookup(
+     * org.apache.ldap.common.message.MessageTypeEnum)
+     */
+    public RequestHandler lookup( MessageTypeEnum messageType )
+    {
+        return ( RequestHandler ) map.get( messageType ) ;
+    }
+}

Modified: incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultRequestProcessor.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultRequestProcessor.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/DefaultRequestProcessor.java
Thu Mar 18 23:08:46 2004
@@ -18,8 +18,10 @@
 
 
 import java.util.EventObject ;
+import java.util.Iterator;
+
+import org.apache.commons.lang.exception.ExceptionUtils ;
 
-import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.eve.event.EventRouter ;
 import org.apache.eve.event.RequestEvent ;
 import org.apache.eve.event.ResponseEvent ;
@@ -28,6 +30,7 @@
 
 import org.apache.eve.listener.ClientKey ;
 
+import org.apache.eve.seda.DefaultStageConfig;
 import org.apache.eve.seda.StageConfig ;
 import org.apache.eve.seda.DefaultStage ;
 import org.apache.eve.seda.StageHandler ;
@@ -43,6 +46,7 @@
 import org.apache.eve.processor.RequestProcessorMonitorAdapter ;
 
 import org.apache.ldap.common.message.Request ;
+import org.apache.ldap.common.message.Response ;
 import org.apache.ldap.common.message.LdapResult ;
 import org.apache.ldap.common.message.ResultCodeEnum ;
 import org.apache.ldap.common.message.ResultResponse ;
@@ -86,6 +90,9 @@
     {
         super( config ) ;
         
+        DefaultStageConfig defaultConfig = ( DefaultStageConfig ) config ;
+        defaultConfig.setHandler( new ProcessorStageHandler() ) ;
+        
         this.hooks = hooks ;
         this.router = router ;
         this.router.subscribe( RequestEvent.class, this ) ;
@@ -168,9 +175,38 @@
      * @param handler the handler that generates the responses
      * @param request the request responded to
      */
-    private void reply( ManyReplyHandler handler, ManyReplyRequest request,
+    private void reply( ManyReplyHandler handler, 
+                        ManyReplyRequest request,
                         ClientKey key )
     {
+        Response response = null ;
+        LdapResult result = null ;
+
+        try
+         {
+             Iterator list = handler.handle( request ) ;
+             while ( list.hasNext() ) 
+             {
+                 response = ( Response ) list.next() ;
+             }
+         }
+
+         // If the individual handlers do not do a global catch and report this
+         // will sheild the server from complete failure on a request reporting
+         // at a minimum the stack trace that cause the request to fail.
+         catch( Throwable t )
+         {
+             monitor.failedOnSingleReply( key, request, t ) ;
+            
+             ResultResponse resultResponse = handler.getDoneResponse( 
+                     request.getMessageId() ) ;
+             result = new LdapResultImpl( response ) ;
+             result.setMatchedDn( "" ) ;
+             result.setErrorMessage( ExceptionUtils.getFullStackTrace( t ) ) ;
+             result.setResultCode( ResultCodeEnum.OPERATIONSERROR ) ;
+             resultResponse.setLdapResult( result ) ;
+             router.publish( new ResponseEvent( this, key, resultResponse ) ) ;
+         }
     }
     
     

Modified: incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/SearchHandler.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/SearchHandler.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/processor/pojo-impl/src/java/org/apache/eve/processor/impl/SearchHandler.java
Thu Mar 18 23:08:46 2004
@@ -17,11 +17,17 @@
 package org.apache.eve.processor.impl ;
 
 
+import java.util.Iterator;
+
 import org.apache.commons.lang.NotImplementedException;
-import org.apache.eve.processor.RequestHandler ;
+
 import org.apache.eve.processor.HandlerTypeEnum ;
-import org.apache.ldap.common.message.SearchRequest ;
+import org.apache.eve.processor.ManyReplyHandler ;
+
+import org.apache.ldap.common.message.ResultResponse ;
 import org.apache.ldap.common.message.MessageTypeEnum ;
+import org.apache.ldap.common.message.ManyReplyRequest ;
+import org.apache.ldap.common.message.SearchResponseDoneImpl ;
 
 
 /**
@@ -31,7 +37,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class SearchHandler implements RequestHandler
+public class SearchHandler implements ManyReplyHandler
 {
     // ------------------------------------------------------------------------
     // Constructor
@@ -56,9 +62,15 @@
      *
      * @param a_request the SearchRequest to handle
      */
-    public void handle( SearchRequest a_request )
+    public Iterator handle( ManyReplyRequest a_request )
     {
         throw new NotImplementedException( "STUB" ) ;
+    }
+    
+    
+    public ResultResponse getDoneResponse( int id )
+    {
+        return new SearchResponseDoneImpl( id ) ;
     }
 
 

Modified: incubator/directory/eve/trunk/eve/frontend/processor/spi/src/java/org/apache/eve/processor/ManyReplyHandler.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/processor/spi/src/java/org/apache/eve/processor/ManyReplyHandler.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/processor/spi/src/java/org/apache/eve/processor/ManyReplyHandler.java
Thu Mar 18 23:08:46 2004
@@ -20,6 +20,7 @@
 import java.util.Iterator ;
 
 import org.apache.ldap.common.message.ManyReplyRequest ;
+import org.apache.ldap.common.message.ResultResponse;
 
 
 /**
@@ -39,4 +40,11 @@
      * @return an enumeration over the responses
      */
     Iterator handle( ManyReplyRequest request ) ;
+    
+    /**
+     * Gets the terminating response.
+     * 
+     * @return the finishing response that carries the result
+     */
+    ResultResponse getDoneResponse( int id ) ;
 }

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/SnickersDecoder.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/SnickersDecoder.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/SnickersDecoder.java
Thu Mar 18 23:08:46 2004
@@ -60,9 +60,8 @@
     /**
      * Creates a SnickersDecoder to be dedicated to a client.
      */
-    public SnickersDecoder( DecoderCallback cb )
+    public SnickersDecoder()
     {
-        this.cb = cb ;
         berDecoder.setDecoderMonitor( monitor ) ;
         DecoderCallback dcb = new DecoderCallback()
         {
@@ -85,6 +84,16 @@
         } ;
         
         berDecoder.setCallback( dcb ) ;
+    }
+
+    
+   /**
+     * Creates a SnickersDecoder to be dedicated to a client.
+     */
+    public SnickersDecoder( DecoderCallback cb )
+    {
+        this() ;
+        this.cb = cb ;
     }
 
     

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/SnickersDecoderTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/SnickersDecoderTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/SnickersDecoderTest.java
Thu Mar 18 23:08:46 2004
@@ -19,8 +19,6 @@
 
 import java.util.ArrayList ;
 
-import java.math.BigInteger ;
-
 import java.nio.ByteBuffer ;
 
 import javax.naming.directory.Attributes ;
@@ -95,7 +93,7 @@
     {
         TupleNode node = null ;
         
-        AddRequestImpl request = new AddRequestImpl( BigInteger.ONE ) ;
+        AddRequestImpl request = new AddRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         
         Attributes attrs = new LockableAttributesImpl() ;
@@ -136,7 +134,7 @@
 
     public void testBindMessage() throws Exception
     {
-        BindRequestImpl request = new BindRequestImpl( BigInteger.ONE ) ;
+        BindRequestImpl request = new BindRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         request.setSimple( true ) ;
         request.setCredentials( "password".getBytes() ) ;
@@ -148,7 +146,7 @@
 
     public void testAddMessage() throws Exception
     {
-        AddRequestImpl request = new AddRequestImpl( BigInteger.ONE ) ;
+        AddRequestImpl request = new AddRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         
         Attributes attrs = new LockableAttributesImpl() ;
@@ -167,7 +165,7 @@
 
     public void testDeleteMessage() throws Exception
     {
-        DeleteRequestImpl request = new DeleteRequestImpl( BigInteger.ONE ) ;
+        DeleteRequestImpl request = new DeleteRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         decode( request ) ;
         assertFalse( msgList.isEmpty() ) ;
@@ -176,8 +174,8 @@
 
     public void testAbandonMessage() throws Exception
     {
-        AbandonRequestImpl request = new AbandonRequestImpl( BigInteger.ONE ) ;
-        request.setAbandoned( new BigInteger( "3" ) ) ;
+        AbandonRequestImpl request = new AbandonRequestImpl( 1 ) ;
+        request.setAbandoned( 3 ) ;
         decode( request ) ;
         assertFalse( msgList.isEmpty() ) ;
     }
@@ -185,7 +183,7 @@
 
     public void testCompareMessage() throws Exception
     {
-        CompareRequestImpl request = new CompareRequestImpl( BigInteger.ONE ) ;
+        CompareRequestImpl request = new CompareRequestImpl( 1 ) ;
         request.setAssertionValue( "testvalue" ) ;
         request.setAttributeId( "testattr" ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
@@ -196,7 +194,7 @@
 
     public void testExtendedMessage() throws Exception
     {
-        ExtendedRequestImpl request = new ExtendedRequestImpl( BigInteger.ONE ) ;
+        ExtendedRequestImpl request = new ExtendedRequestImpl( 1 ) ;
         request.setOid( "1234.1234.1324" ) ;
         request.setPayload( "Hello World".getBytes() ) ;
         decode( request ) ;
@@ -206,7 +204,7 @@
 
     public void testModifyDnMessage() throws Exception
     {
-        ModifyDnRequestImpl request = new ModifyDnRequestImpl( BigInteger.ONE ) ;
+        ModifyDnRequestImpl request = new ModifyDnRequestImpl( 1 ) ;
         request.setDeleteOldRdn(true) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         request.setNewRdn( "uid=aok" ) ;
@@ -218,7 +216,7 @@
 
     public void testModifyMessage() throws Exception
     {
-        ModifyRequestImpl request = new ModifyRequestImpl( BigInteger.ONE ) ;
+        ModifyRequestImpl request = new ModifyRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         decode( request ) ;
         assertFalse( msgList.isEmpty() ) ;
@@ -227,14 +225,14 @@
 
     public void testSearchMessage() throws Exception
     {
-        SearchRequestImpl request = new SearchRequestImpl( BigInteger.ONE ) ;
+        SearchRequestImpl request = new SearchRequestImpl( 1 ) ;
         request.setBase( "uid=akarasulu,dc=example,dc=com" ) ;
         request.setDerefAliases( DerefAliasesEnum.DEREFALWAYS ) ;
         PresenceNode node = new PresenceNode( "attrib0" ) ;
         request.setFilter( node ) ;
         request.setScope( ScopeEnum.BASEOBJECT ) ;
-        request.setSizeLimit( BigInteger.ZERO ) ;
-        request.setTimeLimit( BigInteger.ZERO ) ;
+        request.setSizeLimit( 0 ) ;
+        request.setTimeLimit( 0 ) ;
         decode( request ) ;
         assertFalse( msgList.isEmpty() ) ;
     }

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/EncodeDecodeTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/EncodeDecodeTests.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/EncodeDecodeTests.java
Thu Mar 18 23:08:46 2004
@@ -18,7 +18,6 @@
 
 
 import java.nio.ByteBuffer ;
-import java.math.BigInteger ;
 import java.io.ByteArrayInputStream ;
 
 import org.apache.commons.codec.binary.Hex ;
@@ -43,8 +42,8 @@
     {
         DefaultMutableTupleNode root = null ;
         ByteBuffer buf = null ;
-        AbandonRequestImpl request = new AbandonRequestImpl( BigInteger.ONE ) ;
-        request.setAbandoned( new BigInteger( "3" ) ) ;
+        AbandonRequestImpl request = new AbandonRequestImpl( 1 ) ;
+        request.setAbandoned( 3 ) ;
         
         MessageEncoder encoder = new MessageEncoder() ;
         byte[] snaccBytes = encoder.encode( request ) ;
@@ -56,7 +55,7 @@
         MessageDecoder decoder = new MessageDecoder() ;
         AbandonRequest msg = ( AbandonRequest ) decoder.decode( null, 
                 new ByteArrayInputStream( snaccBytes ) ) ;
-        assertTrue( msg.getMessageId().equals( request.getMessageId() ) ) ;
+        assertTrue( msg.getMessageId() == request.getMessageId() ) ;
         
         System.out.println( "snacc decoded = " + msg ) ;
         

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/LdapMessageTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/LdapMessageTests.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/LdapMessageTests.java
Thu Mar 18 23:08:46 2004
@@ -17,8 +17,6 @@
 package org.apache.snickers.ber ;
 
 
-import java.math.BigInteger ;
-
 import java.nio.ByteBuffer ;
 
 import javax.naming.directory.Attributes ;
@@ -109,7 +107,7 @@
     
     public void testBindMessage() throws Exception
     {
-        BindRequestImpl request = new BindRequestImpl( BigInteger.ONE ) ;
+        BindRequestImpl request = new BindRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         request.setSimple( true ) ;
         request.setCredentials( "password".getBytes() ) ;
@@ -122,7 +120,7 @@
 
     public void testAddMessage() throws Exception
     {
-        AddRequestImpl request = new AddRequestImpl( BigInteger.ONE ) ;
+        AddRequestImpl request = new AddRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         
         Attributes attrs = new LockableAttributesImpl() ;
@@ -142,7 +140,7 @@
 
     public void testDeleteMessage() throws Exception
     {
-        DeleteRequestImpl request = new DeleteRequestImpl( BigInteger.ONE ) ;
+        DeleteRequestImpl request = new DeleteRequestImpl( 1 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         decode( request ) ;
         roundTripTest( request ) ;
@@ -152,8 +150,8 @@
 
     public void testAbandonMessage() throws Exception
     {
-        AbandonRequestImpl request = new AbandonRequestImpl( BigInteger.ONE ) ;
-        request.setAbandoned( new BigInteger( "3" ) ) ;
+        AbandonRequestImpl request = new AbandonRequestImpl( 1 ) ;
+        request.setAbandoned( 3 ) ;
         decode( request ) ;
         roundTripTest( request ) ;
         assertFalse( tlvList.isEmpty() ) ;
@@ -162,7 +160,7 @@
 
     public void testCompareMessage() throws Exception
     {
-        CompareRequestImpl request = new CompareRequestImpl( BigInteger.ONE ) ;
+        CompareRequestImpl request = new CompareRequestImpl( 1 ) ;
         request.setAssertionValue( "testvalue" ) ;
         request.setAttributeId( "testattr" ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
@@ -174,7 +172,7 @@
 
     public void testExtendedMessage() throws Exception
     {
-        ExtendedRequestImpl request = new ExtendedRequestImpl( BigInteger.ONE ) ;
+        ExtendedRequestImpl request = new ExtendedRequestImpl( 1 ) ;
         request.setOid( "1234.1234.1324" ) ;
         request.setPayload( "Hello World".getBytes() ) ;
         decode( request ) ;
@@ -185,7 +183,7 @@
 
     public void testModifyDnMessage() throws Exception
     {
-        ModifyDnRequestImpl request = new ModifyDnRequestImpl( BigInteger.ONE ) ;
+        ModifyDnRequestImpl request = new ModifyDnRequestImpl( 1 ) ;
         request.setDeleteOldRdn(true) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         request.setNewRdn( "uid=aok" ) ;
@@ -290,7 +288,7 @@
     public void testModifyMessage() throws Exception
     {
         ModifyRequestImpl request = 
-            new ModifyRequestImpl( new BigInteger( "17" ) ) ;
+            new ModifyRequestImpl( 17 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         decode( request ) ;
         roundTripTest( request ) ;
@@ -300,14 +298,14 @@
 
     public void testSearchMessage() throws Exception
     {
-        SearchRequestImpl request = new SearchRequestImpl( BigInteger.ONE ) ;
+        SearchRequestImpl request = new SearchRequestImpl( 1 ) ;
         request.setBase( "uid=akarasulu,dc=example,dc=com" ) ;
         request.setDerefAliases( DerefAliasesEnum.DEREFALWAYS ) ;
         PresenceNode node = new PresenceNode( "attrib0" ) ;
         request.setFilter( node ) ;
         request.setScope( ScopeEnum.BASEOBJECT ) ;
-        request.setSizeLimit( BigInteger.ZERO ) ;
-        request.setTimeLimit( BigInteger.ZERO ) ;
+        request.setSizeLimit( 0 ) ;
+        request.setTimeLimit( 0 ) ;
         decode( request ) ;
         roundTripTest( request ) ;
         assertFalse( tlvList.isEmpty() ) ;

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
Thu Mar 18 23:08:46 2004
@@ -19,8 +19,6 @@
 
 import java.io.ByteArrayOutputStream ;
 
-import java.math.BigInteger ;
-
 import java.nio.ByteBuffer ;
 
 import org.apache.commons.codec.stateful.DecoderCallback ;
@@ -87,7 +85,7 @@
         ByteArrayOutputStream out = new ByteArrayOutputStream() ;
         
         // Setup the bind request
-        ModifyRequestImpl request = new ModifyRequestImpl( new BigInteger("17") ) ;
+        ModifyRequestImpl request = new ModifyRequestImpl( 17 ) ;
         request.setName( "uid=akarasulu,dc=example,dc=com" ) ;
         
         // Setup the ASN1 Enoder

Modified: incubator/directory/snickers/trunk/codec-stateful/src/java/org/apache/commons/codec/stateful/DecoderMonitorAdapter.java
==============================================================================
--- incubator/directory/snickers/trunk/codec-stateful/src/java/org/apache/commons/codec/stateful/DecoderMonitorAdapter.java
(original)
+++ incubator/directory/snickers/trunk/codec-stateful/src/java/org/apache/commons/codec/stateful/DecoderMonitorAdapter.java
Thu Mar 18 23:08:46 2004
@@ -25,13 +25,13 @@
  */
 public class DecoderMonitorAdapter implements DecoderMonitor
 {
-
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#error(
      * org.apache.commons.codec.stateful.StatefulDecoder, java.lang.Exception)
      */
     public void error( StatefulDecoder decoder, Exception exception )
     {
+        throw new RuntimeException( exception ) ;
     }
 
     
@@ -41,6 +41,7 @@
      */
     public void fatalError( StatefulDecoder decoder, Exception exception )
     {
+        throw new RuntimeException( exception ) ;
     }
 
     
@@ -50,6 +51,7 @@
      */
     public void warning( StatefulDecoder decoder, Exception exception )
     {
+        throw new RuntimeException( exception ) ;
     }
 
     

Mime
View raw message