directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r124018 - /incubator/directory/network/trunk/sedang/project.xml /incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java
Date Mon, 03 Jan 2005 17:39:57 GMT
Author: adc
Date: Mon Jan  3 09:39:55 2005
New Revision: 124018

URL: http://svn.apache.org/viewcvs?view=rev&rev=124018
Log:
Updated protocol version and use of concurrent.
Modified:
   incubator/directory/network/trunk/sedang/project.xml
   incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java

Modified: incubator/directory/network/trunk/sedang/project.xml
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/sedang/project.xml?view=diff&rev=124018&p1=incubator/directory/network/trunk/sedang/project.xml&r1=124017&p2=incubator/directory/network/trunk/sedang/project.xml&r2=124018
==============================================================================
--- incubator/directory/network/trunk/sedang/project.xml	(original)
+++ incubator/directory/network/trunk/sedang/project.xml	Mon Jan  3 09:39:55 2005
@@ -89,7 +89,7 @@
         <dependency>
             <groupId>incubator-directory</groupId>
             <artifactId>protocol-api</artifactId>
-            <version>SNAPSHOT</version>
+            <version>1.0-SNAPSHOT</version>
             <url>http://incubator.apache.org/directory/subprojects/protocol-api/</url>
         </dependency>
     </dependencies>

Modified: incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java?view=diff&rev=124018&p1=incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java&r1=124017&p2=incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java&r2=124018
==============================================================================
--- incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java
(original)
+++ incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/test/TestProtocolRouter.java
Mon Jan  3 09:39:55 2005
@@ -16,20 +16,20 @@
  */
 package org.apache.directory.seda.test;
 
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import EDU.oswego.cs.dl.util.concurrent.CyclicBarrier;
 import junit.framework.TestCase;
-import org.apache.directory.seda.ProtocolRouter;
-import org.apache.directory.seda.NetworkEvent;
-import org.d_haven.event.impl.DefaultPipe;
 import org.d_haven.event.Pipe;
 import org.d_haven.event.command.SwitchedEnqueuePredicate;
+import org.d_haven.event.impl.DefaultPipe;
+
+import org.apache.directory.seda.NetworkEvent;
+import org.apache.directory.seda.ProtocolRouter;
 
