directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject svn commit: r383675 - /directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
Date Mon, 06 Mar 2006 21:13:23 GMT
Author: niklas
Date: Mon Mar  6 13:13:20 2006
New Revision: 383675

URL: http://svn.apache.org/viewcvs?rev=383675&view=rev
Log:
The testWriteUsingSocketTransport test will now call start() and stop() on the ThreadPoolFilter
is uses.

Modified:
    directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java?rev=383675&r1=383674&r2=383675&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
Mon Mar  6 13:13:20 2006
@@ -383,36 +383,43 @@
         SocketAddress address = new InetSocketAddress( "localhost", AvailablePortFinder.getNextAvailable()
);
 
         IoConnector connector = new SocketConnector();
-        connector.getDefaultConfig().getFilterChain().addFirst( "threadPool", new ThreadPoolFilter()
);
+        ThreadPoolFilter threadPoolFilter = new ThreadPoolFilter();
+        threadPoolFilter.start();
         
-        FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
-        
-        SenderHandler sender = new SenderHandler( stream );
-        ReceiverHandler receiver = new ReceiverHandler( stream.size );
-        
-        acceptor.bind( address, sender );
-        
-        synchronized( sender.lock )
-        {
-            synchronized( receiver.lock )
+        try {
+            connector.getDefaultConfig().getFilterChain().addFirst( "threadPool", threadPoolFilter
);
+            
+            FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
+            
+            SenderHandler sender = new SenderHandler( stream );
+            ReceiverHandler receiver = new ReceiverHandler( stream.size );
+            
+            acceptor.bind( address, sender );
+            
+            synchronized( sender.lock )
             {
-                connector.connect( address, receiver );
-                
-                sender.lock.wait();
-                receiver.lock.wait();
+                synchronized( receiver.lock )
+                {
+                    connector.connect( address, receiver );
+                    
+                    sender.lock.wait();
+                    receiver.lock.wait();
+                }
             }
-        }
-        
-        acceptor.unbind( address );
-        
-        assertEquals( stream.bytesRead, receiver.bytesRead );
-        assertEquals( stream.size, receiver.bytesRead );
-        byte[] expectedMd5 = stream.digest.digest();
-        byte[] actualMd5 = receiver.digest.digest();
-        assertEquals( expectedMd5.length, actualMd5.length );
-        for( int i = 0; i < expectedMd5.length; i++ )
-        {
-            assertEquals( expectedMd5[ i ], actualMd5[ i ] );
+            
+            acceptor.unbind( address );
+            
+            assertEquals( stream.bytesRead, receiver.bytesRead );
+            assertEquals( stream.size, receiver.bytesRead );
+            byte[] expectedMd5 = stream.digest.digest();
+            byte[] actualMd5 = receiver.digest.digest();
+            assertEquals( expectedMd5.length, actualMd5.length );
+            for( int i = 0; i < expectedMd5.length; i++ )
+            {
+                assertEquals( expectedMd5[ i ], actualMd5[ i ] );
+            }
+        } finally {
+            threadPoolFilter.stop();
         }
     }
 



Mime
View raw message