directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject svn commit: r109567 - in incubator/directory/seda/branches/berin_api_proposal: . src src/java src/java/org src/java/org/apache src/java/org/apache/directory src/java/org/apache/directory/seda src/test src/test/org src/test/org/apache src/test/org/apache/directory src/test/org/apache/directory/seda src/test/org/apache/directory/seda/test xdocs
Date Thu, 02 Dec 2004 22:03:10 GMT
Author: bloritsch
Date: Thu Dec  2 14:03:09 2004
New Revision: 109567

URL: http://svn.apache.org/viewcvs?view=rev&rev=109567
Log:
start the proposed SEDA restructure
Added:
   incubator/directory/seda/branches/berin_api_proposal/project.properties
   incubator/directory/seda/branches/berin_api_proposal/project.xml
   incubator/directory/seda/branches/berin_api_proposal/src/
   incubator/directory/seda/branches/berin_api_proposal/src/java/
   incubator/directory/seda/branches/berin_api_proposal/src/java/org/
   incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/
   incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/
   incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/
   incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/PipelineUtil.java
   incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/Stage.java
   incubator/directory/seda/branches/berin_api_proposal/src/test/
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestPipelineUtil.java
   incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestStage.java
   incubator/directory/seda/branches/berin_api_proposal/xdocs/

Added: incubator/directory/seda/branches/berin_api_proposal/project.properties
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/berin_api_proposal/project.properties?view=auto&rev=109567
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/berin_api_proposal/project.properties	Thu Dec  2 14:03:09
2004
@@ -0,0 +1,3 @@
+maven.repo.remote = http://dist.d-haven.org,http://www.ibiblio.org/maven
+maven.compile.source = 1.4
+maven.compile.target = 1.4

Added: incubator/directory/seda/branches/berin_api_proposal/project.xml
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/berin_api_proposal/project.xml?view=auto&rev=109567
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/berin_api_proposal/project.xml	Thu Dec  2 14:03:09 2004
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<project>
+    <pomVersion>3</pomVersion>
+    <name>Directory SEDA</name>
+    <groupId>directory-seda</groupId>
+    <id>berin-seda</id>
+    <currentVersion>1.0.0</currentVersion>
+    <organization>
+        <name>Apache Software Foundation</name>
+        <url>http://apache.org</url>
+    </organization>
+    <inceptionYear>2004</inceptionYear>
+    <package>org.apache.directory.seda</package>
+
+    <shortDescription>SEDA Implementation for the Directory Project</shortDescription>
+
+    <description>
+       SEDA is the Staged Event Driven Architecture that drives the networking system. 
+    </description>
+
+    <url>
+        http://incubator.apache.org/directory
+    </url>
+    <issueTrackingUrl>
+        
+    </issueTrackingUrl>
+    <siteAddress></siteAddress>
+    <siteDirectory>
+    </siteDirectory>
+    <distributionDirectory>
+    </distributionDirectory>
+
+    <repository>
+        <connection>
+            scm:svn:http://svn.apache.org/asf/directory/
+        </connection>
+        <url>
+            http://svn.apache.org/asf/directory
+        </url>
+    </repository>
+
+    <versions>
+        <version>
+            <id>1.0.0</id>
+            <name>1.0.0</name>
+            <tag>seda/v1.0.0</tag>
+        </version>
+    </versions>
+
+    <mailingLists>
+       <mailingList>
+            <name></name>
+            <subscribe>
+                
+            </subscribe>
+            <unsubscribe>
+                
+            </unsubscribe>
+            <archive>
+                
+            </archive>
+        </mailingList>
+    </mailingLists>
+
+    <developers>
+        <developer>
+            <name>Berin Loritsch</name>
+            <id>bloritsch</id>
+            <email>bloritsch@d-haven.org</email>
+            <organization>D-Haven.org</organization>
+        </developer>
+    </developers>
+
+    <dependencies>
+        <dependency>
+            <groupId>d-haven-event</groupId>
+            <artifactId>d-haven-event</artifactId>
+            <version>1.0.5</version>
+            <url>
+                http://api.d-haven.org/event/
+            </url>
+        </dependency>
+        <dependency>
+            <groupId>concurrent</groupId>
+            <artifactId>concurrent</artifactId>
+            <version>1.3.4</version>
+            <url>http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html</url>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <nagEmailAddress>
+        </nagEmailAddress>
+        <sourceDirectory>src/java</sourceDirectory>
+        <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+        <unitTest>
+            <includes>
+                <include>**/test/Test*.java</include>
+            </includes>
+            <excludes>
+                <exclude>**/mocks/*.java</exclude>
+            </excludes>
+        </unitTest>
+    </build>
+</project>

Added: incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/PipelineUtil.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/PipelineUtil.java?view=auto&rev=109567
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/PipelineUtil.java
Thu Dec  2 14:03:09 2004
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2004 Your Corporation. All Rights Reserved.
+ */
+package org.apache.directory.seda;
+
+/**
+ * Utility to connect pipelines together.
+ */
+public final class PipelineUtil
+{
+    public static void connectStage( final Stage origin,
+                                     final Stage destination )
+    {
+        destination.addSource( origin.getDefaultPipe() );
+    }
+}

