This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 4b00b88ee9938e728b66d996514f6619ed4c936f Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Tue Mar 25 10:26:49 2025 +0000 Add azure-files JVM only extension Fixes #7166 --- catalog/pom.xml | 13 +++ .../ROOT/examples/components/azure-files.yml | 13 +++ docs/modules/ROOT/nav.adoc | 1 + .../pages/reference/extensions/azure-files.adoc | 41 +++++++ extensions-jvm/azure-files/deployment/pom.xml | 71 +++++++++++++ .../files/deployment/AzureFilesProcessor.java | 46 ++++++++ extensions-jvm/azure-files/pom.xml | 39 +++++++ extensions-jvm/azure-files/runtime/pom.xml | 108 +++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 34 ++++++ extensions-jvm/pom.xml | 1 + integration-tests-jvm/azure-files/pom.xml | 118 +++++++++++++++++++++ .../component/azure/files/it/AzureFileRoutes.java | 34 ++++++ .../azure/files/it/AzureFilesResource.java | 76 +++++++++++++ .../src/main/resources/application.properties | 21 ++++ .../component/azure/files/it/AzureFilesTest.java | 69 ++++++++++++ integration-tests-jvm/pom.xml | 1 + poms/bom/pom.xml | 21 ++++ poms/bom/src/main/generated/flattened-full-pom.xml | 21 ++++ .../src/main/generated/flattened-reduced-pom.xml | 26 +++++ .../generated/flattened-reduced-verbose-pom.xml | 26 +++++ 20 files changed, 780 insertions(+) diff --git a/catalog/pom.xml b/catalog/pom.xml index f8775239e1..e3fb5fb961 100644 --- a/catalog/pom.xml +++ b/catalog/pom.xml @@ -513,6 +513,19 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-key-vault</artifactId> diff --git a/docs/modules/ROOT/examples/components/azure-files.yml b/docs/modules/ROOT/examples/components/azure-files.yml new file mode 100644 index 0000000000..ca7d190fb9 --- /dev/null +++ b/docs/modules/ROOT/examples/components/azure-files.yml @@ -0,0 +1,13 @@ +# Do not edit directly! +# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +cqArtifactId: camel-quarkus-azure-files +cqArtifactIdBase: azure-files +cqNativeSupported: false +cqStatus: Preview +cqDeprecated: false +cqJvmSince: 3.22.0 +cqNativeSince: n/a +cqCamelPartName: azure-files +cqCamelPartTitle: Azure Files +cqCamelPartDescription: Send and receive files to Azure storage file share +cqExtensionPageTitle: Azure Files diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index a2428aef9d..5572d022d0 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -61,6 +61,7 @@ *** xref:reference/extensions/jackson-avro.adoc[Avro Jackson] *** xref:reference/extensions/azure-cosmosdb.adoc[Azure CosmosDB] *** xref:reference/extensions/azure-eventhubs.adoc[Azure Event Hubs] +*** xref:reference/extensions/azure-files.adoc[Azure Files] *** xref:reference/extensions/azure-key-vault.adoc[Azure Key Vault] *** xref:reference/extensions/azure-servicebus.adoc[Azure ServiceBus] *** xref:reference/extensions/azure-storage-blob.adoc[Azure Storage Blob Service] diff --git a/docs/modules/ROOT/pages/reference/extensions/azure-files.adoc b/docs/modules/ROOT/pages/reference/extensions/azure-files.adoc new file mode 100644 index 0000000000..92f49e0774 --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/azure-files.adoc @@ -0,0 +1,41 @@ +// Do not edit directly! +// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +[id="extensions-azure-files"] += Azure Files +:linkattrs: +:cq-artifact-id: camel-quarkus-azure-files +:cq-native-supported: false +:cq-status: Preview +:cq-status-deprecation: Preview +:cq-description: Send and receive files to Azure storage file share +:cq-deprecated: false +:cq-jvm-since: 3.22.0 +:cq-native-since: n/a + +ifeval::[{doc-show-badges} == true] +[.badges] +[.badge-key]##JVM since##[.badge-supported]##3.22.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## +endif::[] + +Send and receive files to Azure storage file share + +[id="extensions-azure-files-whats-inside"] +== What's inside + +* xref:{cq-camel-components}::azure-files-component.adoc[Azure Files component], URI syntax: `azure-files:account/share` + +Please refer to the above link for usage and configuration details. + +[id="extensions-azure-files-maven-coordinates"] +== Maven coordinates + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files</artifactId> +</dependency> +---- +ifeval::[{doc-show-user-guide-link} == true] +Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. +endif::[] diff --git a/extensions-jvm/azure-files/deployment/pom.xml b/extensions-jvm/azure-files/deployment/pom.xml new file mode 100644 index 0000000000..20abd0ad1d --- /dev/null +++ b/extensions-jvm/azure-files/deployment/pom.xml @@ -0,0 +1,71 @@ +<?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-azure-files-parent</artifactId> + <version>3.22.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-azure-files-deployment</artifactId> + <name>Camel Quarkus :: Azure Files :: Deployment</name> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-ftp-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-azure-core-http-client-vertx-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions-jvm/azure-files/deployment/src/main/java/org/apache/camel/quarkus/component/azure/files/deployment/AzureFilesProcessor.java b/extensions-jvm/azure-files/deployment/src/main/java/org/apache/camel/quarkus/component/azure/files/deployment/AzureFilesProcessor.java new file mode 100644 index 0000000000..08c3e4bedd --- /dev/null +++ b/extensions-jvm/azure-files/deployment/src/main/java/org/apache/camel/quarkus/component/azure/files/deployment/AzureFilesProcessor.java @@ -0,0 +1,46 @@ +/* + * 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.files.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.NativeOrNativeSourcesBuild; +import org.apache.camel.quarkus.core.JvmOnlyRecorder; +import org.jboss.logging.Logger; + +class AzureFilesProcessor { + + private static final Logger LOG = Logger.getLogger(AzureFilesProcessor.class); + private static final String FEATURE = "camel-azure-files"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + /** + * Remove this once this extension starts supporting the native mode. + */ + @BuildStep(onlyIf = NativeOrNativeSourcesBuild.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-files/pom.xml b/extensions-jvm/azure-files/pom.xml new file mode 100644 index 0000000000..232da199dd --- /dev/null +++ b/extensions-jvm/azure-files/pom.xml @@ -0,0 +1,39 @@ +<?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-extensions-jvm</artifactId> + <version>3.22.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-azure-files-parent</artifactId> + <name>Camel Quarkus :: Azure Files</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions-jvm/azure-files/runtime/pom.xml b/extensions-jvm/azure-files/runtime/pom.xml new file mode 100644 index 0000000000..ffc35f8f8e --- /dev/null +++ b/extensions-jvm/azure-files/runtime/pom.xml @@ -0,0 +1,108 @@ +<?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-azure-files-parent</artifactId> + <version>3.22.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-azure-files</artifactId> + <name>Camel Quarkus :: Azure Files :: Runtime</name> + <description>Send and receive files to Azure storage file share</description> + + <properties> + <camel.quarkus.jvmSince>3.22.0</camel.quarkus.jvmSince> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-ftp</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-azure-core-http-client-vertx</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-azure-files</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + + + <profiles> + <profile> + <id>full</id> + <activation> + <property> + <name>!quickly</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-maven-plugin</artifactId> + <executions> + <execution> + <id>update-extension-doc-page</id> + <goals> + <goal>update-extension-doc-page</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/extensions-jvm/azure-files/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/azure-files/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000000..77e2f438e6 --- /dev/null +++ b/extensions-jvm/azure-files/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,34 @@ +# +# 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. +# + +# This is a generated file. Do not edit directly! +# To re-generate, run the following command from the top level directory: +# +# mvn -N cq:update-quarkus-metadata +# +--- +name: "Camel Azure Files" +description: "Send and receive files to Azure storage file share" +metadata: + icon-url: "https://raw.githubusercontent.com/apache/camel-website/main/antora-ui-camel/src/img/logo-d.svg" + sponsor: "Apache Software Foundation" + unlisted: true + guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/azure-files.html" + categories: + - "integration" + status: + - "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index 2d19e6a32f..377c5be045 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -39,6 +39,7 @@ <module>asterisk</module> <module>aws-xray</module> <module>azure-cosmosdb</module> + <module>azure-files</module> <module>azure-storage-datalake</module> <module>barcode</module> <module>bonita</module> diff --git a/integration-tests-jvm/azure-files/pom.xml b/integration-tests-jvm/azure-files/pom.xml new file mode 100644 index 0000000000..99c1b32685 --- /dev/null +++ b/integration-tests-jvm/azure-files/pom.xml @@ -0,0 +1,118 @@ +<?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>3.22.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-integration-test-azure-files</artifactId> + <name>Camel Quarkus :: Integration Tests :: Azure Files</name> + <description>Integration tests for Camel Quarkus Azure Files extension</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-seda</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> + + <profiles> + <profile> + <id>virtualDependencies</id> + <activation> + <property> + <name>!noVirtualDependencies</name> + </property> + </activation> + <dependencies> + <!-- 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-files-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-seda-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + </profile> + </profiles> +</project> diff --git a/integration-tests-jvm/azure-files/src/main/java/org/apache/camel/quarkus/component/azure/files/it/AzureFileRoutes.java b/integration-tests-jvm/azure-files/src/main/java/org/apache/camel/quarkus/component/azure/files/it/AzureFileRoutes.java new file mode 100644 index 0000000000..479398562d --- /dev/null +++ b/integration-tests-jvm/azure-files/src/main/java/org/apache/camel/quarkus/component/azure/files/it/AzureFileRoutes.java @@ -0,0 +1,34 @@ +/* + * 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.files.it; + +import org.apache.camel.builder.RouteBuilder; + +public class AzureFileRoutes extends RouteBuilder { + private static final String AZURE_FILES_URI = "azure-files://{{azure.storage.account-name}}/{{azure.files.share.name}}/{{azure.files.share.directory.name}}?credentialType=SHARED_ACCOUNT_KEY&sharedKey=RAW({{azure.storage.account-key}})"; + + @Override + public void configure() throws Exception { + from(AZURE_FILES_URI + "&delete=true") + .routeId("azure-files-consumer") + .autoStartup(false) + .to("seda:downloadedFiles"); + + from("direct:uploadFile") + .to(AZURE_FILES_URI); + } +} diff --git a/integration-tests-jvm/azure-files/src/main/java/org/apache/camel/quarkus/component/azure/files/it/AzureFilesResource.java b/integration-tests-jvm/azure-files/src/main/java/org/apache/camel/quarkus/component/azure/files/it/AzureFilesResource.java new file mode 100644 index 0000000000..17c0471718 --- /dev/null +++ b/integration-tests-jvm/azure-files/src/main/java/org/apache/camel/quarkus/component/azure/files/it/AzureFilesResource.java @@ -0,0 +1,76 @@ +/* + * 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.files.it; + +import java.net.URI; + +import com.azure.storage.file.share.models.ShareFileItem; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import org.apache.camel.CamelContext; +import org.apache.camel.ConsumerTemplate; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.component.file.GenericFile; + +@Path("/azure-files") +@ApplicationScoped +public class AzureFilesResource { + @Inject + CamelContext context; + + @Inject + ProducerTemplate producerTemplate; + + @Inject + ConsumerTemplate consumerTemplate; + + @POST + @Consumes(MediaType.APPLICATION_OCTET_STREAM) + @Path("upload/{fileName}") + public Response uploadFile(@PathParam("fileName") String fileName, byte[] fileToUpload) throws Exception { + producerTemplate.sendBodyAndHeader("direct:uploadFile", fileToUpload, Exchange.FILE_NAME, fileName); + return Response.created(new URI("https://camel.apache.org/")).build(); + } + + @GET + @Path("downloaded") + @Consumes(MediaType.APPLICATION_OCTET_STREAM) + public Response consumeDownloadedFile() { + GenericFile<ShareFileItem> file = consumerTemplate.receiveBody("seda:downloadedFiles", 10000, GenericFile.class); + return Response.ok(file.getBody()).build(); + } + + @Path("/route/{routeId}/start") + @POST + public void startRoute(@PathParam("routeId") String routeId) throws Exception { + context.getRouteController().startRoute(routeId); + } + + @Path("/route/{routeId}/stop") + @POST + public void stopRoute(@PathParam("routeId") String routeId) throws Exception { + context.getRouteController().stopRoute(routeId); + } +} diff --git a/integration-tests-jvm/azure-files/src/main/resources/application.properties b/integration-tests-jvm/azure-files/src/main/resources/application.properties new file mode 100644 index 0000000000..0e4e48dd83 --- /dev/null +++ b/integration-tests-jvm/azure-files/src/main/resources/application.properties @@ -0,0 +1,21 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +azure.storage.account-name = ${AZURE_STORAGE_ACCOUNT_NAME} +azure.storage.account-key = ${AZURE_STORAGE_ACCOUNT_KEY} +azure.files.share.name = ${AZURE_FILES_SHARE_NAME:camel-quarkus-share} +azure.files.share.directory.name = ${AZURE_FILES_SHARE_DIRECTORY_NAME:test} diff --git a/integration-tests-jvm/azure-files/src/test/java/org/apache/camel/quarkus/component/azure/files/it/AzureFilesTest.java b/integration-tests-jvm/azure-files/src/test/java/org/apache/camel/quarkus/component/azure/files/it/AzureFilesTest.java new file mode 100644 index 0000000000..e3890ec5c0 --- /dev/null +++ b/integration-tests-jvm/azure-files/src/test/java/org/apache/camel/quarkus/component/azure/files/it/AzureFilesTest.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.files.it; + +import java.nio.charset.StandardCharsets; +import java.util.UUID; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; + +import static org.hamcrest.Matchers.is; + +// There is currently no Azure file share support in Azurite - https://github.com/Azure/Azurite/issues/113 +@EnabledIfEnvironmentVariable(named = "AZURE_STORAGE_ACCOUNT_NAME", matches = ".+") +@EnabledIfEnvironmentVariable(named = "AZURE_STORAGE_ACCOUNT_KEY", matches = ".+") +@EnabledIfEnvironmentVariable(named = "AZURE_FILES_SHARE_NAME", matches = ".+") +@EnabledIfEnvironmentVariable(named = "AZURE_FILES_SHARE_DIRECTORY_NAME", matches = ".+") +@QuarkusTest +class AzureFilesTest { + @Test + void produceAndConsume() { + try { + String fileContent = UUID.randomUUID().toString(); + String fileName = UUID.randomUUID() + ".txt"; + + // Upload file + RestAssured.given() + .contentType(ContentType.BINARY) + .body(fileContent.getBytes(StandardCharsets.UTF_8)) + .when() + .post("/azure-files/upload/" + fileName) + .then() + .statusCode(201); + + RestAssured.given() + .post("/azure-files/route/azure-files-consumer/start") + .then() + .statusCode(204); + + // Download file + RestAssured.get("/azure-files/downloaded") + .then() + .statusCode(200) + .body(is(fileContent)); + } finally { + RestAssured.given() + .post("/azure-files/route/azure-files-consumer/stop") + .then() + .statusCode(204); + } + } +} diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml index 871de289e7..e4bcee64cd 100644 --- a/integration-tests-jvm/pom.xml +++ b/integration-tests-jvm/pom.xml @@ -37,6 +37,7 @@ <module>asterisk</module> <module>aws-xray</module> <module>azure-cosmosdb</module> + <module>azure-files</module> <module>azure-storage-datalake</module> <module>barcode</module> <module>bonita</module> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index d99623e1a2..6ee14d3e0a 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -469,6 +469,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-azure-files</artifactId> + <version>${camel.version}</version> + <exclusions> + <exclusion> + <groupId>com.azure</groupId> + <artifactId>azure-core-http-netty</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-azure-key-vault</artifactId> @@ -3328,6 +3339,16 @@ <artifactId>camel-quarkus-azure-eventhubs-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-key-vault</artifactId> diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml index b4c8189565..71a478a7db 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -407,6 +407,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-azure-files</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>4.10.2</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <exclusions> + <exclusion> + <groupId>com.azure</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>azure-core-http-netty</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-azure-key-vault</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -3252,6 +3263,16 @@ <artifactId>camel-quarkus-azure-eventhubs-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.22.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-azure-files</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.22.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-azure-files-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.22.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-azure-key-vault</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml index d0d9f432fa..7f2dafa3be 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -407,6 +407,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-azure-files</artifactId> + <version>4.10.2</version> + <exclusions> + <exclusion> + <groupId>com.azure</groupId> + <artifactId>azure-core-http-netty</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-azure-key-vault</artifactId> @@ -3242,6 +3253,16 @@ <artifactId>camel-quarkus-azure-eventhubs-deployment</artifactId> <version>3.22.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files</artifactId> + <version>3.22.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-azure-files-deployment</artifactId> + <version>3.22.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-key-vault</artifactId> @@ -8471,6 +8492,11 @@ <artifactId>azure-storage-file-datalake</artifactId> <version>12.22.0</version> </dependency> + <dependency> + <groupId>com.azure</groupId> + <artifactId>azure-storage-file-share</artifactId> + <version>12.25.0</version> + </dependency> <dependency> <groupId>com.azure</groupId> <artifactId>azure-storage-internal-avro</artifactId> diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml index 1f1e7eea02..55fba28b49 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -407,6 +407,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-azure-files</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>4.10.2</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <exclusions> + <exclusion> + <groupId>com.azure</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>azure-core-http-netty</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-azure-key-vault</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -3242,6 +3253,16 @@ <artifactId>camel-quarkus-azure-eventhubs-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.22.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-azure-files</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.22.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-azure-files-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.22.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-azure-key-vault</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -8471,6 +8492,11 @@ <artifactId>azure-storage-file-datalake</artifactId><!-- com.azure:azure-sdk-bom:1.2.31 --> <version>12.22.0</version><!-- com.azure:azure-sdk-bom:1.2.31 --> </dependency> + <dependency> + <groupId>com.azure</groupId><!-- com.azure:azure-sdk-bom:1.2.31 --> + <artifactId>azure-storage-file-share</artifactId><!-- com.azure:azure-sdk-bom:1.2.31 --> + <version>12.25.0</version><!-- com.azure:azure-sdk-bom:1.2.31 --> + </dependency> <dependency> <groupId>com.azure</groupId><!-- com.azure:azure-sdk-bom:1.2.31 --> <artifactId>azure-storage-internal-avro</artifactId><!-- com.azure:azure-sdk-bom:1.2.31 -->