camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1234489 - /camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/
Date Sun, 22 Jan 2012 11:32:20 GMT
Author: bvahdat
Date: Sun Jan 22 11:32:20 2012
New Revision: 1234489

URL: http://svn.apache.org/viewvc?rev=1234489&view=rev
Log:
CAMEL-4924: Now the camel-mina2 unit-tests all pass (and don't hang anymore!) on Windows as
well

Modified:
    camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
    camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
    camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
    camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
    camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java

Modified: camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java?rev=1234489&r1=1234488&r2=1234489&view=diff
==============================================================================
--- camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
(original)
+++ camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
Sun Jan 22 11:32:20 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.mina2;
 
+import org.apache.camel.test.junit4.TestSupport;
 import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.service.IoHandlerAdapter;
 import org.apache.mina.core.session.IoSession;
@@ -40,6 +41,11 @@ public class Mina2ReverseProtocolHandler
             buf.append(str.charAt(i));
         }
 
+        if (TestSupport.isPlatform("windows")) {
+            // seems to be only required on windows to make it work!
+            buf.append(System.getProperty("line.separator"));
+        }
+
         // and write it back.
         session.write(buf.toString());
     }

Modified: camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java?rev=1234489&r1=1234488&r2=1234489&view=diff
==============================================================================
--- camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
(original)
+++ camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
Sun Jan 22 11:32:20 2012
@@ -31,7 +31,7 @@ public class Mina2SpringMinaEndpointUDPT
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedMessageCount(1);
 
-        template.sendBody("myMinaEndpoint", "Hello World\n");
+        template.sendBody("myMinaEndpoint", "Hello World" + LS);
 
         assertMockEndpointsSatisfied();
     }

Modified: camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java?rev=1234489&r1=1234488&r2=1234489&view=diff
==============================================================================
--- camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
(original)
+++ camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
Sun Jan 22 11:32:20 2012
@@ -40,7 +40,7 @@ public class Mina2SpringMultipleUDPTest 
         result.expectedMessageCount(7);
 
         for (int i = 0; i < 7; i++) {
-            template.requestBody("myMinaEndpoint", "Hello World" + i + "\n");
+            template.requestBody("myMinaEndpoint", "Hello World" + i + LS);
         }
 
         // Sleep for awhile to let the messages go through.

Modified: camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java?rev=1234489&r1=1234488&r2=1234489&view=diff
==============================================================================
--- camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
(original)
+++ camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
Sun Jan 22 11:32:20 2012
@@ -87,7 +87,7 @@ public class Mina2TcpWithInOutUsingPlain
         try {
             os = soc.getOutputStream();
             // must append newline at the end to flag end of textline to Camel-Mina
-            os.write((input + "\n").getBytes());
+            os.write((input + LS).getBytes());
 
             is = soc.getInputStream();
             int len = is.read(buf);
@@ -109,7 +109,7 @@ public class Mina2TcpWithInOutUsingPlain
         StringBuilder sb = new StringBuilder();
         for (byte b : buf) {
             char ch = (char) b;
-            if (ch == '\n' || ch == 0) {
+            if (LS.indexOf(ch) > -1) {
                 // newline denotes end of text (added in the end in the processor below)
                 break;
             } else {

Modified: camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java?rev=1234489&r1=1234488&r2=1234489&view=diff
==============================================================================
--- camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java
(original)
+++ camel/trunk/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java
Sun Jan 22 11:32:20 2012
@@ -72,7 +72,7 @@ public class Mina2UdpNoCamelTest {
         UDPClient client = new UDPClient();
         client.connect("127.0.0.1", 1234);
         for (int i = 0; i < 222; i++) {
-            client.sendNoMina("Hello Mina " + i + "\n");
+            client.sendNoMina("Hello Mina " + i + System.getProperty("line.separator"));
         }
         Thread.sleep(2000);
         assertEquals(222, server.numMessagesReceived);



Mime
View raw message