This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 8f82205 Restore RemoteProducerIT test 8f82205 is described below commit 8f8220538b63de1a5d22a98f6183aae8090bc8e4 Author: Federico Mariani <fmari...@redhat.com> AuthorDate: Mon Oct 18 12:38:09 2021 +0200 Restore RemoteProducerIT test Update Atlasmap to version 2.3.1 (#6282) (chores) camel-cxf: fix test failure in Camel1145RouteTest due to fixed port usage CAMEL-17089: Upgrade gRPC to 1.41.0 CAMEL-17081: Upgrade Infinispan to 13.0.0 CAMEL-17090: Release view only on shutdown or after no routes left in policy (#6290) * CAMEL-17090: Release view only on shutdown and after no routes left in policy * CAMEL-17090: Fix formatting CAMEL-17095: camel-resilience4j - Using timeout and bulkhead together does not work CAMEL-17098: Upgrade to CXF 3.4.5 Upgrade AWS SDK v2 to version 2.17.61 Sync deps Upgrade JGit to version 5.13.0.202109080827-r Sync deps CAMEL-16861: Cleanup and update EIP docs CAMEL-16861: Cleanup and update EIP docs Regen for commit 77db8477b20baeb949f83f877082e06a944c24bc Signed-off-by: GitHub <nore...@github.com> Restore InfinispanRemoteProducerIT test --- .../remote/InfinispanRemoteProducerIT.java | 106 +++++++++++++++++++++ .../services/InfinispanLocalContainerService.java | 3 + .../src/test/resources/infinispan.xml | 72 ++++++++++++++ 3 files changed, 181 insertions(+) diff --git a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerIT.java b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerIT.java new file mode 100644 index 0000000..b318ac5 --- /dev/null +++ b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerIT.java @@ -0,0 +1,106 @@ +/* + * 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.remote; + +import java.util.function.BiFunction; + +import org.apache.camel.BindToRegistry; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.infinispan.InfinispanConstants; +import org.apache.camel.component.infinispan.InfinispanOperation; +import org.apache.camel.component.infinispan.InfinispanProducerTestSupport; +import org.infinispan.client.hotrod.ServerStatistics; +import org.infinispan.commons.api.BasicCache; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@DisabledOnOs(OS.MAC) +public class InfinispanRemoteProducerIT extends InfinispanRemoteTestSupport implements InfinispanProducerTestSupport { + + @BindToRegistry("mappingFunction") + public static BiFunction<String, String, String> mappingFunction() { + return (k, v) -> v + "replay"; + } + + @Test + public void statsOperation() { + fluentTemplate() + .to("direct:start") + .withHeader(InfinispanConstants.KEY, InfinispanProducerTestSupport.KEY_ONE) + .withHeader(InfinispanConstants.VALUE, InfinispanProducerTestSupport.VALUE_ONE) + .withHeader(InfinispanConstants.OPERATION, InfinispanOperation.PUT) + .send(); + + assertEquals(InfinispanProducerTestSupport.VALUE_ONE, getCache().get(InfinispanProducerTestSupport.KEY_ONE)); + + fluentTemplate() + .to("direct:start") + .withHeader(InfinispanConstants.KEY, InfinispanProducerTestSupport.KEY_TWO) + .withHeader(InfinispanConstants.VALUE, InfinispanProducerTestSupport.VALUE_TWO) + .withHeader(InfinispanConstants.OPERATION, InfinispanOperation.PUT) + .send(); + + assertEquals(InfinispanProducerTestSupport.VALUE_TWO, getCache().get(InfinispanProducerTestSupport.KEY_TWO)); + + assertEquals( + 2, + fluentTemplate() + .to("direct:start") + .withHeader(InfinispanConstants.OPERATION, InfinispanOperation.STATS) + .request(ServerStatistics.class) + .getIntStatistic(ServerStatistics.CURRENT_NR_OF_ENTRIES)); + } + + // ***************************** + // + // ***************************** + + @BeforeEach + protected void beforeEach() { + // cleanup the default test cache before each run + getCache().clear(); + } + + @Override + public BasicCache<Object, Object> getCache() { + return super.getCache(); + } + + @Override + public BasicCache<Object, Object> getCache(String name) { + return super.getCache(name); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() { + from("direct:start") + .toF("infinispan:%s", getCacheName()); + from("direct:compute") + .toF("infinispan:%s?remappingFunction=#mappingFunction", getCacheName()); + from("direct:explicitput") + .toF("infinispan:%s?operation=PUT&key=a&value=3", getCacheName()); + } + }; + } +} diff --git a/test-infra/camel-test-infra-infinispan/src/test/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerService.java b/test-infra/camel-test-infra-infinispan/src/test/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerService.java index 7fa4c0a..ec2ba54 100644 --- a/test-infra/camel-test-infra-infinispan/src/test/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerService.java +++ b/test-infra/camel-test-infra-infinispan/src/test/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerService.java @@ -22,6 +22,7 @@ import org.apache.camel.test.infra.common.services.ContainerService; import org.apache.camel.test.infra.infinispan.common.InfinispanProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.OutputFrame; import org.testcontainers.containers.output.Slf4jLogConsumer; @@ -58,6 +59,8 @@ public class InfinispanLocalContainerService implements InfinispanService, Conta .withEnv("USER", DEFAULT_USERNAME) .withEnv("PASS", DEFAULT_PASSWORD) .withLogConsumer(logConsumer) + .withClasspathResourceMapping("infinispan.xml", "/user-config/infinispan.xml", BindMode.READ_ONLY) + .withCommand("-c", "/user-config/infinispan.xml") .withExposedPorts(InfinispanProperties.DEFAULT_SERVICE_PORT) .waitingFor(Wait.forListeningPort()) .waitingFor(Wait.forLogMessage(".*Infinispan.*Server.*started.*", 1)); diff --git a/test-infra/camel-test-infra-infinispan/src/test/resources/infinispan.xml b/test-infra/camel-test-infra-infinispan/src/test/resources/infinispan.xml new file mode 100644 index 0000000..d82c7e9 --- /dev/null +++ b/test-infra/camel-test-infra-infinispan/src/test/resources/infinispan.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:infinispan:config:13.0 https://infinispan.org/schemas/infinispan-config-13.0.xsd + urn:infinispan:server:13.0 https://infinispan.org/schemas/infinispan-server-13.0.xsd" + xmlns="urn:infinispan:config:13.0" + xmlns:server="urn:infinispan:server:13.0"> + + <cache-container name="default" statistics="true"> + <metrics accurate-size="true"/> + <transport cluster="${infinispan.cluster.name:cluster}" stack="${infinispan.cluster.stack:tcp}" node-name="${infinispan.node.name:}"/> + <security> + <authorization/> + </security> + </cache-container> + + <server xmlns="urn:infinispan:server:13.0"> + <interfaces> + <interface name="public"> + <inet-address value="${infinispan.bind.address:127.0.0.1}"/> + </interface> + </interfaces> + + <socket-bindings default-interface="public" port-offset="${infinispan.socket.binding.port-offset:0}"> + <socket-binding name="default" port="${infinispan.bind.port:11222}"/> + <socket-binding name="memcached" port="11221"/> + </socket-bindings> + + <security> + <credential-stores> + <credential-store name="credentials" path="credentials.pfx"> + <clear-text-credential clear-text="secret"/> + </credential-store> + </credential-stores> + <security-realms> + <security-realm name="default"> + <!-- Uncomment to enable TLS on the realm --> + <!-- server-identities> + <ssl> + <keystore path="application.keystore" + password="password" alias="server" + generate-self-signed-certificate-host="localhost"/> + </ssl> + </server-identities--> + <properties-realm groups-attribute="Roles"> + <user-properties path="users.properties"/> + <group-properties path="groups.properties"/> + </properties-realm> + </security-realm> + </security-realms> + </security> + + <endpoints socket-binding="default" security-realm="default"/> + </server> +</infinispan>