directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject svn commit: r111989 - /incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java
Date Wed, 15 Dec 2004 16:25:49 GMT
Author: bloritsch
Date: Wed Dec 15 08:25:47 2004
New Revision: 111989

URL: http://svn.apache.org/viewcvs?view=rev&rev=111989
Log:
Fix the problem I ran into earlier reading the info passed in.
Modified:
   incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java

Modified: incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java?view=diff&rev=111989&p1=incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java&r1=111988&p2=incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java&r2=111989
==============================================================================
--- incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java
(original)
+++ incubator/directory/network/trunk/sedang/src/test/org/apache/directory/seda/output/test/TestWriter.java
Wed Dec 15 08:25:47 2004
@@ -22,9 +22,12 @@
 import org.apache.protocol.bufferpool.BufferPool;
 
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
 import java.net.InetSocketAddress;
 import java.net.InetAddress;
 
@@ -97,7 +100,13 @@
         m_channel.read( buffer );
         buffer.flip();
 
-        assertEquals("test", buffer.asCharBuffer().toString());
+        assertEquals("test", readString(buffer, "ISO-8859-1"));
+    }
+
+    private String readString( final ByteBuffer buffer, final String charset )
+    {
+        final Charset set = Charset.forName( charset );
+        return set.decode( buffer ).toString();
     }
 
     public void testSendIncorrectEvent()

Mime
View raw message