camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r790701 - in /camel/trunk/components/camel-irc/src: main/java/org/apache/camel/component/irc/IrcConfiguration.java test/java/org/apache/camel/component/irc/IrcRouteTest.java
Date Thu, 02 Jul 2009 18:22:04 GMT
Author: janstey
Date: Thu Jul  2 18:22:04 2009
New Revision: 790701

URL: http://svn.apache.org/viewvc?rev=790701&view=rev
Log:
CAMEL-1786 - fix parsing of channel name with parameters. Thanks to Stan Lewis for the patch

Modified:
    camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
    camel/trunk/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcRouteTest.java

Modified: camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java?rev=790701&r1=790700&r2=790701&view=diff
==============================================================================
--- camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
(original)
+++ camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
Thu Jul  2 18:22:04 2009
@@ -20,6 +20,7 @@
 import java.util.Arrays;
 
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.util.ObjectHelper;
 
 public class IrcConfiguration implements Cloneable {
     private String target;
@@ -90,8 +91,15 @@
             throw new RuntimeCamelException("The IRC channel name is required but not configured");
         }
 
-        setTarget("#" + uri.getFragment());
-    }
+        String channel = uri.getFragment();
+
+        if ( channel.contains("?")) {
+            //Need to strip off the query string from this fragment
+            channel = ObjectHelper.before(uri.getFragment(), "?");
+        }
+
+        setTarget("#" + channel);
+}
 
     public String getHostname() {
         return hostname;

Modified: camel/trunk/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcRouteTest.java?rev=790701&r1=790700&r2=790701&view=diff
==============================================================================
--- camel/trunk/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcRouteTest.java
(original)
+++ camel/trunk/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcRouteTest.java
Thu Jul  2 18:22:04 2009
@@ -50,7 +50,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("irc://camel-con@irc.codehaus.org:6667/#camel-test").
+                from("irc://camel-con@irc.codehaus.org:6667/#camel-test?nickname=camel-con").
                         choice().
                         when(header(IrcConstants.IRC_MESSAGE_TYPE).isEqualTo("PRIVMSG")).to("mock:result").
                         when(header(IrcConstants.IRC_MESSAGE_TYPE).isEqualTo("JOIN")).to("seda:consumerJoined");
@@ -72,7 +72,7 @@
             sentMessages = true;
 
             // now the consumer has joined, lets send some messages
-            String sendUri = "irc://camel-prd@irc.codehaus.org:6667/#camel-test";
+            String sendUri = "irc://camel-prd@irc.codehaus.org:6667/#camel-test?nickname=camel-prd";
 
             template.sendBody(sendUri, body1);
             template.sendBody(sendUri, body2);



Mime
View raw message