You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/05/06 15:25:43 UTC

[camel-quarkus] branch 2.7.x updated (45f75f0e24 -> e1935c1df3)

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

jamesnetherton pushed a change to branch 2.7.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


    from 45f75f0e24 paho: add test case for RFC3986 style urls #3758
     new 423e951f7a Use DisabledOnIntegrationTest instead of deprecated DisabledOnNativeImage annotation
     new e1935c1df3 Fix verification of AWS S3 download links

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:
 .../aws2-quarkus-client/aws2-s3/pom.xml            |  2 +-
 .../aws2/s3/it/AwsS3PresignerProducer.java         | 60 ++++++++++++++++++++++
 .../quarkus/component/aws2/s3/it/Aws2S3Test.java   | 25 +++------
 .../quarkus/component/atlasmap/it/AtlasmapIT.java  |  1 -
 .../aws2-quarkus-client-grouped/pom.xml            |  2 +-
 .../component/freemarker/it/FreemarkerTest.java    |  6 +--
 .../component/xmlsecurity/it/XmlsecurityTest.java  |  4 +-
 7 files changed, 75 insertions(+), 25 deletions(-)
 create mode 100644 integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/AwsS3PresignerProducer.java


[camel-quarkus] 01/02: Use DisabledOnIntegrationTest instead of deprecated DisabledOnNativeImage annotation

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

jamesnetherton pushed a commit to branch 2.7.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 423e951f7a43c95086abce7c7d3ce16d9ae57656
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed May 4 12:41:51 2022 +0100

    Use DisabledOnIntegrationTest instead of deprecated DisabledOnNativeImage annotation
---
 .../org/apache/camel/quarkus/component/atlasmap/it/AtlasmapIT.java  | 1 -
 .../camel/quarkus/component/freemarker/it/FreemarkerTest.java       | 6 +++---
 .../camel/quarkus/component/xmlsecurity/it/XmlsecurityTest.java     | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/integration-tests/atlasmap/src/test/java/org/apache/camel/quarkus/component/atlasmap/it/AtlasmapIT.java b/integration-tests/atlasmap/src/test/java/org/apache/camel/quarkus/component/atlasmap/it/AtlasmapIT.java
index 9e71294024..18ae10e0c9 100644
--- a/integration-tests/atlasmap/src/test/java/org/apache/camel/quarkus/component/atlasmap/it/AtlasmapIT.java
+++ b/integration-tests/atlasmap/src/test/java/org/apache/camel/quarkus/component/atlasmap/it/AtlasmapIT.java
@@ -18,7 +18,6 @@ package org.apache.camel.quarkus.component.atlasmap.it;
 
 import io.quarkus.test.junit.QuarkusIntegrationTest;
 
