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/09/24 15:01:21 UTC

[camel] branch master updated (fb47e92 -> 0433ebe)

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 fb47e92  CAMEL-15571 The order of loading settings is changed in the method AbstractLocationPropertiesSource::loadProperties(Predicate) (#4286)
     new 5a737ad  Camel-AWS2-Eventbridge: Adding more tests with localstack and Testcontainers
     new 0433ebe  Camel-AWS2-Eventbridge: More work on tests

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:
 ...va => EventbridgeDeleteRuleLocalstackTest.java} | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
 copy components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/{EventbridgePutRuleLocalstackTest.java => EventbridgeDeleteRuleLocalstackTest.java} (78%)


[camel] 01/02: Camel-AWS2-Eventbridge: Adding more tests with localstack and Testcontainers

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 5a737ad7ce8e81f534b0f15c0f650659daded5fa
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Sep 24 14:17:40 2020 +0200

    Camel-AWS2-Eventbridge: Adding more tests with localstack and Testcontainers
---
 .../EventbridgeDeleteRuleLocalstackTest.java       | 97 ++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java b/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java
new file mode 100644
index 0000000..8fa9203
--- /dev/null
+++ b/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.aws2.eventbridge.localstack;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.aws2.eventbridge.EventbridgeConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import software.amazon.awssdk.services.eventbridge.model.DeleteRuleResponse;
+import software.amazon.awssdk.services.eventbridge.model.Target;
+
+public class EventbridgeDeleteRuleLocalstackTest extends Aws2EventbridgeBaseTest {
+
+    @EndpointInject
+    private ProducerTemplate template;
+
+    @EndpointInject("mock:result")
+    private MockEndpoint result;
+
+    @Test
+    public void sendIn() throws Exception {
+        result.expectedMessageCount(1);
+
+        template.send("direct:evs", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+            }
+        });
+
+        template.send("direct:evs-targets", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+                Target target = Target.builder().id("sqs-queue").arn("arn:aws:sqs:eu-west-1:780410022472:camel-connector-test")
+                        .build();
+                List<Target> targets = new ArrayList<Target>();
+                targets.add(target);
+                exchange.getIn().setHeader(EventbridgeConstants.TARGETS, targets);
+            }
+        });
+        
+        Exchange ex = template.send("direct:evs-deleteRule", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+            }
+        });
+        assertMockEndpointsSatisfied();
+        assertNotNull(ex.getIn().getBody(DeleteRuleResponse.class));
+
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                String awsEndpoint
+                        = "aws2-eventbridge://default?operation=putRule&eventPatternFile=file:src/test/resources/eventpattern.json";
+                String target = "aws2-eventbridge://default?operation=putTargets";
+                String deleteRule = "aws2-eventbridge://default?operation=deleteRule";
+                from("direct:evs").to(awsEndpoint);
+                from("direct:evs-targets").to(target);
+                from("direct:evs-deleteRule").to(deleteRule).to("mock:result");
+            }
+        };
+    }
+}


[camel] 02/02: Camel-AWS2-Eventbridge: More work on tests

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 0433ebe297be96ca23a36c465db4687af43b7419
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Sep 24 14:26:13 2020 +0200

    Camel-AWS2-Eventbridge: More work on tests
---
 .../localstack/EventbridgeDeleteRuleLocalstackTest.java           | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java b/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java
index 8fa9203..0fe03d3 100644
--- a/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java
+++ b/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeDeleteRuleLocalstackTest.java
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.aws2.eventbridge.localstack;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -30,10 +27,11 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.eventbridge.EventbridgeConstants;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.jupiter.api.Test;
-
 import software.amazon.awssdk.services.eventbridge.model.DeleteRuleResponse;
 import software.amazon.awssdk.services.eventbridge.model.Target;
 
+import static org.junit.Assert.assertNotNull;
+
 public class EventbridgeDeleteRuleLocalstackTest extends Aws2EventbridgeBaseTest {
 
     @EndpointInject
@@ -66,7 +64,7 @@ public class EventbridgeDeleteRuleLocalstackTest extends Aws2EventbridgeBaseTest
                 exchange.getIn().setHeader(EventbridgeConstants.TARGETS, targets);
             }
         });
-        
+
         Exchange ex = template.send("direct:evs-deleteRule", new Processor() {
 
             @Override