camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r676208 - in /activemq/camel/trunk/components/camel-xmpp/src: main/java/org/apache/camel/component/xmpp/ test/java/org/apache/camel/component/xmpp/
Date Sat, 12 Jul 2008 18:17:08 GMT
Author: hadrian
Date: Sat Jul 12 11:17:08 2008
New Revision: 676208

URL: http://svn.apache.org/viewvc?rev=676208&view=rev
Log:
CAMEL-705.  Patch applied with thanks!


Modified:
    activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
    activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java
    activemq/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/UriConfigurationTest.java

Modified: activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java?rev=676208&r1=676207&r2=676208&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
(original)
+++ activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
Sat Jul 12 11:17:08 2008
@@ -49,6 +49,7 @@
     private boolean createAccount;
     private String room;
     private String participant;
+    private String nickname;
 
     public XmppEndpoint(String uri, XmppComponent component) {
         super(uri, component);
@@ -188,6 +189,14 @@
     public void setParticipant(String participant) {
         this.participant = participant;
     }
+    
+    public String getNickname() {
+    	return nickname;
+    }
+    
+    public void setNickname(String nickname) {
+    	this.nickname = nickname;
+    }
 
     public XMPPConnection getConnection() throws XMPPException {
         if (connection == null) {

Modified: activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java?rev=676208&r1=676207&r2=676208&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java
(original)
+++ activemq/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java
Sat Jul 12 11:17:08 2008
@@ -64,7 +64,10 @@
         super.doStart();
         if (chat == null) {
         	chat = new MultiUserChat(endpoint.getConnection(), room);
-        	chat.join(this.endpoint.getResource());
+        	String nickname = this.endpoint.getNickname();
+        	if(nickname == null)
+        		nickname = this.endpoint.getUser();
+        	chat.join(nickname);
         }
     }
 

Modified: activemq/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/UriConfigurationTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/UriConfigurationTest.java?rev=676208&r1=676207&r2=676208&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/UriConfigurationTest.java
(original)
+++ activemq/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/UriConfigurationTest.java
Sat Jul 12 11:17:08 2008
@@ -42,7 +42,7 @@
     }
 
     public void testGroupChatConfiguration() throws Exception {
-        Endpoint endpoint = context.getEndpoint("xmpp://camel-user@im.google.com:123?room=cheese&password=secret");
+        Endpoint endpoint = context.getEndpoint("xmpp://camel-user@im.google.com:123?room=cheese&password=secret&nickname=incognito");
         assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
         XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;
 
@@ -52,5 +52,18 @@
         assertEquals("camel-user", xmppEndpoint.getUser());
         assertEquals("cheese", xmppEndpoint.getRoom());
         assertEquals("secret", xmppEndpoint.getPassword());
+        assertEquals("incognito", xmppEndpoint.getNickname());
+    }
+    
+    // Changes in default resource name may break
+    // clients program assuming the default "Camel" resource name
+    // so it is better to avoid changing it.
+    public void testDefaultResource() throws Exception {
+        Endpoint endpoint = context.getEndpoint("xmpp://camel-user@im.google.com?password=secret");
+        assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
+        XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;
+
+        assertEquals("Camel", xmppEndpoint.getResource());
+    	
     }
 }



Mime
View raw message