camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r776198 - in /camel/trunk/components/camel-xmpp/src: main/java/org/apache/camel/component/xmpp/XmppBinding.java test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java
Date Tue, 19 May 2009 06:20:51 GMT
Author: davsclaus
Date: Tue May 19 06:20:51 2009
New Revision: 776198

URL: http://svn.apache.org/viewvc?rev=776198&view=rev
Log:
CAMEL-1624: camel-xmpp. Subject and Language now set if provided in Camel Message Header.

Modified:
    camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
    camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java

Modified: camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java?rev=776198&r1=776197&r2=776198&view=diff
==============================================================================
--- camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
(original)
+++ camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
Tue May 19 06:20:51 2009
@@ -56,7 +56,18 @@
             String name = entry.getKey();
             Object value = entry.getValue();
             if (!headerFilterStrategy.applyFilterToCamelHeaders(name, value, exchange)) {
-                message.setProperty(name, value);
+
+                if ("subject".equalsIgnoreCase(name)) {
+                    // special for subject
+                    String subject = exchange.getContext().getTypeConverter().convertTo(String.class,
value);
+                    message.setSubject(subject);
+                } else if ("language".equalsIgnoreCase(name)) {
+                    // special for language
+                    String language = exchange.getContext().getTypeConverter().convertTo(String.class,
value);
+                    message.setLanguage(language);
+                } else {
+                    message.setProperty(name, value);
+                }
             }
         }
         

Modified: camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java?rev=776198&r1=776197&r2=776198&view=diff
==============================================================================
--- camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java
(original)
+++ camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java
Tue May 19 06:20:51 2009
@@ -28,6 +28,12 @@
         result.assertIsSatisfied();
     }
     
+    public void xtestSendToGTalkWithSubject() throws Exception {
+        MockEndpoint result = getMockEndpoint("mock:result");
+        template.sendBodyAndHeader("direct:start", "Hi!", "Subject", "From Camel");
+        result.assertIsSatisfied();
+    }
+
     // get around junit warning
     public void testNothing() throws Exception {        
     }



Mime
View raw message