directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 9673 - in incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl: . conf src/java/org/apache/eve/encoder/impl src/test/org/apache/eve/encoder/impl
Date Mon, 22 Mar 2004 10:34:52 GMT
Author: akarasulu
Date: Mon Mar 22 02:34:52 2004
New Revision: 9673

Modified:
   incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/conf/block.xml
   incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.properties
   incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.xml
   incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/java/org/apache/eve/encoder/impl/MerlinEncoderManager.java
   incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/test/org/apache/eve/encoder/impl/MerlinEncoderManagerTest.java
Log:
implemented merlin wrapper

Modified: incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/conf/block.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/conf/block.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/conf/block.xml	Mon Mar
22 02:34:52 2004
@@ -27,6 +27,7 @@
         <resource id="commons-collections:commons-collections" version="3.0"/>
         <resource id="commons-primitives:commons-primitives" version="1.1-dev"/>
         <resource id="commons-lang:commons-lang" version="2.0"/>
+        <resource id="commons-logging:commons-logging" version="1.0.3"/>
   
         <!-- Directory Dependencies -->
 

Modified: incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.properties
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.properties	(original)
+++ incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.properties	Mon
Mar 22 02:34:52 2004
@@ -3,3 +3,5 @@
 merlin.debug=true
 merlin.info=true
 merlin.override=conf/config.xml
+
+org.apache.commons.logging.simplelog.defaultlog=debug

Modified: incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/project.xml	Mon Mar 22
02:34:52 2004
@@ -43,6 +43,20 @@
       </dependency>
     
       <dependency>
+        <groupId>commons-codec</groupId>
+        <artifactId>commons-codec</artifactId>
+        <version>1.2</version>
+        <url>http://jakarta.apache.org/commons/codec</url>
+      </dependency>
+    
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+        <version>1.0.3</version>
+        <url>http://jakarta.apache.org/commons/logging</url>
+      </dependency>
+        
+      <dependency>
         <groupId>commons-primitives</groupId>
         <artifactId>commons-primitives</artifactId>
         <version>1.1-dev</version>
@@ -131,6 +145,18 @@
         <artifactId>ldap-common</artifactId>
         <version>SNAPSHOT</version>
         <url>http://incubator.apache.org/directory/ldap/common</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>ldap-snacc-provider</artifactId>
+        <version>SNAPSHOT</version>
+      </dependency>
+
+      <dependency>
+        <groupId>snacc4j</groupId>
+        <artifactId>snacc</artifactId>
+        <version>2.3</version>
       </dependency>
 
       <dependency>

Modified: incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/java/org/apache/eve/encoder/impl/MerlinEncoderManager.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/java/org/apache/eve/encoder/impl/MerlinEncoderManager.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/java/org/apache/eve/encoder/impl/MerlinEncoderManager.java
Mon Mar 22 02:34:52 2004
@@ -17,11 +17,14 @@
 package org.apache.eve.encoder.impl ;
 
 
+import org.apache.commons.codec.EncoderException ;
+
 import org.apache.eve.thread.ThreadPool ;
 import org.apache.eve.event.EventRouter ;
 import org.apache.eve.seda.DefaultStageConfig ;
 
 import org.apache.eve.encoder.EncoderManager ;
+import org.apache.ldap.common.message.Response;
 
 import org.apache.avalon.framework.logger.Logger ;
 import org.apache.avalon.framework.logger.LogEnabled ;
@@ -75,10 +78,12 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.eve.processor.RequestProcessor#dummy()
+     * @see org.apache.eve.encoder.EncoderManager#encode(
+     * org.apache.ldap.common.message.Response)
      */
-    public void dummy()
+    public byte[] encode( Response response ) throws EncoderException
     {
+        return encoderManager.encode( response ) ;
     }
     
     
@@ -142,7 +147,7 @@
      */
     public void initialize() throws Exception
     {
-        //throw new NotImplementedException( "STUB" ) ;
+        encoderManager = new DefaultEncoderManager( router, stageConfig ) ;
     }
     
     
@@ -151,7 +156,7 @@
      */
     public void start() throws Exception
     {
-        //throw new NotImplementedException( "STUB" ) ;
+        encoderManager.start() ;
     }
     
     
@@ -160,6 +165,6 @@
      */
     public void stop() throws Exception
     {
-        //throw new NotImplementedException( "STUB" ) ;
+        encoderManager.stop() ;
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/test/org/apache/eve/encoder/impl/MerlinEncoderManagerTest.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/test/org/apache/eve/encoder/impl/MerlinEncoderManagerTest.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/encoder/merlin-impl/src/test/org/apache/eve/encoder/impl/MerlinEncoderManagerTest.java
Mon Mar 22 02:34:52 2004
@@ -17,9 +17,21 @@
 package org.apache.eve.encoder.impl ;
 
 
+import java.util.EventObject;
+
 import org.apache.avalon.merlin.unit.AbstractMerlinTestCase ;
 
 import org.apache.eve.encoder.EncoderManager ;
+import org.apache.eve.event.AbstractSubscriber;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.event.OutputEvent;
+import org.apache.eve.event.OutputSubscriber;
+import org.apache.eve.event.ResponseEvent;
+import org.apache.ldap.common.message.AddResponse;
+import org.apache.ldap.common.message.AddResponseImpl;
+import org.apache.ldap.common.message.LdapResult;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 
 
 /**
@@ -30,8 +42,11 @@
  * @version $Rev$
  */
 public class MerlinEncoderManagerTest extends AbstractMerlinTestCase
+    implements OutputSubscriber
 {
     EncoderManager encman = null ;
+    OutputEvent event = null ;
+    EventRouter router = null ;
 
     
     public MerlinEncoderManagerTest( String a_name )
@@ -54,6 +69,9 @@
         super.setUp() ;
         encman = ( EncoderManager ) 
             resolve( "/server/encoder-manager" ) ; 
+        router = ( EventRouter )
+            resolve( "/server/event-router" ) ; 
+        router.subscribe( OutputEvent.class, this ) ;
     }
 
     
@@ -64,11 +82,53 @@
     {
         super.tearDown() ;
         encman = null ;
+        router = null ;
+        event = null ;
     }
 
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.event.Subscriber#inform(java.util.EventObject)
+     */
+    public void inform( EventObject event )
+    {
+        try
+        {
+            AbstractSubscriber.inform( this, event ) ;
+        }
+        catch( Throwable t )
+        {
+            t.printStackTrace() ;
+        }
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.event.OutputSubscriber#
+     * inform(org.apache.eve.event.OutputEvent)
+     */
+    public void inform( OutputEvent event )
+    {
+        this.event = event ;
+    }
+    
 
-    public void testDummy()
+    /**
+     * Tests the encoding of a response to an add request.
+     *
+     */
+    public void testAddResponse() throws Exception 
     {
-        encman.dummy() ;
+        AddResponse response = new AddResponseImpl( 5 ) ;
+        LdapResult result = new LdapResultImpl( response ) ;
+        result.setErrorMessage( "Server is stubbed out" ) ;
+        result.setMatchedDn( "uid=akarasulu,dc=example,dc=com" ) ;
+        result.setResultCode( ResultCodeEnum.UNWILLINGTOPERFORM ) ;
+        response.setLdapResult( result ) ;
+        ResponseEvent event = new ResponseEvent( this, null, response ) ;
+        router.publish( event ) ;
+        
+        Thread.sleep(1000) ;
+        assertNotNull( this.event ) ;
     }
 }

Mime
View raw message