Added: incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/Stage.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/Stage.java?view=auto&rev=109567
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/berin_api_proposal/src/java/org/apache/directory/seda/Stage.java
Thu Dec  2 14:03:09 2004
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2004 Your Corporation. All Rights Reserved.
+ */
+package org.apache.directory.seda;
+
+import org.d_haven.event.Source;
+import org.d_haven.event.EventHandler;
+import org.d_haven.event.Pipe;
+import org.d_haven.event.Sink;
+import org.d_haven.event.impl.AbstractEventHandler;
+import org.d_haven.event.impl.DefaultPipe;
+import org.d_haven.event.command.EventPipeline;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Created by IntelliJ IDEA. User: berin Date: Dec 2, 2004 Time: 4:24:55
+ * PM To change this template use File | Settings | File Templates.
+ */
+public class Stage extends AbstractEventHandler implements EventPipeline
+{
+    private final List m_sources;
+    private final Pipe m_sink;
+    private final Map m_namedSinks;
+
+    public Stage()
+    {
+        m_sources = new LinkedList();
+        m_sink = new DefaultPipe();
+        m_namedSinks = new HashMap();
+    }
+
+    public void addSource( final Source source )
+    {
+        m_sources.add( source );
+    }
+
+    public Source[] getSources()
+    {
+        return (Source[])m_sources.toArray( new Source[m_sources.size()] );
+    }
+
+    public EventHandler getEventHandler()
+    {
+        return this;
+    }
+
+    public void handleEvent( final Object event )
+    {
+        getDefaultPipe().tryEnqueue(event);
+    }
+
+    public void addSink( final String name, final Sink sink )
+    {
+        if (null == name)
+        {
+            throw new IllegalArgumentException("'name' cannot be null");
+        }
+
+        if (null == sink)
+        {
+            throw new IllegalArgumentException("'sink' cannot be null");
+        }
+
+        m_namedSinks.put( name, sink );
+    }
+
+    public Pipe getDefaultPipe()
+    {
+        return m_sink;
+    }
+
+    public Sink getNamedSink( final String name )
+    {
+        return (Sink)m_namedSinks.get(name);
+    }
+}

Added: incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestPipelineUtil.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestPipelineUtil.java?view=auto&rev=109567
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestPipelineUtil.java
Thu Dec  2 14:03:09 2004
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2004 Your Corporation. All Rights Reserved.
+ */
+package org.apache.directory.seda.test;
+
+import junit.framework.TestCase;
+import org.apache.directory.seda.PipelineUtil;
+import org.apache.directory.seda.Stage;
+import org.d_haven.event.Pipe;
+
+/**
+ * Created by IntelliJ IDEA. User: berin Date: Dec 2, 2004 Time: 4:20:02
+ * PM To change this template use File | Settings | File Templates.
+ */
+public class TestPipelineUtil extends TestCase
+{
+    public TestPipelineUtil(final String name)
+    {
+        super(name);
+    }
+
+    public void testConnectStage()
+    {
+        final Stage origin = new Stage();
+        final Stage destination = new Stage();
+
+        assertEquals( 0, destination.getSources().length );
+
+        PipelineUtil.connectStage(origin, destination);
+        final Pipe originPipe = origin.getDefaultPipe();
+
+        assertEquals( 1, destination.getSources().length );
+        assertEquals( originPipe, destination.getSources()[0] );
+    }
+}

Added: incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestStage.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestStage.java?view=auto&rev=109567
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/berin_api_proposal/src/test/org/apache/directory/seda/test/TestStage.java
Thu Dec  2 14:03:09 2004
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2004 Your Corporation. All Rights Reserved.
+ */
+package org.apache.directory.seda.test;
+
+import junit.framework.TestCase;
+import org.apache.directory.seda.Stage;
+import org.d_haven.event.Pipe;
+import org.d_haven.event.impl.DefaultPipe;
+
+/**
+ * Created by IntelliJ IDEA. User: berin Date: Dec 2, 2004 Time: 4:27:36
+ * PM To change this template use File | Settings | File Templates.
+ */
+public class TestStage extends TestCase
+{
+    public TestStage(final String name)
+    {
+        super(name);
+    }
+
+    public void testCreateStage()
+    {
+        final Stage stage = new Stage();
+        assertNotNull(stage);
+
+        assertEquals( stage, stage.getEventHandler() );
+
+        assertNotNull( stage.getDefaultPipe() );
+    }
+
+    public void testAddSource()
+    {
+        final Stage stage = new Stage();
+        final Pipe input = new DefaultPipe();
+
+        stage.addSource(input);
+
+        assertEquals( 1, stage.getSources().length );
+        assertEquals( input, stage.getSources()[0] );
+    }
+
+    public void testAddSink()
+    {
+        final Stage stage = new Stage();
+        final String name = "test";
+        final Pipe output = new DefaultPipe();
+
+        stage.addSink(name, output);
+        assertNull( stage.getNamedSink( null ) );
+        assertEquals( output, stage.getNamedSink(name) );
+    }
+
+    public void testAddSink_nullName()
+    {
+        final Stage stage = new Stage();
+        final Pipe output = new DefaultPipe();
+
+        try
+        {
+            stage.addSink(null, output);
+            fail("Did not throw expected exception.");
+        }
+        catch(Exception e)
+        {
+            assertTrue("Threw exception, but not the expected type.", e instanceof IllegalArgumentException);
+        }
+    }
+
+    public void testAddSink_nullSink()
+    {
+        final Stage stage = new Stage();
+        final String name = "test";
+
+        try
+        {
+            stage.addSink(name, null);
+            fail("Did not throw expected exception.");
+        }
+        catch(Exception e)
+        {
+            assertTrue("Threw exception, but not the expected type.", e instanceof IllegalArgumentException);
+        }
+    }
+
+    public void testDefaultAction()
+    {
+        final Stage stage = new Stage();
+        final String event = "test";
+
+        stage.handleEvent( event );
+
+        assertEquals(event, stage.getDefaultPipe().dequeue());
+    }
+}

Mime
View raw message