You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/10/07 06:43:22 UTC

[camel] branch master updated (9cbb9a4 -> a513317)

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

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 9cbb9a4  CAMEL-15496: Fixed wrong filter
     new 9fd8fbf  Camel-Infinispan: Added more testcontainers tests for Infinispan producer
     new a513317  Camel-Infinispan: Added more testcontainers tests for Infinispan producer

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...panTestContainersGetOrDefaultProducerTest.java} | 26 +++++++++++++++-------
 ...nfinispanTestContainersRemoveProducerTest.java} | 13 ++++++-----
 2 files changed, 25 insertions(+), 14 deletions(-)
 copy components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/{InfinispanTestContainersProducerTest.java => InfinispanTestContainersGetOrDefaultProducerTest.java} (73%)
 copy components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/{InfinispanTestContainersPutIfAbsentProducerTest.java => InfinispanTestContainersRemoveProducerTest.java} (85%)


[camel] 01/02: Camel-Infinispan: Added more testcontainers tests for Infinispan producer

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9fd8fbf20a3151ec9ad010d8161471ea65dfe6f9
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 7 08:27:23 2020 +0200

    Camel-Infinispan: Added more testcontainers tests for Infinispan producer
---
 ...spanTestContainersGetOrDefaultProducerTest.java | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/InfinispanTestContainersGetOrDefaultProducerTest.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/InfinispanTestContainersGetOrDefaultProducerTest.java
new file mode 100644
index 0000000..263f3e0
--- /dev/null
+++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/InfinispanTestContainersGetOrDefaultProducerTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.infinispan.testcontainers;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.infinispan.InfinispanConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.junit.Before;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class InfinispanTestContainersGetOrDefaultProducerTest extends InfinispanTestContainerSupport {
+
+    private static final String COMMAND_VALUE = "commandValue";
+    private static final String COMMAND_KEY = "commandKey1";
+    private static final String COMMAND_KEY_OTHER = "commandKey2";
+    private RemoteCacheManager remoteCacheManager;
+
+    @EndpointInject("mock:result")
+    private MockEndpoint result;
+
+    @Before
+    public void doPreSetup() {
+        remoteCacheManager = createAndGetDefaultCache();
+    }
+
+    @Test
+    public void testUriCommandOption() throws Exception {
+        template.send("direct:put", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+                exchange.getIn().setHeader(InfinispanConstants.VALUE, COMMAND_VALUE);
+            }
+        });
+
+        template.send("direct:getOrDefault", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY_OTHER);
+                exchange.getIn().setHeader(InfinispanConstants.DEFAULT_VALUE, "Test");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+        assertEquals(1, result.getExchanges().size());
+        assertEquals("Test", result.getExchanges().get(0).getMessage().getBody(String.class));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:put")
+                        .to("infinispan:mycache?hosts=" + getInfispanUrl()
+                            + "&operation=PUT&username=admin&password=password&secure=true&saslMechanism=RAW(DIGEST-MD5)&securityRealm=default&securityServerName=infinispan");
+                from("direct:getOrDefault")
+                        .to("infinispan:mycache?hosts=" + getInfispanUrl()
+                            + "&operation=GETORDEFAULT&username=admin&password=password&secure=true&saslMechanism=RAW(DIGEST-MD5)&securityRealm=default&securityServerName=infinispan")
+                        .to("mock:result");
+                ;
+            }
+        };
+    }
+}


[camel] 02/02: Camel-Infinispan: Added more testcontainers tests for Infinispan producer

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a513317472a89d0c88e8a10e836b4177bfbb1004
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 7 08:38:39 2020 +0200

    Camel-Infinispan: Added more testcontainers tests for Infinispan producer
---
 ...InfinispanTestContainersRemoveProducerTest.java | 94 ++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/InfinispanTestContainersRemoveProducerTest.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/InfinispanTestContainersRemoveProducerTest.java
new file mode 100644
index 0000000..513d962
--- /dev/null
+++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/testcontainers/InfinispanTestContainersRemoveProducerTest.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.infinispan.testcontainers;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.infinispan.InfinispanConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.junit.Before;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class InfinispanTestContainersRemoveProducerTest extends InfinispanTestContainerSupport {
+
+    private static final String COMMAND_VALUE = "commandValue";
+    private static final String COMMAND_KEY = "commandKey1";
+    private RemoteCacheManager remoteCacheManager;
+
+    @EndpointInject("mock:result")
+    private MockEndpoint result;
+
+    @Before
+    public void doPreSetup() {
+        remoteCacheManager = createAndGetDefaultCache();
+    }
+
+    @Test
+    public void testUriCommandOption() throws Exception {
+        template.send("direct:put", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+                exchange.getIn().setHeader(InfinispanConstants.VALUE, COMMAND_VALUE);
+            }
+        });
+
+        template.send("direct:remove", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+            }
+        });
+
+        template.send("direct:get", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+        assertEquals(1, result.getExchanges().size());
+        assertNull(result.getExchanges().get(0).getMessage().getBody(String.class));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:put")
+                        .to("infinispan:mycache?hosts=" + getInfispanUrl()
+                            + "&operation=PUT&username=admin&password=password&secure=true&saslMechanism=RAW(DIGEST-MD5)&securityRealm=default&securityServerName=infinispan");
+                from("direct:remove")
+                        .to("infinispan:mycache?hosts=" + getInfispanUrl()
+                            + "&operation=REMOVE&username=admin&password=password&secure=true&saslMechanism=RAW(DIGEST-MD5)&securityRealm=default&securityServerName=infinispan");
+                from("direct:get")
+                        .to("infinispan:mycache?hosts=" + getInfispanUrl()
+                            + "&operation=GET&username=admin&password=password&secure=true&saslMechanism=RAW(DIGEST-MD5)&securityRealm=default&securityServerName=infinispan")
+                        .to("mock:result");
+                ;
+            }
+        };
+    }
+}