-import java.net.ServerSocket;
-import java.net.InetSocketAddress;
-import java.net.InetAddress;
-import java.io.IOException;
-import java.util.concurrent.CyclicBarrier;
-import java.nio.channels.SocketChannel;
-import java.nio.channels.ServerSocketChannel;
 
 /**
  * Created by IntelliJ IDEA. User: berin Date: Dec 2, 2004 Time: 9:35:36
@@ -42,9 +42,9 @@
     private ServerSocketChannel m_serverChannel;
     private SocketChannel m_clientChannel;
 
-    public TestProtocolRouter(final String name)
+    public TestProtocolRouter( final String name )
     {
-        super(name);
+        super( name );
     }
 
     public void setUp() throws Exception
@@ -52,11 +52,11 @@
         super.setUp();
 
         m_serverChannel = ServerSocketChannel.open();
-        m_serverChannel.socket().bind( new InetSocketAddress(PORT) );
+        m_serverChannel.socket().bind( new InetSocketAddress( PORT ) );
 
         m_channel = SocketChannel.open();
         m_channel.configureBlocking( false );
-        m_channel.connect(  new InetSocketAddress(InetAddress.getLocalHost(), PORT) );
+        m_channel.connect( new InetSocketAddress( InetAddress.getLocalHost(), PORT ) );
 
         m_clientChannel = m_serverChannel.accept();
     }
@@ -73,7 +73,7 @@
     public void testCreateRouter()
     {
         final ProtocolRouter protocolRouter = new ProtocolRouter();
-        assertNotNull(protocolRouter);
+        assertNotNull( protocolRouter );
     }
 
     public void testRouteEvents() throws IOException
@@ -81,14 +81,14 @@
         final ProtocolRouter protocolRouter = new ProtocolRouter();
         final Pipe port6666 = new DefaultPipe();
 
-        protocolRouter.addPipe("6666", port6666);
+        protocolRouter.addPipe( "6666", port6666 );
 
-        final NetworkEvent event6666 = new NetworkEvent(m_clientChannel);
+        final NetworkEvent event6666 = new NetworkEvent( m_clientChannel );
 
         protocolRouter.handleEvent( event6666 );
 
-        assertEquals(0,  protocolRouter.getDefaultPipe().size() );
-        assertEquals(event6666, protocolRouter.getNamedPipe( "6666" ).dequeue() );
+        assertEquals( 0, protocolRouter.getDefaultPipe().size() );
+        assertEquals( event6666, protocolRouter.getNamedPipe( "6666" ).dequeue() );
     }
 
     public void testRouteEvent_notNetworkEvent()
@@ -96,12 +96,12 @@
         final ProtocolRouter protocolRouter = new ProtocolRouter();
         final Pipe port6666 = new DefaultPipe();
 
-        protocolRouter.addPipe("6666", port6666);
+        protocolRouter.addPipe( "6666", port6666 );
 
         protocolRouter.handleEvent( "test" );
 
-        assertEquals(0,  protocolRouter.getNamedPipe( "6666" ).size() );
-        assertEquals("test", protocolRouter.getDefaultPipe().dequeue() );
+        assertEquals( 0, protocolRouter.getNamedPipe( "6666" ).size() );
+        assertEquals( "test", protocolRouter.getDefaultPipe().dequeue() );
     }
 
     public void testRouteEvent_missingPipe()
@@ -109,14 +109,14 @@
         final ProtocolRouter protocolRouter = new ProtocolRouter();
         final Pipe port80 = new DefaultPipe();
 
-        protocolRouter.addPipe("80", port80);
+        protocolRouter.addPipe( "80", port80 );
 
-        final NetworkEvent event6666 = new NetworkEvent(m_clientChannel);
+        final NetworkEvent event6666 = new NetworkEvent( m_clientChannel );
 
         protocolRouter.handleEvent( event6666 );
 
-        assertEquals(0,  protocolRouter.getNamedPipe( "80" ).size() );
-        assertEquals(event6666, protocolRouter.getDefaultPipe().dequeue() );
+        assertEquals( 0, protocolRouter.getNamedPipe( "80" ).size() );
+        assertEquals( event6666, protocolRouter.getDefaultPipe().dequeue() );
     }
 
     public void testRouteEvent_backPressure()
@@ -129,33 +129,34 @@
         port6666.setEnqueuePredicate( predicate );
         predicate.block();
 
-        protocolRouter.addPipe("6666", port6666);
+        protocolRouter.addPipe( "6666", port6666 );
 
-        final NetworkEvent event6666 = new NetworkEvent(m_clientChannel);
-        final CyclicBarrier barrier = new CyclicBarrier(2);
+        final NetworkEvent event6666 = new NetworkEvent( m_clientChannel );
+        final CyclicBarrier barrier = new CyclicBarrier( 2 );
 
-        final Thread runner = new Thread(new Runnable() {
+        final Thread runner = new Thread( new Runnable()
+        {
             public void run()
             {
                 protocolRouter.handleEvent( event6666 );
                 try
                 {
-                    barrier.await();
+                    barrier.barrier();
                 }
                 catch ( Exception e )
                 {
                 }
             }
-        });
+        } );
         runner.start();
 
-        assertEquals(0, protocolRouter.getDefaultPipe().size() );
-        assertEquals(0, protocolRouter.getNamedPipe( "6666" ).size() );
+        assertEquals( 0, protocolRouter.getDefaultPipe().size() );
+        assertEquals( 0, protocolRouter.getNamedPipe( "6666" ).size() );
 
         predicate.accept();
-        barrier.await();
+        barrier.barrier();
 
-        assertEquals(0, protocolRouter.getDefaultPipe().size() );
-        assertEquals(event6666, protocolRouter.getNamedPipe( "6666" ).dequeue() );
+        assertEquals( 0, protocolRouter.getDefaultPipe().size() );
+        assertEquals( event6666, protocolRouter.getNamedPipe( "6666" ).dequeue() );
     }
 }

Mime
View raw message