Azure Storage Blob native support #1573
diff --git a/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc b/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc
index 5ff740c..07def6c 100644
--- a/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc
@@ -2,15 +2,15 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= Azure Storage Blob Service
:cq-artifact-id: camel-quarkus-azure-storage-blob
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
:cq-description: Store and retrieve blobs from Azure Storage Blob Service using SDK v12.
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.6.0
[.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.6.0##
Store and retrieve blobs from Azure Storage Blob Service using SDK v12.
@@ -31,3 +31,9 @@
----
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+
+== SSL in native mode
+
+This extension auto-enables SSL support in native mode. Hence you do not need to add
+`quarkus.ssl.native=true` to your `application.properties` yourself. See also
+https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
diff --git a/docs/modules/ROOT/partials/reference/components/azure-storage-blob.adoc b/docs/modules/ROOT/partials/reference/components/azure-storage-blob.adoc
index 1cff7b0..4b0674a 100644
--- a/docs/modules/ROOT/partials/reference/components/azure-storage-blob.adoc
+++ b/docs/modules/ROOT/partials/reference/components/azure-storage-blob.adoc
@@ -2,11 +2,11 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-azure-storage-blob
:cq-artifact-id-base: azure-storage-blob
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.6.0
:cq-camel-part-name: azure-storage-blob
:cq-camel-part-title: Azure Storage Blob Service
:cq-camel-part-description: Store and retrieve blobs from Azure Storage Blob Service using SDK v12.
diff --git a/extensions-jvm/azure-storage-blob/deployment/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/deployment/AzureStorageBlobProcessor.java b/extensions-jvm/azure-storage-blob/deployment/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/deployment/AzureStorageBlobProcessor.java
deleted file mode 100644
index 0f50daa..0000000
--- a/extensions-jvm/azure-storage-blob/deployment/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/deployment/AzureStorageBlobProcessor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.azure.storage.blob.deployment;
-
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
-
-class AzureStorageBlobProcessor {
-
- private static final Logger LOG = Logger.getLogger(AzureStorageBlobProcessor.class);
- private static final String FEATURE = "camel-azure-storage-blob";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
- }
-
- /**
- * Remove this once this extension starts supporting the native mode.
- */
- @BuildStep(onlyIf = NativeBuild.class)
- @Record(value = ExecutionTime.RUNTIME_INIT)
- void warnJvmInNative(JvmOnlyRecorder recorder) {
- JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
- recorder.warnJvmInNative(FEATURE); // warn at runtime
- }
-}
diff --git a/extensions-jvm/azure-storage-blob/integration-test/pom.xml b/extensions-jvm/azure-storage-blob/integration-test/pom.xml
deleted file mode 100644
index bee2b63..0000000
--- a/extensions-jvm/azure-storage-blob/integration-test/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-build-parent-it</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
- </parent>
-
- <artifactId>camel-quarkus-azure-storage-blob-integration-test</artifactId>
- <name>Camel Quarkus :: Azure Storage Blob Service :: Integration Test</name>
- <description>Integration tests for Camel Quarkus Azure Storage Blob Service extension</description>
-
- <properties>
- <!-- mvnd, a.k.a. Maven Daemon: https://github.com/mvndaemon/mvnd -->
- <!-- The following rule tells mvnd to build the listed deployment modules before this module. -->
- <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not -->
- <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
- <!-- Please update the rule whenever you change the dependencies of this module by running -->
- <!-- mvn process-resources -Pformat from the root directory -->
- <mvnd.builder.rule>camel-quarkus-azure-storage-blob-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-bom-test</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-azure-storage-blob</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-resteasy</artifactId>
- </dependency>
-
- <!-- test dependencies -->
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-junit5</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/extensions-jvm/azure-storage-blob/integration-test/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java b/extensions-jvm/azure-storage-blob/integration-test/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java
deleted file mode 100644
index b66d3d1..0000000
--- a/extensions-jvm/azure-storage-blob/integration-test/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.azure.storage.blob.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
-
-@Path("/azure-storage-blob")
-@ApplicationScoped
-public class AzureStorageBlobResource {
-
- private static final Logger LOG = Logger.getLogger(AzureStorageBlobResource.class);
-
- private static final String COMPONENT_AZURE_STORAGE_BLOB = "azure-storage-blob";
- @Inject
- CamelContext context;
-
- @Path("/load/component/azure-storage-blob")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response loadComponentAzureStorageBlob() throws Exception {
- /* This is an autogenerated test */
- if (context.getComponent(COMPONENT_AZURE_STORAGE_BLOB) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_AZURE_STORAGE_BLOB);
- return Response.status(500, COMPONENT_AZURE_STORAGE_BLOB + " could not be loaded from the Camel context").build();
- }
-}
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index 6057028..dbac00b 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -43,7 +43,6 @@
<module>aws-xray</module>
<module>aws2-eventbridge</module>
<module>aws2-kinesis</module>
- <module>azure-storage-blob</module>
<module>azure-storage-queue</module>
<module>barcode</module>
<module>beanio</module>
diff --git a/extensions-jvm/azure-storage-blob/deployment/pom.xml b/extensions/azure-storage-blob/deployment/pom.xml
similarity index 89%
rename from extensions-jvm/azure-storage-blob/deployment/pom.xml
rename to extensions/azure-storage-blob/deployment/pom.xml
index 2a72350..1313b11 100644
--- a/extensions-jvm/azure-storage-blob/deployment/pom.xml
+++ b/extensions/azure-storage-blob/deployment/pom.xml
@@ -35,9 +35,17 @@
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-netty-deployment</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-azure-storage-blob</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-micrometer-deployment</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/azure-storage-blob/deployment/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/deployment/AzureStorageBlobProcessor.java b/extensions/azure-storage-blob/deployment/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/deployment/AzureStorageBlobProcessor.java
new file mode 100644
index 0000000..ac17357
--- /dev/null
+++ b/extensions/azure-storage-blob/deployment/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/deployment/AzureStorageBlobProcessor.java
@@ -0,0 +1,102 @@
+/*
+ * 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.azure.storage.blob.deployment;
+
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+
+class AzureStorageBlobProcessor {
+
+ private static final String FEATURE = "camel-azure-storage-blob";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
+ return new ExtensionSslNativeSupportBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClasses) {
+ Stream.of(
+ "io.netty.handler.ssl.OpenSsl",
+ "io.netty.internal.tcnative.SSL",
+ "io.netty.util.NetUtil",
+ "reactor.netty.http.client.HttpClient",
+ "reactor.netty.tcp.TcpClient",
+ "reactor.netty.resources.DefaultLoopNativeDetector",
+ "reactor.netty.resources.DefaultLoopEpoll",
+ "reactor.netty.resources.DefaultLoopKQueue",
+ "reactor.netty.resources.MicrometerPooledConnectionProviderMeterRegistrar",
+ "reactor.netty.Metrics")
+ .map(RuntimeInitializedClassBuildItem::new)
+ .forEach(runtimeInitializedClasses::produce);
+ }
+
+ @BuildStep
+ void proxyDefinitions(BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinitions) {
+ Stream.of(
+ "com.azure.storage.blob.implementation.AppendBlobsImpl$AppendBlobsService",
+ "com.azure.storage.blob.implementation.BlobsImpl$BlobsService",
+ "com.azure.storage.blob.implementation.BlockBlobsImpl$BlockBlobsService",
+ "com.azure.storage.blob.implementation.ContainersImpl$ContainersService",
+ "com.azure.storage.blob.implementation.DirectorysImpl$DirectorysService",
+ "com.azure.storage.blob.implementation.PageBlobsImpl$PageBlobsService",
+ "com.azure.storage.blob.implementation.ServicesImpl$ServicesService")
+ .map(NativeImageProxyDefinitionBuildItem::new)
+ .forEach(proxyDefinitions::produce);
+ }
+
+ @BuildStep
+ void reflectiveClasses(CombinedIndexBuildItem combinedIndex, BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+
+ final String[] modelClasses = combinedIndex
+ .getIndex()
+ .getKnownClasses()
+ .stream()
+ .map(ClassInfo::name)
+ .map(DotName::toString)
+ .filter(n -> n.startsWith("com.azure.storage.blob.implementation.models.")
+ || n.startsWith("com.azure.storage.blob.models."))
+ .sorted()
+ .toArray(String[]::new);
+ reflectiveClasses.produce(new ReflectiveClassBuildItem(true, true, modelClasses));
+
+ reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, "com.azure.core.util.DateTimeRfc1123"));
+
+ }
+
+ @BuildStep
+ IndexDependencyBuildItem indexDependency() {
+ return new IndexDependencyBuildItem("com.azure", "azure-storage-blob");
+ }
+
+}
diff --git a/extensions-jvm/azure-storage-blob/pom.xml b/extensions/azure-storage-blob/pom.xml
similarity index 97%
rename from extensions-jvm/azure-storage-blob/pom.xml
rename to extensions/azure-storage-blob/pom.xml
index d3dbddf..fb7a8fd 100644
--- a/extensions-jvm/azure-storage-blob/pom.xml
+++ b/extensions/azure-storage-blob/pom.xml
@@ -33,6 +33,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
- <module>integration-test</module>
</modules>
</project>
diff --git a/extensions-jvm/azure-storage-blob/runtime/pom.xml b/extensions/azure-storage-blob/runtime/pom.xml
similarity index 92%
rename from extensions-jvm/azure-storage-blob/runtime/pom.xml
rename to extensions/azure-storage-blob/runtime/pom.xml
index afd004e..c1f4b3c 100644
--- a/extensions-jvm/azure-storage-blob/runtime/pom.xml
+++ b/extensions/azure-storage-blob/runtime/pom.xml
@@ -32,6 +32,7 @@
<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>1.6.0</camel.quarkus.nativeSince>
</properties>
<dependencyManagement>
@@ -52,9 +53,17 @@
<artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-netty</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-azure-storage-blob</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-micrometer</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions-jvm/azure-storage-blob/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/azure-storage-blob/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 97%
rename from extensions-jvm/azure-storage-blob/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/azure-storage-blob/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index b7a3aba..6e5a8f6 100644
--- a/extensions-jvm/azure-storage-blob/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ b/extensions/azure-storage-blob/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,9 +24,8 @@
name: "Camel Azure Storage Blob Service"
description: "Store and retrieve blobs from Azure Storage Blob Service using SDK v12"
metadata:
- unlisted: true
guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/azure-storage-blob.html"
categories:
- "integration"
status:
- - "preview"
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index e59472c..6c605da 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -74,6 +74,7 @@
<module>aws2-sts</module>
<module>aws2-translate</module>
<module>azure</module>
+ <module>azure-storage-blob</module>
<module>base64</module>
<module>bean</module>
<module>bean-validator</module>
diff --git a/integration-tests/azure-storage-blob/README.adoc b/integration-tests/azure-storage-blob/README.adoc
new file mode 100644
index 0000000..db86b5c
--- /dev/null
+++ b/integration-tests/azure-storage-blob/README.adoc
@@ -0,0 +1,16 @@
+== Azure Storage Blob Service integration tests
+
+By default the integration tests run against a local https://github.com/Azure/Azurite[Azurite] container.
+
+To run the tests against the real remote Azure API, you need the following:
+
+* A https://docs.microsoft.com/en-us/azure/storage/common/storage-account-create?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&tabs=azure-portal[general-purpose v2 Azure storage account]
+* View the https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal#view-account-access-keys[account keys] and set the following environment variables:
++
+[source,shell]
+----
+export AZURE_STORAGE_ACCOUNT_NAME=my-account-name
+export AZURE_STORAGE_ACCOUNT_KEY=my-account-key
+----
+
+You may want to `export CAMEL_QUARKUS_START_MOCK_BACKEND=false` to avoid starting he the local Azurite container and make sure that you test against the real remote Azure API.
diff --git a/integration-tests/azure-storage-blob/pom.xml b/integration-tests/azure-storage-blob/pom.xml
new file mode 100644
index 0000000..fc5c543
--- /dev/null
+++ b/integration-tests/azure-storage-blob/pom.xml
@@ -0,0 +1,122 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-azure-storage-blob</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Azure Storage Blob Service</name>
+ <description>Integration tests for Camel Quarkus Azure Storage Blob Service extension</description>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-test</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-azure-storage-blob</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-testcontainers-support</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-test-support-mock-backend</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-azure-storage-blob-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java b/integration-tests/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java
new file mode 100644
index 0000000..4a610fa
--- /dev/null
+++ b/integration-tests/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java
@@ -0,0 +1,120 @@
+/*
+ * 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.azure.storage.blob.it;
+
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PATCH;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.azure.core.http.policy.HttpLogDetailLevel;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.storage.blob.BlobServiceClient;
+import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.common.StorageSharedKeyCredential;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.azure.storage.blob.BlobOperationsDefinition;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+@Path("/azure-storage-blob")
+@ApplicationScoped
+public class AzureStorageBlobResource {
+ private static final String BLOB_NAME = "test";
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @ConfigProperty(name = "camel.component.azure-blob.credentials-account-name")
+ String azureStorageAccountName;
+
+ @ConfigProperty(name = "camel.component.azure-blob.credentials-account-key")
+ String azureStorageAccountKey;
+
+ @ConfigProperty(name = "azure.blob.service.url")
+ String azureBlobServiceUrl;
+
+ @ConfigProperty(name = "azure.blob.container.name")
+ String azureBlobContainerName;
+
+ @javax.enterprise.inject.Produces
+ @Named("azureBlobServiceClient")
+ public BlobServiceClient createBlobClient() throws Exception {
+ StorageSharedKeyCredential credentials = new StorageSharedKeyCredential(azureStorageAccountName,
+ azureStorageAccountKey);
+ return new BlobServiceClientBuilder()
+ .endpoint(azureBlobServiceUrl)
+ .credential(credentials)
+ .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS).setPrettyPrintBody(true))
+ .buildClient();
+ }
+
+ @Path("/blob/create")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ public Response createBlob(String message) throws Exception {
+ producerTemplate.sendBody(componentUri(BlobOperationsDefinition.uploadBlockBlob),
+ message);
+ return Response.created(new URI("https://camel.apache.org/")).build();
+ }
+
+ @Path("/blob/read")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String readBlob() throws Exception {
+ return producerTemplate.requestBodyAndHeader(
+ componentUri(BlobOperationsDefinition.getBlob),
+ null, Exchange.CHARSET_NAME, StandardCharsets.UTF_8.name(), String.class);
+ }
+
+ @Path("/blob/update")
+ @PATCH
+ @Consumes(MediaType.TEXT_PLAIN)
+ public Response updateBlob(String message) throws Exception {
+ producerTemplate.sendBody(
+ componentUri(BlobOperationsDefinition.uploadBlockBlob),
+ message);
+ return Response.ok().build();
+ }
+
+ @Path("/blob/delete")
+ @DELETE
+ public Response deleteBlob() throws Exception {
+ producerTemplate.sendBody(
+ componentUri(BlobOperationsDefinition.deleteBlob),
+ null);
+ return Response.noContent().build();
+ }
+
+ private String componentUri(final BlobOperationsDefinition operation) {
+ return String.format("azure-storage-blob://%s/%s?blobServiceClient=#azureBlobServiceClient&operation=%s&blobName=%s",
+ azureStorageAccountName, azureBlobContainerName,
+ operation.name(), BLOB_NAME);
+ }
+
+}
diff --git a/integration-tests/azure-storage-blob/src/main/resources/application.properties b/integration-tests/azure-storage-blob/src/main/resources/application.properties
new file mode 100644
index 0000000..b77557e
--- /dev/null
+++ b/integration-tests/azure-storage-blob/src/main/resources/application.properties
@@ -0,0 +1,27 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#
+
+
+# Azurite test account credentials
+azurite.storage.account.name = devstoreaccount1
+azurite.storage.account.key = Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
+
+camel.component.azure-blob.credentials-account-name = ${AZURE_STORAGE_ACCOUNT_NAME:${azurite.storage.account.name}}
+camel.component.azure-blob.credentials-account-key = ${AZURE_STORAGE_ACCOUNT_KEY:${azurite.storage.account.key}}
+
+#quarkus.native.additional-build-args = --allow-incomplete-classpath,--report-unsupported-elements-at-runtime
diff --git a/extensions-jvm/azure-storage-blob/integration-test/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java b/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobIT.java
similarity index 68%
rename from extensions-jvm/azure-storage-blob/integration-test/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java
rename to integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobIT.java
index e31ab66..0f855a6 100644
--- a/extensions-jvm/azure-storage-blob/integration-test/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java
+++ b/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobIT.java
@@ -16,19 +16,11 @@
*/
package org.apache.camel.quarkus.component.azure.storage.blob.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.NativeImageTest;
-@QuarkusTest
-class AzureStorageBlobTest {
-
- @Test
- public void loadComponentAzureStorageBlob() {
- /* A simple autogenerated test */
- RestAssured.get("/azure-storage-blob/load/component/azure-storage-blob")
- .then()
- .statusCode(200);
- }
+@NativeImageTest
+@QuarkusTestResource(AzureStorageBlobTestResource.class)
+class AzureStorageBlobIT extends AzureStorageBlobTest {
}
diff --git a/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java b/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java
new file mode 100644
index 0000000..de3d0ed
--- /dev/null
+++ b/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.azure.storage.blob.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.core.Is.is;
+
+@QuarkusTest
+@QuarkusTestResource(AzureStorageBlobTestResource.class)
+class AzureStorageBlobTest {
+
+ @Test
+ public void crud() {
+ String blobContent = "Hello Camel Quarkus Azure Blob";
+
+ // Create
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(blobContent)
+ .post("/azure-storage-blob/blob/create")
+ .then()
+ .statusCode(201);
+
+ // Read
+ RestAssured.get("/azure-storage-blob/blob/read")
+ .then()
+ .statusCode(200)
+ .body(is(blobContent));
+
+ // Update
+ String updatedContent = blobContent + " updated";
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(updatedContent)
+ .patch("/azure-storage-blob/blob/update")
+ .then()
+ .statusCode(200);
+
+ RestAssured.get("/azure-storage-blob/blob/read")
+ .then()
+ .statusCode(200)
+ .body(is(updatedContent));
+
+ // Delete
+ RestAssured.delete("/azure-storage-blob/blob/delete")
+ .then()
+ .statusCode(204);
+ }
+
+}
diff --git a/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTestResource.java b/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTestResource.java
new file mode 100644
index 0000000..8c9ec6c
--- /dev/null
+++ b/integration-tests/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTestResource.java
@@ -0,0 +1,131 @@
+/*
+ * 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.azure.storage.blob.it;
+
+import java.util.Map;
+import java.util.UUID;
+
+import com.azure.core.http.policy.HttpLogDetailLevel;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.storage.blob.BlobContainerClient;
+import com.azure.storage.blob.BlobServiceClient;
+import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.common.StorageSharedKeyCredential;
+import io.quarkus.runtime.configuration.ConfigUtils;
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import io.smallrye.config.SmallRyeConfig;
+import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
+import org.apache.camel.util.CollectionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+
+public class AzureStorageBlobTestResource implements QuarkusTestResourceLifecycleManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AzureStorageBlobTestResource.class);
+ private static final String AZURITE_IMAGE = "mcr.microsoft.com/azure-storage/azurite:3.9.0";
+ private static final int BLOB_SERVICE_PORT = 10000;
+ private static final int QUEUE_SERVICE_PORT = 10001;
+
+ private GenericContainer<?> container;
+ private BlobContainerClient blobContainer;
+
+ @Override
+ public Map<String, String> start() {
+
+ final SmallRyeConfig config = ConfigUtils.configBuilder(true).build();
+
+ final String realAzureStorageAccountName = System.getenv("AZURE_STORAGE_ACCOUNT_NAME");
+ final boolean realCredentialsProvided = realAzureStorageAccountName != null
+ && System.getenv("AZURE_STORAGE_ACCOUNT_KEY") != null;
+
+ final String azureBlobContainername = "camel-quarkus-" + UUID.randomUUID().toString();
+
+ final String azureStorageAccountName = config
+ .getValue("camel.component.azure-blob.credentials-account-name", String.class);
+ final String azureStorageAccountKey = config
+ .getValue("camel.component.azure-blob.credentials-account-key", String.class);
+ final Map<String, String> result;
+ final boolean startMockBackend = MockBackendUtils.startMockBackend(false);
+ if (startMockBackend && !realCredentialsProvided) {
+ MockBackendUtils.logMockBackendUsed();
+ try {
+ container = new GenericContainer<>(AZURITE_IMAGE)
+ .withExposedPorts(BLOB_SERVICE_PORT, QUEUE_SERVICE_PORT)
+ .withLogConsumer(new Slf4jLogConsumer(LOGGER))
+ .waitingFor(Wait.forListeningPort());
+ container.start();
+
+ final String blobServiceUrl = "http://" + container.getContainerIpAddress() + ":"
+ + container.getMappedPort(BLOB_SERVICE_PORT) + "/" + azureStorageAccountName + "/"
+ + azureBlobContainername;
+ final String queueServiceUrl = "http://" + container.getContainerIpAddress() + ":"
+ + container.getMappedPort(QUEUE_SERVICE_PORT) + "/" + azureStorageAccountName;
+
+ result = CollectionHelper.mapOf(
+ "azure.blob.container.name", azureBlobContainername,
+ "azure.blob.service.url", blobServiceUrl,
+ "azure.queue.service.url", queueServiceUrl);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ if (!startMockBackend && !realCredentialsProvided) {
+ throw new IllegalStateException(
+ "Set AZURE_STORAGE_ACCOUNT_NAME and AZURE_STORAGE_ACCOUNT_KEY env vars if you set CAMEL_QUARKUS_START_MOCK_BACKEND=false");
+ }
+ MockBackendUtils.logRealBackendUsed();
+ result = CollectionHelper.mapOf(
+ "azure.blob.container.name", azureBlobContainername,
+ "azure.blob.service.url",
+ "https://" + realAzureStorageAccountName + ".blob.core.windows.net",
+ "azure.queue.service.url", "https://" + realAzureStorageAccountName + ".queue.core.windows.net");
+ }
+
+ StorageSharedKeyCredential credentials = new StorageSharedKeyCredential(azureStorageAccountName,
+ azureStorageAccountKey);
+ BlobServiceClient client = new BlobServiceClientBuilder()
+ .endpoint(result.get("azure.blob.service.url"))
+ .credential(credentials)
+ .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS).setPrettyPrintBody(true))
+ .buildClient();
+ blobContainer = client.getBlobContainerClient(azureBlobContainername);
+ blobContainer.create();
+ return result;
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (blobContainer != null) {
+ blobContainer.delete();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ if (container != null) {
+ container.stop();
+ }
+ } catch (Exception e) {
+ // ignored
+ }
+ }
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index b9bc7ce..7974317 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -69,6 +69,7 @@
<module>aws</module>
<module>aws2</module>
<module>azure</module>
+ <module>azure-storage-blob</module>
<module>base64</module>
<module>bean</module>
<module>bean-validator</module>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 9863dc9..557a079 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -98,7 +98,7 @@
- geocoder
- lumberjack
- optaplanner
-dozer-social:
+dozer-social-azure:
- crypto
- dozer
- telegram
@@ -107,6 +107,7 @@
- syndication
- zendesk
- csimple
+ - azure-storage-blob
messaging-networking1:
- activemq
- amqp