-//@DisabledOnNativeImage("https://github.com/apache/camel-quarkus/issues/3189")
 @QuarkusIntegrationTest
 class AtlasmapIT extends AtlasmapTest {
 
diff --git a/integration-tests/freemarker/src/test/java/org/apache/camel/quarkus/component/freemarker/it/FreemarkerTest.java b/integration-tests/freemarker/src/test/java/org/apache/camel/quarkus/component/freemarker/it/FreemarkerTest.java
index 5af38d48c1..61835b139a 100644
--- a/integration-tests/freemarker/src/test/java/org/apache/camel/quarkus/component/freemarker/it/FreemarkerTest.java
+++ b/integration-tests/freemarker/src/test/java/org/apache/camel/quarkus/component/freemarker/it/FreemarkerTest.java
@@ -16,7 +16,7 @@
  */
 package org.apache.camel.quarkus.component.freemarker.it;
 
-import io.quarkus.test.junit.DisabledOnNativeImage;
+import io.quarkus.test.junit.DisabledOnIntegrationTest;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
@@ -28,7 +28,7 @@ import static org.hamcrest.Matchers.equalTo;
 class FreemarkerTest {
 
     @Test
-    @DisabledOnNativeImage // requires allowContextMapAll=true which is unsupported in native mode
+    @DisabledOnIntegrationTest // requires allowContextMapAll=true which is unsupported in native mode
     public void freemarkerLetter() {
         RestAssured.given()
                 .contentType(ContentType.JSON)
@@ -51,7 +51,7 @@ class FreemarkerTest {
     }
 
     @Test
-    @DisabledOnNativeImage // requires allowContextMapAll=true which is unsupported in native mode
+    @DisabledOnIntegrationTest // requires allowContextMapAll=true which is unsupported in native mode
     public void valuesInProperties() {
         RestAssured.given()
                 .contentType(ContentType.JSON)
diff --git a/integration-tests/xmlsecurity/src/test/java/org/apache/camel/quarkus/component/xmlsecurity/it/XmlsecurityTest.java b/integration-tests/xmlsecurity/src/test/java/org/apache/camel/quarkus/component/xmlsecurity/it/XmlsecurityTest.java
index 72d6da36e4..3b1e56e31d 100644
--- a/integration-tests/xmlsecurity/src/test/java/org/apache/camel/quarkus/component/xmlsecurity/it/XmlsecurityTest.java
+++ b/integration-tests/xmlsecurity/src/test/java/org/apache/camel/quarkus/component/xmlsecurity/it/XmlsecurityTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.quarkus.component.xmlsecurity.it;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
-import io.quarkus.test.junit.DisabledOnNativeImage;
+import io.quarkus.test.junit.DisabledOnIntegrationTest;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
@@ -194,7 +194,7 @@ class XmlsecurityTest {
         assertFalse(verifiedXml.contains("ds:SignatureValue"));
     }
 
-    @DisabledOnNativeImage("https://github.com/apache/camel-quarkus/issues/2185")
+    @DisabledOnIntegrationTest("https://github.com/apache/camel-quarkus/issues/2185")
     @Test
     public void signVerifyTransformsXsltXPath() throws Exception {
         String signedXml = RestAssured.given()


[camel-quarkus] 02/02: Fix verification of AWS S3 download links

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

jamesnetherton pushed a commit to branch 2.7.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit e1935c1df393ae3b1bed1864a43010d6dbb518a8
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri May 6 10:54:40 2022 +0100

    Fix verification of AWS S3 download links
---
 .../aws2-quarkus-client/aws2-s3/pom.xml            |  2 +-
 .../aws2/s3/it/AwsS3PresignerProducer.java         | 60 ++++++++++++++++++++++
 .../quarkus/component/aws2/s3/it/Aws2S3Test.java   | 25 +++------
 .../aws2-quarkus-client-grouped/pom.xml            |  2 +-
 4 files changed, 70 insertions(+), 19 deletions(-)

diff --git a/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml
index 02dec136dc..fc21f41819 100644
--- a/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml
+++ b/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml
@@ -128,7 +128,7 @@
                             <properties>
                                 <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-s3</copy-tests.source.dir>
                                 <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir>
-                                <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties</copy-tests.excludes>
+                                <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties,**/*AwsS3PresignerProducer.java</copy-tests.excludes>
                             </properties>
                         </configuration>
                     </execution>
diff --git a/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/AwsS3PresignerProducer.java b/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/AwsS3PresignerProducer.java
new file mode 100644
index 0000000000..a5b8fa852e
--- /dev/null
+++ b/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/AwsS3PresignerProducer.java
@@ -0,0 +1,60 @@
+/*
+ * 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.s3.it;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Optional;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Singleton;
+
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.s3.internal.signing.DefaultS3Presigner;
+import software.amazon.awssdk.services.s3.presigner.S3Presigner;
+
+@ApplicationScoped
+public class AwsS3PresignerProducer {
+
+    @ConfigProperty(name = "camel.component.aws2-s3.uri-endpoint-override")
+    Optional<String> uriEndpointOverride;
+
+    @ConfigProperty(name = "camel.component.aws2-s3.region")
+    String region;
+
+    @ConfigProperty(name = "camel.component.aws2-s3.access-key")
+    String accessKey;
+
+    @ConfigProperty(name = "camel.component.aws2-s3.secret-key")
+    String secretKey;
+
+    @Singleton
+    public S3Presigner awsS3Presigner() throws URISyntaxException {
+        if (uriEndpointOverride.isPresent()) {
+            return DefaultS3Presigner.builder()
+                    .region(Region.of(region))
+                    .credentialsProvider(StaticCredentialsProvider.create(
+                            AwsBasicCredentials.create(accessKey, secretKey)))
+                    .endpointOverride(new URI(uriEndpointOverride.get()))
+                    .build();
+        }
+        return null;
+    }
+}
diff --git a/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java b/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java
index 4cd2c26d85..2596c4d03c 100644
--- a/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java
+++ b/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java
@@ -17,6 +17,8 @@
 package org.apache.camel.quarkus.component.aws2.s3.it;
 
 import java.net.URI;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Locale;
 import java.util.UUID;
 import java.util.stream.Stream;
@@ -304,23 +306,12 @@ class Aws2S3Test {
             final URI downloadUri = new URI(downloadLink);
 
             // Make sure that the download link works
-            // Note that localstack produces a real AWS link so when testing against localstack,
-            // the link won't work
-            final String realKey = System.getenv("AWS_ACCESS_KEY");
-            final String realSecret = System.getenv("AWS_SECRET_KEY");
-            final String realRegion = System.getenv("AWS_REGION");
-            final boolean realCredentialsProvided = realKey != null && realSecret != null && realRegion != null;
-            if (realCredentialsProvided) {
-                RestAssured.given()
-                        .log().all()
-                        .contentType(ContentType.TEXT)
-                        .port(downloadUri.getPort())
-                        .get(downloadLink)
-                        .then()
-                        .statusCode(200)
-                        .body(is(blobContent));
-            }
-
+            RestAssured.given()
+                    .port(downloadUri.getPort())
+                    .get(URLDecoder.decode(downloadLink, StandardCharsets.UTF_8))
+                    .then()
+                    .statusCode(200)
+                    .body(is(blobContent));
         } finally {
             // Delete
             deleteObject(oid);
diff --git a/integration-tests/aws2-quarkus-client-grouped/pom.xml b/integration-tests/aws2-quarkus-client-grouped/pom.xml
index 69c4dfe679..fed6ab5bfb 100644
--- a/integration-tests/aws2-quarkus-client-grouped/pom.xml
+++ b/integration-tests/aws2-quarkus-client-grouped/pom.xml
@@ -209,7 +209,7 @@
                             <properties>
                                 <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-s3</copy-tests.source.dir>
                                 <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir>
-                                <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties</copy-tests.excludes>
+                                <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties,**/*AwsS3PresignerProducer.java</copy-tests.excludes>
                             </properties>
                         </configuration>
                     </execution>