This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch infinispan-key
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0cb2e9d27d333a075f854433256b7e6f63a3d8c9
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Oct 1 18:13:34 2020 +0200

    CAMEL-15609 - Camel-Infinispan: Add an explicit key uri parameter for 
producer, added tests
---
 .../infinispan/InfinispanProducerTest.java         | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git 
a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
 
b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
index fe9a2c8..e6ff2de 100644
--- 
a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
+++ 
b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
@@ -1071,6 +1071,34 @@ public class InfinispanProducerTest extends 
InfinispanTestSupport {
         Stats resultStats = exchange.getIn().getBody(Stats.class);
         assertEquals(2L, resultStats.getTotalNumberOfEntries());
     }
+    
+    @Test
+    public void 
publishKeyAndValueByExplicitlySpecifyingTheKeyAndValueOptions() throws 
Exception {
+        template.send("direct:explicitput", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.OPERATION, 
InfinispanOperation.PUT);
+            }
+        });
+
+        Object value = currentCache().get("a");
+        assertEquals("3", value.toString());
+    }
+    
+    @Test
+    public void 
publishKeyAndValueByExplicitlySpecifyingTheKeyAndValueOptionsHeaderHavePriorities()
 throws Exception {
+        template.send("direct:explicitput", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.KEY, KEY_ONE);
+                exchange.getIn().setHeader(InfinispanConstants.VALUE, 
VALUE_ONE);
+                exchange.getIn().setHeader(InfinispanConstants.OPERATION, 
InfinispanOperation.PUT);
+            }
+        });
+
+        Object value = currentCache().get("a");
+        assertEquals("3", value.toString());
+    }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
@@ -1121,6 +1149,8 @@ public class InfinispanProducerTest extends 
InfinispanTestSupport {
                         
.to("infinispan:default?cacheContainer=#cacheContainer&operation=COMPUTE&remappingFunction=#mappingFunction");
                 from("direct:computeAsync")
                         
.to("infinispan:default?cacheContainer=#cacheContainer&operation=COMPUTEASYNC&remappingFunction=#mappingFunction");
+                from("direct:explicitput")
+                        
.to("infinispan:default?cacheContainer=#cacheContainer&operation=PUT&key=a&value=3");
             }
         };
     }

Reply via email to