This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new a2dd8f8 Google Storage support #2421
a2dd8f8 is described below
commit a2dd8f84cd03a372455db8318a03cc4a9e41e39c
Author: JiriOndrusek <[email protected]>
AuthorDate: Thu Apr 22 14:56:30 2021 +0200
Google Storage support #2421
---
catalog/pom.xml | 13 ++
docs/modules/ROOT/nav.adoc | 1 +
.../pages/reference/extensions/google-storage.adoc | 60 ++++++
.../reference/components/google-storage.adoc | 14 +-
extensions/google-storage/deployment/pom.xml | 68 +++++++
.../storage/deployment/GoogleStorageProcessor.java | 43 +++++
extensions/google-storage/pom.xml | 39 ++++
extensions/google-storage/runtime/pom.xml | 124 +++++++++++++
.../runtime/src/main/doc/configuration.adoc | 11 ++
.../google/storage/GoogleStorageEnforcer.java | 35 ++++
.../main/resources/META-INF/quarkus-extension.yaml | 31 ++++
extensions/pom.xml | 1 +
integration-tests/google-storage/pom.xml | 145 +++++++++++++++
.../google/storage/it/GoogleStorageHelper.java | 31 ++++
.../google/storage/it/GoogleStorageResource.java | 201 +++++++++++++++++++++
.../google/storage/it/GoogleStorageRoute.java | 34 ++++
.../google-storage/src/main/resources/README.adoc | 23 +++
.../src/main/resources/application.properties | 18 ++
.../google/storage/it/GoogleStorageIT.java | 24 +++
.../google/storage/it/GoogleStorageTest.java | 183 +++++++++++++++++++
.../storage/it/GoogleStorageTestResource.java | 61 +++++++
integration-tests/pom.xml | 1 +
poms/bom/pom.xml | 25 +++
tooling/scripts/test-categories.yaml | 1 +
24 files changed, 1186 insertions(+), 1 deletion(-)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 4cd06eb..8a76ad1 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -1518,6 +1518,19 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-storage</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-graphql</artifactId>
<version>${project.version}</version>
<type>pom</type>
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 7545d0c..ea15586 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -131,6 +131,7 @@
*** xref:reference/extensions/google-mail.adoc[Google Mail]
*** xref:reference/extensions/google-pubsub.adoc[Google Pubsub]
*** xref:reference/extensions/google-sheets.adoc[Google Sheets]
+*** xref:reference/extensions/google-storage.adoc[Google Storage]
*** xref:reference/extensions/graphql.adoc[GraphQL]
*** xref:reference/extensions/grok.adoc[Grok]
*** xref:reference/extensions/groovy.adoc[Groovy]
diff --git a/docs/modules/ROOT/pages/reference/extensions/google-storage.adoc
b/docs/modules/ROOT/pages/reference/extensions/google-storage.adoc
new file mode 100644
index 0000000..1790f22
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/google-storage.adoc
@@ -0,0 +1,60 @@
+// Do not edit directly!
+// This file was generated by
camel-quarkus-maven-plugin:update-extension-doc-page
+= Google Storage
+:linkattrs:
+:cq-artifact-id: camel-quarkus-google-storage
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
+:cq-description: Store and retrieve objects from Google Cloud Storage Service
using the google-cloud-storage library.
+:cq-deprecated: false
+:cq-jvm-since: 1.9.0
+:cq-native-since: 1.9.0
+
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##1.9.0## [.badge-key]##Native
since##[.badge-supported]##1.9.0##
+
+Store and retrieve objects from Google Cloud Storage Service using the
google-cloud-storage library.
+
+== What's inside
+
+* xref:{cq-camel-components}::google-storage-component.adoc[Google Storage
component], URI syntax: `google-storage:bucketName`
+
+Please refer to the above link for usage and configuration details.
+
+== Maven coordinates
+
+https://code.quarkus.io/?extension-search=camel-quarkus-google-storage[Create
a new project with this extension on code.quarkus.io, window="_blank"]
+
+Or add the coordinates to your existing project:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-storage</artifactId>
+</dependency>
+----
+
+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].
+
+== Additional Camel Quarkus configuration
+
+There are two different configuration approaches:
+
+* Google storage client can be defined via quarkus properties leveraging the
Quarkiverse - Google Cloud Services - Storage (see
https://github.com/quarkiverse/quarkus-google-cloud-services/blob/main/storage[extension
git page]).
+Camel will autowire client into the Google-storage component.
+This configuration allows definition of only one storage client, therefore it
isn't possible to define several different endpoints, which run together.
+
+* When multiple storage clients are needed, one or more storage client bean
need to be registered in the registry (e.g. via a CDI bean producer). Each
storage client bean could then be referenced from distinct endpoints.
+[source,properties]
+----
+google-storage://bucket?storageClient=#my_client
+----
+
diff --git
a/docs/modules/ROOT/partials/reference/components/google-storage.adoc
b/docs/modules/ROOT/partials/reference/components/google-storage.adoc
index a509c1d..37a90e4 100644
--- a/docs/modules/ROOT/partials/reference/components/google-storage.adoc
+++ b/docs/modules/ROOT/partials/reference/components/google-storage.adoc
@@ -1 +1,13 @@
-// Empty partial for a Camel bit unsupported by Camel Quarkus to avoid
warnings when this file is included from a Camel page
+// Do not edit directly!
+// This file was generated by
camel-quarkus-maven-plugin:update-extension-doc-page
+:cq-artifact-id: camel-quarkus-google-storage
+:cq-artifact-id-base: google-storage
+:cq-native-supported: true
+:cq-status: Stable
+:cq-deprecated: false
+:cq-jvm-since: 1.9.0
+:cq-native-since: 1.9.0
+:cq-camel-part-name: google-storage
+:cq-camel-part-title: Google Storage
+:cq-camel-part-description: Store and retrieve objects from Google Cloud
Storage Service using the google-cloud-storage library.
+:cq-extension-page-title: Google Storage
diff --git a/extensions/google-storage/deployment/pom.xml
b/extensions/google-storage/deployment/pom.xml
new file mode 100644
index 0000000..17e3a28
--- /dev/null
+++ b/extensions/google-storage/deployment/pom.xml
@@ -0,0 +1,68 @@
+<?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-google-storage-parent</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-google-storage-deployment</artifactId>
+ <name>Camel Quarkus :: Google Storage :: 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-google-storage</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkiverse.googlecloudservices</groupId>
+ <artifactId>quarkus-google-cloud-storage-deployment</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/google-storage/deployment/src/main/java/org/apache/camel/quarkus/component/google/storage/deployment/GoogleStorageProcessor.java
b/extensions/google-storage/deployment/src/main/java/org/apache/camel/quarkus/component/google/storage/deployment/GoogleStorageProcessor.java
new file mode 100644
index 0000000..b2dcc29
--- /dev/null
+++
b/extensions/google-storage/deployment/src/main/java/org/apache/camel/quarkus/component/google/storage/deployment/GoogleStorageProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * 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.google.storage.deployment;
+
+import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import org.apache.camel.quarkus.component.google.storage.GoogleStorageEnforcer;
+
+class GoogleStorageProcessor {
+
+ private static final String FEATURE = "camel-google-storage";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
+ return new ExtensionSslNativeSupportBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ public AdditionalBeanBuildItem storageEnforcer() {
+ return new AdditionalBeanBuildItem(GoogleStorageEnforcer.class);
+ }
+}
diff --git a/extensions/google-storage/pom.xml
b/extensions/google-storage/pom.xml
new file mode 100644
index 0000000..704d977
--- /dev/null
+++ b/extensions/google-storage/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-build-parent</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-google-storage-parent</artifactId>
+ <name>Camel Quarkus :: Google Storage</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/google-storage/runtime/pom.xml
b/extensions/google-storage/runtime/pom.xml
new file mode 100644
index 0000000..aff9f7d
--- /dev/null
+++ b/extensions/google-storage/runtime/pom.xml
@@ -0,0 +1,124 @@
+<?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-google-storage-parent</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-google-storage</artifactId>
+ <name>Camel Quarkus :: Google Storage :: Runtime</name>
+ <description>Store and retrieve objects from Google Cloud Storage Service
using the google-cloud-storage library.</description>
+
+ <properties>
+ <camel.quarkus.jvmSince>1.9.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>1.9.0</camel.quarkus.nativeSince>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</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-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-storage</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>google-cloud-storage</artifactId>
+ <groupId>com.google.cloud</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkiverse.googlecloudservices</groupId>
+ <artifactId>quarkus-google-cloud-storage</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bootstrap-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/google-storage/runtime/src/main/doc/configuration.adoc
b/extensions/google-storage/runtime/src/main/doc/configuration.adoc
new file mode 100644
index 0000000..a4c6437
--- /dev/null
+++ b/extensions/google-storage/runtime/src/main/doc/configuration.adoc
@@ -0,0 +1,11 @@
+There are two different configuration approaches:
+
+* Google storage client can be defined via quarkus properties leveraging the
Quarkiverse - Google Cloud Services - Storage (see
https://github.com/quarkiverse/quarkus-google-cloud-services/blob/main/storage[extension
git page]).
+Camel will autowire client into the Google-storage component.
+This configuration allows definition of only one storage client, therefore it
isn't possible to define several different endpoints, which run together.
+
+* When multiple storage clients are needed, one or more storage client bean
need to be registered in the registry (e.g. via a CDI bean producer). Each
storage client bean could then be referenced from distinct endpoints.
+[source,properties]
+----
+google-storage://bucket?storageClient=#my_client
+----
\ No newline at end of file
diff --git
a/extensions/google-storage/runtime/src/main/java/org/apache/camel/quarkus/component/google/storage/GoogleStorageEnforcer.java
b/extensions/google-storage/runtime/src/main/java/org/apache/camel/quarkus/component/google/storage/GoogleStorageEnforcer.java
new file mode 100644
index 0000000..a937d28
--- /dev/null
+++
b/extensions/google-storage/runtime/src/main/java/org/apache/camel/quarkus/component/google/storage/GoogleStorageEnforcer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.google.storage;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import com.google.cloud.storage.Storage;
+
+@ApplicationScoped
+public class GoogleStorageEnforcer {
+
+ //Quarkiverse StorageProducer creates storage based on properties.
+ //Because of https://github.com/apache/camel-quarkus/issues/1387, storage
is removed and not applied to component.
+ //UnremovableBeanBuildItem does not fix this.
+ //Injecting all storages makes Quarkiverse StorageProducer to be used.
+ //In case, that user defines multiple clients, all clients have to be
injected, otherwise exception "Ambiguous dependencies" is thrown.
+ @Inject
+ Instance<Storage> storages;
+}
diff --git
a/extensions/google-storage/runtime/src/main/resources/META-INF/quarkus-extension.yaml
b/extensions/google-storage/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..da28f59
--- /dev/null
+++
b/extensions/google-storage/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,31 @@
+#
+# 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 Google Storage"
+description: "Store and retrieve objects from Google Cloud Storage Service
using the google-cloud-storage library"
+metadata:
+ guide:
"https://camel.apache.org/camel-quarkus/latest/reference/extensions/google-storage.html"
+ categories:
+ - "integration"
+ status:
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 86ca807..3a8940c 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -113,6 +113,7 @@
<module>google-mail</module>
<module>google-pubsub</module>
<module>google-sheets</module>
+ <module>google-storage</module>
<module>graphql</module>
<module>grok</module>
<module>grpc</module>
diff --git a/integration-tests/google-storage/pom.xml
b/integration-tests/google-storage/pom.xml
new file mode 100644
index 0000000..43d6dcd
--- /dev/null
+++ b/integration-tests/google-storage/pom.xml
@@ -0,0 +1,145 @@
+<?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.9.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-google-storage</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Google Storage</name>
+ <description>Integration tests for Camel Quarkus Google Storage
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-google-storage</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</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.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-integration-test-support-mock-backend</artifactId>
+ </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-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-google-storage-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/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageHelper.java
b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageHelper.java
new file mode 100644
index 0000000..d593b30
--- /dev/null
+++
b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageHelper.java
@@ -0,0 +1,31 @@
+/*
+ * 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.google.storage.it;
+
+import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
+
+public class GoogleStorageHelper {
+
+ public static boolean usingMockBackend() {
+ final String realCredentials =
System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
+ final String realProjectId = System.getenv("GOOGLE_PROJECT_ID");
+ final boolean realCredentialsProvided = realCredentials != null &&
realProjectId != null;
+ final boolean startMockBackend =
MockBackendUtils.startMockBackend(false);
+ final boolean usingMockBackend = startMockBackend &&
!realCredentialsProvided;
+ return usingMockBackend;
+ }
+}
diff --git
a/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java
b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java
new file mode 100644
index 0000000..a18425b
--- /dev/null
+++
b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java
@@ -0,0 +1,201 @@
+/*
+ * 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.google.storage.it;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.Bucket;
+import com.google.cloud.storage.CopyWriter;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
+import io.quarkiverse.googlecloudservices.storage.runtime.StorageProducer;
+import io.quarkus.arc.Unremovable;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.google.storage.GoogleCloudStorageComponent;
+import org.apache.camel.component.google.storage.GoogleCloudStorageConstants;
+import org.apache.camel.component.google.storage.GoogleCloudStorageOperations;
+
+@Path("/google-storage")
+@ApplicationScoped
+public class GoogleStorageResource {
+
+ public static final String POLLING_ROUTE_NAME = "polling";
+ public static final String DEST_BUCKET = "camel_quarkus_test_dest_bucket";
+ public static final String TEST_BUCKET1 = "camel_quarkus_test_bucket1";
+ public static final String TEST_BUCKET2 = "camel_quarkus_test_bucket2";
+ public static final String TEST_BUCKET3 = "camel_quarkus_test_bucket3";
+
+ public static final String DIRECT_POLLING = "direct:polling";
+
+ public static final String PARAM_PORT =
"org.apache.camel.quarkus.component.googlr.storage.it.GoogleStorageClientProducer_port";
+
+ public static final String QUERY_OBJECT_NAME = "objectName";
+ public static final String QUERY_BUCKET = "bucketName";
+ public static final String QUERY_OPERATION = "operation";
+
+ private static final String COMPONENT_GOOGLE_STORAGE = "google-storage";
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Inject
+ ConsumerTemplate consumerTemplate;
+
+ @Inject
+ StorageProducer sp;
+
+ @Inject
+ CamelContext camelContext;
+
+ private Storage client;
+
+ @Produces
+ @ApplicationScoped
+ @Unremovable
+ @Named(COMPONENT_GOOGLE_STORAGE)
+ GoogleCloudStorageComponent produceComponent() throws IOException {
+ GoogleCloudStorageComponent gsc = new GoogleCloudStorageComponent();
+ if (GoogleStorageHelper.usingMockBackend()) {
+ String port = System.getProperty(GoogleStorageResource.PARAM_PORT);
+ client = StorageOptions.newBuilder()
+ .setHost("http://localhost:" + port)
+ .setProjectId("dummy-project-for-testing")
+ .build()
+ .getService();
+ } else {
+ client = sp.storage();
+ }
+
+ gsc.getConfiguration().setStorageClient(client);
+ return gsc;
+ }
+
+ @Path("/operation")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String operation(Map<String, Object> parameters,
+ @QueryParam(QUERY_OPERATION) String operation,
+ @QueryParam(QUERY_BUCKET) String bucketName) throws Exception {
+ GoogleCloudStorageOperations op =
GoogleCloudStorageOperations.valueOf(operation);
+ String url = getBaseUrl(bucketName, "operation=" + op.toString());
+ final Object response = producerTemplate.requestBodyAndHeaders(url,
null, parameters, Object.class);
+ if (response instanceof Blob) {
+ return new String(((Blob) response).getContent());
+ }
+ if (response instanceof CopyWriter) {
+ return new String(((CopyWriter)
response).getResult().getContent());
+ }
+ if (response instanceof List) {
+ List l = (List) response;
+ return (String) l.stream().map(o -> {
+ if (o instanceof Bucket) {
+ return ((Bucket) o).getName();
+ }
+ if (o instanceof Blob) {
+ return ((Blob) o).getName();
+ }
+ return "null";
+ }).collect(Collectors.joining(","));
+ }
+ return String.valueOf(response);
+ }
+
+ @Path("/putObject")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response putObject(String body,
+ @QueryParam(QUERY_BUCKET) String bucketName,
+ @QueryParam(QUERY_OBJECT_NAME) String objectName) throws Exception
{
+ String url = getBaseUrl(bucketName, "autoCreateBucket=true");
+ final Blob response = producerTemplate.requestBodyAndHeader(url,
+ body,
+ GoogleCloudStorageConstants.OBJECT_NAME, objectName,
Blob.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response.getName())
+ .build();
+ }
+
+ @Path("/getFromDirect")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getFromDirect() {
+ return
consumerTemplate.receiveBody(GoogleStorageResource.DIRECT_POLLING,
+ GoogleStorageHelper.usingMockBackend() ? 10000 : 5000,
String.class);
+ }
+
+ private String getBaseUrl(String bucketName, String parameters) {
+ return "google-storage://" + bucketName + "?" + parameters;
+ }
+
+ @Path("/deleteBuckets")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deleteBuckets() throws Exception {
+
+ List<String> buckets = new LinkedList<>();
+ for (Bucket bucket : client.list().iterateAll()) {
+ buckets.add(bucket.getName());
+ }
+ if
(!camelContext.getRouteController().getRouteStatus(POLLING_ROUTE_NAME).isStopped())
{
+ buckets.remove(TEST_BUCKET3);
+ buckets.remove(DEST_BUCKET);
+ }
+
+ buckets.stream().forEach(
+ b -> {
+ for (Blob blob : client.list(b).iterateAll()) {
+ client.delete(blob.getBlobId());
+ }
+ client.delete(b);
+ });
+ return Response.ok().build();
+ }
+
+ @Path("/stopRoute")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response stopRoute() throws Exception {
+
+ camelContext.getRouteController().stopRoute(POLLING_ROUTE_NAME);
+
+ return Response.ok().build();
+ }
+
+}
diff --git
a/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageRoute.java
b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageRoute.java
new file mode 100644
index 0000000..3627ce0
--- /dev/null
+++
b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageRoute.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.google.storage.it;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class GoogleStorageRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+
+ from("google-storage://" + GoogleStorageResource.TEST_BUCKET3 +
"?autoCreateBucket=true" +
+ "&destinationBucket=" + GoogleStorageResource.DEST_BUCKET +
+ "&moveAfterRead=true" +
+ "&includeBody=true")
+ .id(GoogleStorageResource.POLLING_ROUTE_NAME)
+ .to(GoogleStorageResource.DIRECT_POLLING);
+ }
+
+}
diff --git a/integration-tests/google-storage/src/main/resources/README.adoc
b/integration-tests/google-storage/src/main/resources/README.adoc
new file mode 100644
index 0000000..2682f8b
--- /dev/null
+++ b/integration-tests/google-storage/src/main/resources/README.adoc
@@ -0,0 +1,23 @@
+== Google Storage integration tests
+
+=== Local container
+
+Google storage container doesn't cover all the functionalities. (For example
deleting of buckets is not implemented - see an
+https://github.com/fsouza/fake-gcs-server/issues/214[issue])
+
+Tests are executed with local container, unless
`GOOGLE_APPLICATION_CREDENTIALS` property is set.
+
+=== Real Google Storage
+
+To run the Google Storage client library, you must first set up authentication
by creating a service account key.
+You can find more info in the
https://cloud.google.com/storage/docs/reference/libraries#setting_up_authentication[documentation].
+
+When you have the **service account key** you can provide authentication
credentials to your application code by setting the environment variable:
+
+`export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/my-key.json"`
+`export GOOGLE_PROJECT_ID="#name of project"`
+
+or for windows:
+
+`$Env:GOOGLE_APPLICATION_CREDENTIALS = "/home/user/Downloads/my-key.json"`
+`$Env:GOOGLE_PROJECT_ID="#name of project"`
\ No newline at end of file
diff --git
a/integration-tests/google-storage/src/main/resources/application.properties
b/integration-tests/google-storage/src/main/resources/application.properties
new file mode 100644
index 0000000..03e3175
--- /dev/null
+++ b/integration-tests/google-storage/src/main/resources/application.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+quarkus.google.cloud.service-account-location=${GOOGLE_APPLICATION_CREDENTIALS:}
+quarkus.google.cloud.project-id=${GOOGLE_PROJECT_ID:}
diff --git
a/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageIT.java
b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageIT.java
new file mode 100644
index 0000000..31a3aa4
--- /dev/null
+++
b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.google.storage.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class GoogleStorageIT extends GoogleStorageTest {
+
+}
diff --git
a/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTest.java
b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTest.java
new file mode 100644
index 0000000..9d55014
--- /dev/null
+++
b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTest.java
@@ -0,0 +1,183 @@
+/*
+ * 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.google.storage.it;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import io.restassured.response.ValidatableResponse;
+import org.apache.camel.component.google.storage.GoogleCloudStorageConstants;
+import org.apache.camel.component.google.storage.GoogleCloudStorageOperations;
+import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
+import org.apache.camel.util.CollectionHelper;
+import org.hamcrest.Matcher;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static
org.apache.camel.quarkus.component.google.storage.it.GoogleStorageResource.DEST_BUCKET;
+import static
org.apache.camel.quarkus.component.google.storage.it.GoogleStorageResource.TEST_BUCKET1;
+import static
org.apache.camel.quarkus.component.google.storage.it.GoogleStorageResource.TEST_BUCKET2;
+import static
org.apache.camel.quarkus.component.google.storage.it.GoogleStorageResource.TEST_BUCKET3;
+import static org.hamcrest.Matchers.both;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+
+@QuarkusTest
+@QuarkusTestResource(GoogleStorageTestResource.class)
+class GoogleStorageTest {
+
+ private static final String FILE_NAME_007 = "file007";
+ private static final String FILE_NAME_006 = "file006";
+
+ @AfterEach
+ public void afterEach() {
+ //clean after test (only in real environment)
+ if (!GoogleStorageHelper.usingMockBackend()) {
+ RestAssured.given()
+ .get("/google-storage/deleteBuckets")
+ .then()
+ .statusCode(200);
+ }
+ }
+
+ @Test
+ public void testConsumer() throws InterruptedException {
+ try {
+ //producer - putObject
+ putObject("Sheldon", TEST_BUCKET3, FILE_NAME_007);
+
+ //get result from direct (for pooling) with timeout
+ RestAssured.given()
+ .post("/google-storage/getFromDirect")
+ .then()
+ .statusCode(200)
+ .body(is("Sheldon"));
+
+ //producer - getObject
+ executeOperation(DEST_BUCKET,
GoogleCloudStorageOperations.getObject,
+
Collections.singletonMap(GoogleCloudStorageConstants.OBJECT_NAME,
FILE_NAME_007),
+ is("Sheldon"));
+
+ } finally {
+ //stop route to allow bucket deletion without errors in real
environment
+ if (!GoogleStorageHelper.usingMockBackend()) {
+ RestAssured.given()
+ .get("/google-storage/stopRoute")
+ .then()
+ .statusCode(200);
+ }
+ }
+ }
+
+ @Test
+ public void testProducer() {
+ //delete existing buckets t - only on real account - Deleting buckets
is not (yet) supported by fsouza/fake-gcs-server.
+ if (!MockBackendUtils.startMockBackend()) {
+ String buckets =
executeOperation(GoogleCloudStorageOperations.listBuckets,
Collections.emptyMap(),
+ null);
+ List<String> bucketsToDelete = Arrays.stream(buckets.split(","))
+ .filter(b -> b.equals(TEST_BUCKET1) ||
b.equals(TEST_BUCKET2))
+ .collect(Collectors.toList());
+ if (!bucketsToDelete.isEmpty()) {
+ bucketsToDelete.forEach(
+ b -> executeOperation(b,
GoogleCloudStorageOperations.deleteBucket, Collections.emptyMap(),
+ is(Boolean.toString(true))));
+ }
+ }
+
+ //create object in testBucket
+ putObject("Sheldon", TEST_BUCKET1, FILE_NAME_007);
+
+ putObject("Irma", TEST_BUCKET2, FILE_NAME_006);
+
+ //copy object to test_bucket2
+ executeOperation(GoogleCloudStorageOperations.copyObject,
+
CollectionHelper.mapOf(GoogleCloudStorageConstants.OBJECT_NAME, FILE_NAME_007,
+ GoogleCloudStorageConstants.DESTINATION_BUCKET_NAME,
TEST_BUCKET2,
+ GoogleCloudStorageConstants.DESTINATION_OBJECT_NAME,
FILE_NAME_007 + "_copy"),
+ is("Sheldon"));
+
+ //GetObject
+ executeOperation(TEST_BUCKET2, GoogleCloudStorageOperations.getObject,
+
Collections.singletonMap(GoogleCloudStorageConstants.OBJECT_NAME, FILE_NAME_007
+ "_copy"),
+ is("Sheldon"));
+
+ //list buckets
+ executeOperation(GoogleCloudStorageOperations.listBuckets,
Collections.emptyMap(),
+
both(containsString(TEST_BUCKET1)).and(containsString(TEST_BUCKET2)));
+
+ //deleteObject
+ executeOperation(TEST_BUCKET2,
GoogleCloudStorageOperations.deleteObject,
+
CollectionHelper.mapOf(GoogleCloudStorageConstants.OBJECT_NAME, FILE_NAME_006),
+ is(Boolean.toString(true)));
+
+ //ListObjects
+ executeOperation(TEST_BUCKET2,
GoogleCloudStorageOperations.listObjects, Collections.emptyMap(),
+ containsString(FILE_NAME_007 + "_copy"));
+
+ //CreateDownloadLink - requires authentication
+ if (!GoogleStorageHelper.usingMockBackend()) {
+ executeOperation(TEST_BUCKET2,
GoogleCloudStorageOperations.createDownloadLink,
+
Collections.singletonMap(GoogleCloudStorageConstants.OBJECT_NAME, FILE_NAME_007
+ "_copy"),
+ startsWith("http"));
+ }
+ }
+
+ private void putObject(String content, String bucketName, String fileName)
{
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(content)
+ .queryParam(GoogleStorageResource.QUERY_BUCKET, bucketName)
+ .queryParam(GoogleStorageResource.QUERY_OBJECT_NAME, fileName)
+ .post("/google-storage/putObject")
+ .then()
+ .statusCode(201)
+ .body(is(fileName));
+ }
+
+ private static String executeOperation(GoogleCloudStorageOperations
operation, Map<String, Object> parameters,
+ Matcher matcher) {
+ return executeOperation(TEST_BUCKET1, operation, parameters, matcher);
+ }
+
+ private static String executeOperation(String bucketName,
GoogleCloudStorageOperations operation,
+ Map<String, Object> parameters, Matcher matcher) {
+ ValidatableResponse response = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(parameters)
+ .queryParam(GoogleStorageResource.QUERY_BUCKET, bucketName)
+ .queryParam(GoogleStorageResource.QUERY_OPERATION, operation)
+ .post("/google-storage/operation")
+ .then()
+ .statusCode(200);
+
+ if (matcher != null) {
+ response.body(matcher);
+ }
+
+ return response.extract().asString();
+ }
+
+}
diff --git
a/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java
b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java
new file mode 100644
index 0000000..92c6cf5
--- /dev/null
+++
b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java
@@ -0,0 +1,61 @@
+/*
+ * 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.google.storage.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.testcontainers.containers.GenericContainer;
+
+public class GoogleStorageTestResource implements
QuarkusTestResourceLifecycleManager {
+
+ public static final int PORT = 4443;
+ public static final String CONTAINER_NAME = "fsouza/fake-gcs-server";
+
+ private GenericContainer<?> container;
+
+ @Override
+ public Map<String, String> start() {
+
+ Map<String, String> properties = new HashMap<>();
+
+ if (GoogleStorageHelper.usingMockBackend()) {
+
+ container = new GenericContainer<>(CONTAINER_NAME)
+ .withExposedPorts(PORT)
+ .withCreateContainerCmdModifier(
+ it -> it.withEntrypoint("/bin/fake-gcs-server",
"-scheme", "http"));
+ container.start();
+
+ properties.put(GoogleStorageResource.PARAM_PORT,
container.getMappedPort(PORT).toString());
+ }
+
+ return properties;
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (container != null) {
+ container.stop();
+ }
+ } catch (Exception e) {
+ // Ignored
+ }
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index d3f1dec..cbeb566 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -110,6 +110,7 @@
<module>google</module>
<module>google-bigquery</module>
<module>google-pubsub</module>
+ <module>google-storage</module>
<module>graphql</module>
<module>grok</module>
<module>grpc</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 8129b49..66282bc 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -904,6 +904,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-storage</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-graphql</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -3269,6 +3274,16 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-storage</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-google-storage-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-graphql</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
@@ -5784,6 +5799,16 @@
<version>${quarkus-google-cloud.version}</version>
</dependency>
<dependency>
+ <groupId>io.quarkiverse.googlecloudservices</groupId>
+ <artifactId>quarkus-google-cloud-storage</artifactId>
+ <version>${quarkus-google-cloud.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkiverse.googlecloudservices</groupId>
+
<artifactId>quarkus-google-cloud-storage-deployment</artifactId>
+ <version>${quarkus-google-cloud.version}</version>
+ </dependency>
+ <dependency>
<groupId>io.quarkiverse.minio</groupId>
<artifactId>quarkus-minio</artifactId>
<version>${quarkiverse-minio.version}</version>
diff --git a/tooling/scripts/test-categories.yaml
b/tooling/scripts/test-categories.yaml
index f618fab..c796d9d 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -20,6 +20,7 @@ group-01:
- avro-rpc
- caffeine
- git
+ - google-storage
- hazelcast
- http
- infinispan