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 2021/08/24 11:41:37 UTC

[camel] branch main updated (5e9b988 -> 5acd7a1)

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

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


    from 5e9b988  Regen
     new 3afee7e  CAMEL-16392 - Added some tests
     new 9fd14ca  CAMEL-16392 - Added some tests
     new 5acd7a1  CAMEL-16392 - Added some tests

The 3 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:
 ...rInIT.java => PulsarConsumerInURIClientIT.java} | 39 +++----------------
 ...cerInIT.java => PulsarProducerURIClientIT.java} | 44 +++++-----------------
 2 files changed, 16 insertions(+), 67 deletions(-)
 copy components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/{PulsarConsumerInIT.java => PulsarConsumerInURIClientIT.java} (67%)
 copy components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/{PulsarProducerInIT.java => PulsarProducerURIClientIT.java} (63%)

[camel] 03/03: CAMEL-16392 - Added some tests

Posted by ac...@apache.org.
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

commit 5acd7a1bc17cd478454ee349db6afac08942ce01
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Aug 24 13:40:57 2021 +0200

    CAMEL-16392 - Added some tests
---
 .../pulsar/integration/PulsarConsumerInURIClientIT.java      | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.java
index c82f4bc..a776b7f 100644
--- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.java
+++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.java
@@ -16,16 +16,13 @@
  */
 package org.apache.camel.component.pulsar.integration;
 
-import org.apache.camel.Endpoint;
+import java.util.concurrent.TimeUnit;
+
 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.mock.MockEndpoint;
-import org.apache.camel.component.pulsar.PulsarComponent;
-import org.apache.camel.component.pulsar.utils.AutoConfiguration;
-import org.apache.camel.spi.Registry;
-import org.apache.camel.support.SimpleRegistry;
 import org.apache.pulsar.client.api.Producer;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.api.PulsarClientException;
@@ -35,8 +32,6 @@ import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.concurrent.TimeUnit;
-
 public class PulsarConsumerInURIClientIT extends PulsarITSupport {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerInURIClientIT.class);
@@ -44,7 +39,8 @@ public class PulsarConsumerInURIClientIT extends PulsarITSupport {
     private static final String TOPIC_URI = "persistent://public/default/camel-topic";
     private static final String PRODUCER = "camel-producer-1";
     private static final String URI_ENDPOINT = "pulsar:" + TOPIC_URI + "?numberOfConsumers=1&subscriptionType=Exclusive"
-            + "&subscriptionName=camel-subscription&consumerQueueSize=1&consumerName=camel-consumer&serviceUrl=" + service.getPulsarBrokerUrl();
+                                               + "&subscriptionName=camel-subscription&consumerQueueSize=1&consumerName=camel-consumer&serviceUrl="
+                                               + service.getPulsarBrokerUrl();
 
     @EndpointInject("mock:result")
     private MockEndpoint to;

[camel] 01/03: CAMEL-16392 - Added some tests

Posted by ac...@apache.org.
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

commit 3afee7e8582951549db83467ff56115935ca240e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Aug 24 13:10:34 2021 +0200

    CAMEL-16392 - Added some tests
---
 .../integration/PulsarProducerURIClientIT.java     | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarProducerURIClientIT.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarProducerURIClientIT.java
new file mode 100644
index 0000000..a5d62d5
--- /dev/null
+++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarProducerURIClientIT.java
@@ -0,0 +1,75 @@
+/*
+ * 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.pulsar.integration;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.PulsarClientException;
+import org.apache.pulsar.client.impl.ClientBuilderImpl;
+import org.junit.jupiter.api.Test;
+
+public class PulsarProducerURIClientIT extends PulsarITSupport {
+
+    private static final String TOPIC_URI = "persistent://public/default/camel-producer-topic";
+    private static final String PRODUCER = "camel-producer";
+    private static final String URI_ENDPOINT = "pulsar:" + TOPIC_URI + "?numberOfConsumers=1&subscriptionType=Exclusive"
+                                               + "&subscriptionName=camel-subscription&consumerQueueSize=1"
+                                               + "&consumerName=camel-consumer" + "&producerName=" + PRODUCER + "&serviceUrl="
+                                               + service.getPulsarBrokerUrl();
+
+    @Produce("direct:start")
+    private ProducerTemplate producerTemplate;
+
+    @EndpointInject("mock:result")
+    private MockEndpoint to;
+
+    public PulsarProducerURIClientIT() {
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() {
+                from("direct:start").to(URI_ENDPOINT);
+                from(URI_ENDPOINT).to(to);
+            }
+        };
+    }
+
+    private PulsarClient givenPulsarClient() throws PulsarClientException {
+        return new ClientBuilderImpl().serviceUrl(getPulsarBrokerUrl()).ioThreads(1).listenerThreads(1).build();
+    }
+
+    @Test
+    public void testAMessageToRouteIsSentAndThenConsumed() throws Exception {
+        to.expectedMessageCount(3);
+
+        producerTemplate.sendBody("Hello ");
+        producerTemplate.sendBody("World ");
+        producerTemplate.sendBody(10);
+
+        MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
+    }
+}

[camel] 02/03: CAMEL-16392 - Added some tests

Posted by ac...@apache.org.
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

commit 9fd14ca78e3d34c2b3f11af5ef050f5b630edafa
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Aug 24 13:16:41 2021 +0200

    CAMEL-16392 - Added some tests
---
 .../integration/PulsarConsumerInURIClientIT.java   | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.java
new file mode 100644
index 0000000..c82f4bc
--- /dev/null
+++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarConsumerInURIClientIT.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.pulsar.integration;
+
+import org.apache.camel.Endpoint;
+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.mock.MockEndpoint;
+import org.apache.camel.component.pulsar.PulsarComponent;
+import org.apache.camel.component.pulsar.utils.AutoConfiguration;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.SimpleRegistry;
+import org.apache.pulsar.client.api.Producer;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.PulsarClientException;
+import org.apache.pulsar.client.api.Schema;
+import org.apache.pulsar.client.impl.ClientBuilderImpl;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.TimeUnit;
+
+public class PulsarConsumerInURIClientIT extends PulsarITSupport {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerInURIClientIT.class);
+
+    private static final String TOPIC_URI = "persistent://public/default/camel-topic";
+    private static final String PRODUCER = "camel-producer-1";
+    private static final String URI_ENDPOINT = "pulsar:" + TOPIC_URI + "?numberOfConsumers=1&subscriptionType=Exclusive"
+            + "&subscriptionName=camel-subscription&consumerQueueSize=1&consumerName=camel-consumer&serviceUrl=" + service.getPulsarBrokerUrl();
+
+    @EndpointInject("mock:result")
+    private MockEndpoint to;
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            Processor processor = new Processor() {
+                @Override
+                public void process(final Exchange exchange) {
+                    LOGGER.info("Processing message {}", exchange.getIn().getBody());
+                }
+            };
+
+            @Override
+            public void configure() {
+                from(URI_ENDPOINT).to(to).process(processor);
+            }
+        };
+    }
+
+    private PulsarClient givenPulsarClient() throws PulsarClientException {
+        return new ClientBuilderImpl().serviceUrl(getPulsarBrokerUrl()).ioThreads(1).listenerThreads(1).build();
+    }
+
+    @Test
+    public void testAMessageToClusterIsConsumed() throws Exception {
+        to.expectedMessageCount(1);
+
+        Producer<String> producer
+                = givenPulsarClient().newProducer(Schema.STRING).producerName(PRODUCER).topic(TOPIC_URI).create();
+
+        producer.send("Hello World!");
+
+        MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
+    }
+}