You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/02/25 09:22:09 UTC

[GitHub] [camel-quarkus] ppalaga opened a new pull request #2288: Test AWS 2 SES

ppalaga opened a new pull request #2288:
URL: https://github.com/apache/camel-quarkus/pull/2288


   cc @llowinge 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #2288: Test AWS 2 SES

Posted by GitBox <gi...@apache.org>.
aldettinger commented on a change in pull request #2288:
URL: https://github.com/apache/camel-quarkus/pull/2288#discussion_r582741115



##########
File path: integration-tests-aws2/README.adoc
##########
@@ -9,13 +17,18 @@ To run the tests against the real AWS API, you need to
   (access key ID and secret access key)
 * Export our preferred
   https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions[AWS region].
+* For SES, you additionally need a https://app.mailslurp.com/[MailSlurp account] and API key
+  (the free dev account should be anough)

Review comment:
       Small typo




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga merged pull request #2288: Test AWS 2 SES

Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #2288:
URL: https://github.com/apache/camel-quarkus/pull/2288


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on pull request #2288: Test AWS 2 SES

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #2288:
URL: https://github.com/apache/camel-quarkus/pull/2288#issuecomment-785858625


   3e702a1: fixed the typos


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2288: Test AWS 2 SES

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2288:
URL: https://github.com/apache/camel-quarkus/pull/2288#discussion_r582790918



##########
File path: integration-tests-aws2/README.adoc
##########
@@ -9,13 +17,18 @@ To run the tests against the real AWS API, you need to
   (access key ID and secret access key)
 * Export our preferred
   https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions[AWS region].
+* For SES, you additionally need a https://app.mailslurp.com/[MailSlurp account] and API key
+  (the free dev account should be anough)

Review comment:
       That's the dialect spoken by Slovaks living in South Moravia ;)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #2288: Test AWS 2 SES

Posted by GitBox <gi...@apache.org>.
aldettinger commented on a change in pull request #2288:
URL: https://github.com/apache/camel-quarkus/pull/2288#discussion_r582743987



##########
File path: integration-tests-aws2/aws2-ses/src/test/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesTest.java
##########
@@ -0,0 +1,196 @@
+/*
+ * 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.quarkus.component.aws2.ses.it;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import io.restassured.path.json.JsonPath;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
+import org.apache.camel.quarkus.test.support.aws2.Aws2Client;
+import org.apache.camel.quarkus.test.support.aws2.Aws2TestResource;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.assertj.core.api.Assertions;
+import org.awaitility.Awaitility;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.hamcrest.Matchers;
+import org.jboss.logging.Logger;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.testcontainers.containers.localstack.LocalStackContainer.Service;
+import software.amazon.awssdk.services.ses.SesClient;
+import software.amazon.awssdk.services.ses.model.DeleteVerifiedEmailAddressRequest;
+import software.amazon.awssdk.services.ses.model.VerifyEmailAddressRequest;
+
+//TODO disabled because of https://github.com/apache/camel-quarkus/issues/2216
+@EnabledIfEnvironmentVariable(named = "AWS_ACCESS_KEY", matches = "[a-zA-Z0-9]+")
+@EnabledIfEnvironmentVariable(named = "MAILSLURP_API_KEY", matches = "[a-zA-Z0-9]+")
+@QuarkusTest
+@QuarkusTestResource(Aws2TestResource.class)
+class Aws2SesTest {
+    private static final Logger LOG = Logger.getLogger(Aws2SesTest.class);
+
+    private static final Pattern VERIFCATION_LINK_PATTERN = Pattern.compile("https://email-verification[^\\s]+");
+
+    @Aws2Client(Service.SES)
+    SesClient sesClient;
+
+    @Test
+    public void test() throws InterruptedException, ExecutionException, TimeoutException {
+
+        /* First create a test mailbox at mailslurp.com */
+        final Config config = ConfigProvider.getConfig();
+        final String mailSlurpApiKey = config.getValue("mailslurp.api.key", String.class);
+        final JsonPath mailbox = RestAssured.given()
+                .header("x-api-key", mailSlurpApiKey)
+                .post("https://api.mailslurp.com:443/createInbox") //
+                .then()
+                .statusCode(201)
+                .extract()
+                .body()
+                .jsonPath();
+
+        final String mailSlurpAddress = mailbox.get("emailAddress");
+        final String mailboxId = mailbox.get("id");
+        LOG.infof("Using mailslurp inbox id: %s", mailboxId);
+
+        /* Second, verify the mailslurp.com mailbox address at SES */
+        try {
+            /* Send the verification e-mail to mailslurp.com */
+            sesClient.verifyEmailAddress(
+                    VerifyEmailAddressRequest.builder()
+                            .emailAddress(mailSlurpAddress)
+                            .build());
+
+            /* Await the verification e-mail at mailslurp.com */
+            List<String> messageIds = Awaitility.await()
+                    .pollDelay(1, TimeUnit.SECONDS)
+                    .pollInterval(1, TimeUnit.SECONDS)
+                    .atMost(120, TimeUnit.SECONDS)
+                    .until(
+                            () -> {
+                                final ExtractableResponse<Response> response = RestAssured.given()
+                                        .header("x-api-key", mailSlurpApiKey)
+                                        .get("https://api.mailslurp.com:443/inboxes/" + mailboxId + "/emails") //
+                                        .then()
+                                        .statusCode(200)
+                                        .extract();
+                                final List<String> ids = response.jsonPath().getList("id");
+                                LOG.infof("Expected an indentity verification message from SES; got %s",

Review comment:
       Small typo




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org