You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ha...@apache.org on 2012/01/20 22:57:14 UTC

svn commit: r1234164 - in /camel/branches/camel-2.9.x: ./ components/camel-krati/src/main/java/org/apache/camel/component/krati/ components/camel-krati/src/test/java/org/apache/camel/component/krati/

Author: hadrian
Date: Fri Jan 20 21:57:14 2012
New Revision: 1234164

URL: http://svn.apache.org/viewvc?rev=1234164&view=rev
Log:
Merged revisions 1230389 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1230389 | iocanel | 2012-01-11 22:49:59 -0500 (Wed, 11 Jan 2012) | 1 line
  
  [CAMEL-4889] KratiProducer now accepts non-string keys. Added a unit test to test producer with non-string keys.
........

Added:
    camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/KeyObject.java
      - copied unchanged from r1230389, camel/trunk/components/camel-krati/src/test/java/org/apache/camel/component/krati/KeyObject.java
    camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/ValueObject.java
      - copied unchanged from r1230389, camel/trunk/components/camel-krati/src/test/java/org/apache/camel/component/krati/ValueObject.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java
    camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/KratiProducerTest.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java?rev=1234164&r1=1234163&r2=1234164&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java (original)
+++ camel/branches/camel-2.9.x/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java Fri Jan 20 21:57:14 2012
@@ -39,7 +39,7 @@ public class KratiProducer extends Defau
 
     public void process(Exchange exchange) throws Exception {
         String operation = getOperation(exchange);
-        String key = getKey(exchange);
+        Object key = getKey(exchange);
 
         LOG.trace("Processing {} operation on '[{}]'", operation, exchange);
         if (KratiConstants.KRATI_OPERATION_GET.equals(operation) && key != null) {
@@ -94,11 +94,11 @@ public class KratiProducer extends Defau
      * @param exchange
      * @return
      */
-    public String getKey(Exchange exchange) {
-        String key = ((KratiEndpoint) getEndpoint()).getKey();
+    public Object getKey(Exchange exchange) {
+        Object key = ((KratiEndpoint) getEndpoint()).getKey();
 
         if (exchange.getIn().getHeader(KratiConstants.KEY) != null) {
-            key = (String) exchange.getIn().getHeader(KratiConstants.KEY);
+            key =  exchange.getIn().getHeader(KratiConstants.KEY);
         }
         return key;
     }

Modified: camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/KratiProducerTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/KratiProducerTest.java?rev=1234164&r1=1234163&r2=1234164&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/KratiProducerTest.java (original)
+++ camel/branches/camel-2.9.x/components/camel-krati/src/test/java/org/apache/camel/component/krati/KratiProducerTest.java Fri Jan 20 21:57:14 2012
@@ -28,9 +28,9 @@ public class KratiProducerTest extends C
     @Test
     public void testPut() throws InterruptedException {
         ProducerTemplate template = context.createProducerTemplate();
-        template.sendBodyAndHeader("direct:put", "TEST1", KratiConstants.KEY, "1");
-        template.sendBodyAndHeader("direct:put", "TEST2", KratiConstants.KEY, "2");
-        template.sendBodyAndHeader("direct:put", "TEST3", KratiConstants.KEY, "3");
+        template.sendBodyAndHeader("direct:put", new ValueObject("TEST1"), KratiConstants.KEY, new KeyObject("1"));
+        template.sendBodyAndHeader("direct:put", new ValueObject("TEST2"), KratiConstants.KEY, new KeyObject("2"));
+        template.sendBodyAndHeader("direct:put", new ValueObject("TEST3"), KratiConstants.KEY, new KeyObject("3"));
         MockEndpoint endpoint = context.getEndpoint("mock:results", MockEndpoint.class);
         endpoint.expectedMessageCount(3);
         endpoint.assertIsSatisfied();
@@ -40,11 +40,11 @@ public class KratiProducerTest extends C
     @Test
     public void testPutAndGet() throws InterruptedException {
         ProducerTemplate template = context.createProducerTemplate();
-        template.sendBodyAndHeader("direct:put", "TEST1", KratiConstants.KEY, "1");
-        template.sendBodyAndHeader("direct:put", "TEST2", KratiConstants.KEY, "2");
-        template.sendBodyAndHeader("direct:put", "TEST3", KratiConstants.KEY, "3");
-        Object result = template.requestBodyAndHeader("direct:get", null, KratiConstants.KEY, "3");
-        assertEquals("TEST3", result);
+        template.sendBodyAndHeader("direct:put", new ValueObject("TEST1"), KratiConstants.KEY, new KeyObject("1"));
+        template.sendBodyAndHeader("direct:put", new ValueObject("TEST2"), KratiConstants.KEY, new KeyObject("2"));
+        template.sendBodyAndHeader("direct:put", new ValueObject("TEST3"), KratiConstants.KEY, new KeyObject("3"));
+        Object result = template.requestBodyAndHeader("direct:get", null, KratiConstants.KEY, new KeyObject("3"));
+        assertEquals(new ValueObject("TEST3"), result);
     }
 
     @Test