You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/03/19 12:09:19 UTC
[camel-quarkus] branch master updated: Add Google Sheets extension
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 5dbb79b Add Google Sheets extension
5dbb79b is described below
commit 5dbb79b0248fffb719e578fb5413726f6f061e59
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Mar 19 10:12:12 2020 +0000
Add Google Sheets extension
Fixes #809
---
.../pages/list-of-camel-quarkus-extensions.adoc | 10 +-
extensions/google-sheets/deployment/pom.xml | 79 +++++++++++++++
.../sheets/deployment/GoogleSheetsProcessor.java | 66 +++++++++++++
extensions/google-sheets/pom.xml | 39 ++++++++
extensions/google-sheets/runtime/pom.xml | 87 ++++++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 31 ++++++
extensions/pom.xml | 1 +
integration-tests/google/pom.xml | 6 +-
.../component/google/it/GoogleSheetsResource.java | 110 +++++++++++++++++++++
.../src/main/resources/application.properties | 5 +
.../component/google/it/GoogleComponentsTest.java | 42 +++++++-
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
13 files changed, 488 insertions(+), 3 deletions(-)
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index f738b20..a27a61b 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list:
== Camel Components
// components: START
-Number of Camel components: 85 in 73 JAR artifacts (0 deprecated)
+Number of Camel components: 87 in 74 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,1,5",options="header"]
|===
@@ -193,6 +193,14 @@ Level | Since | Description
`google-mail-stream:index` | Native +
Stable | 1.0.0-M6 | The google-mail component provides access to Google Mail.
+| link:https://camel.apache.org/components/latest/google-sheets-component.html[Google Sheets] (camel-quarkus-google-sheets) +
+`google-sheets:apiName/methodName` | Native +
+ Stable | 1.0.0-M6 | The google-sheets component provides access to Google Sheets.
+
+| link:https://camel.apache.org/components/latest/google-sheets-stream-component.html[Google Sheets Stream] (camel-quarkus-google-sheets) +
+`google-sheets-stream:apiName` | Native +
+ Stable | 1.0.0-M6 | The google-sheets-stream component provides access to Google Sheets.
+
| xref:extensions/graphql.adoc[GraphQL] (camel-quarkus-graphql) +
`graphql:httpUri` | Native +
Stable | 1.0.0-M5 | A Camel GraphQL Component
diff --git a/extensions/google-sheets/deployment/pom.xml b/extensions/google-sheets/deployment/pom.xml
new file mode 100644
index 0000000..1c4c05e
--- /dev/null
+++ b/extensions/google-sheets/deployment/pom.xml
@@ -0,0 +1,79 @@
+<?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-sheets-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-google-sheets-deployment</artifactId>
+ <name>Camel Quarkus :: Google Sheets :: Deployment</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-deployment</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-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-google-http-client-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-sheets</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-sheets/deployment/src/main/java/org/apache/camel/quarkus/component/google/sheets/deployment/GoogleSheetsProcessor.java b/extensions/google-sheets/deployment/src/main/java/org/apache/camel/quarkus/component/google/sheets/deployment/GoogleSheetsProcessor.java
new file mode 100644
index 0000000..3846b02
--- /dev/null
+++ b/extensions/google-sheets/deployment/src/main/java/org/apache/camel/quarkus/component/google/sheets/deployment/GoogleSheetsProcessor.java
@@ -0,0 +1,66 @@
+/*
+ * 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.sheets.deployment;
+
+import java.util.Collection;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.quarkus.core.deployment.UnbannedReflectiveBuildItem;
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.AnnotationTarget;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+
+class GoogleSheetsProcessor {
+
+ private static final String FEATURE = "camel-google-sheets";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void applicationArchiveMarkers(BuildProducer<AdditionalApplicationArchiveMarkerBuildItem> applicationArchiveMarker) {
+ applicationArchiveMarker.produce(new AdditionalApplicationArchiveMarkerBuildItem("com/google/api/services/sheets"));
+ }
+
+ @BuildStep
+ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ BuildProducer<UnbannedReflectiveBuildItem> unbannedClass, CombinedIndexBuildItem combinedIndex) {
+ IndexView index = combinedIndex.getIndex();
+
+ // Google sheets component configuration class reflection
+ Collection<AnnotationInstance> uriParams = index
+ .getAnnotations(DotName.createSimple("org.apache.camel.spi.UriParams"));
+
+ String[] googleMailConfigClasses = uriParams.stream()
+ .map(annotation -> annotation.target())
+ .filter(annotationTarget -> annotationTarget.kind().equals(AnnotationTarget.Kind.CLASS))
+ .map(annotationTarget -> annotationTarget.asClass().name().toString())
+ .filter(className -> className.startsWith("org.apache.camel.component.google.sheets"))
+ .toArray(String[]::new);
+
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, googleMailConfigClasses));
+ unbannedClass.produce(new UnbannedReflectiveBuildItem(googleMailConfigClasses));
+ }
+}
diff --git a/extensions/google-sheets/pom.xml b/extensions/google-sheets/pom.xml
new file mode 100644
index 0000000..87b91fc
--- /dev/null
+++ b/extensions/google-sheets/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.1.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-google-sheets-parent</artifactId>
+ <name>Camel Quarkus :: Google Sheets</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/google-sheets/runtime/pom.xml b/extensions/google-sheets/runtime/pom.xml
new file mode 100644
index 0000000..3bbecb6
--- /dev/null
+++ b/extensions/google-sheets/runtime/pom.xml
@@ -0,0 +1,87 @@
+<?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-sheets-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-google-sheets</artifactId>
+ <name>Camel Quarkus :: Google Sheets :: Runtime</name>
+ <description>The google-sheets component provides access to Google Sheets.</description>
+
+ <properties>
+ <firstVersion>1.0.0-M6</firstVersion>
+ </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.quarkus</groupId>
+ <artifactId>camel-quarkus-support-google-http-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-sheets</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>
+</project>
diff --git a/extensions/google-sheets/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/google-sheets/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..15275ab
--- /dev/null
+++ b/extensions/google-sheets/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.
+#
+
+---
+name: "Google Sheets"
+description: "The google-sheets component provides access to Google Sheets."
+metadata:
+ keywords:
+ - "api"
+ - "camel"
+ - "cloud"
+ - "google"
+ - "sheets"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
+ status: "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 9a5a16b..276064f 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -70,6 +70,7 @@
<module>google-calendar</module>
<module>google-drive</module>
<module>google-mail</module>
+ <module>google-sheets</module>
<module>graphql</module>
<module>gson</module>
<module>http</module>
diff --git a/integration-tests/google/pom.xml b/integration-tests/google/pom.xml
index 3ccc3dd..6abda8f 100644
--- a/integration-tests/google/pom.xml
+++ b/integration-tests/google/pom.xml
@@ -38,7 +38,7 @@
<!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
<!-- Please update rule whenever you change the dependencies of this module by running -->
<!-- mvn process-resources -Pformat from the root directory -->
- <mvnd.builder.rule>camel-quarkus-google-calendar-deployment,camel-quarkus-google-drive-deployment,camel-quarkus-google-mail-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+ <mvnd.builder.rule>camel-quarkus-google-calendar-deployment,camel-quarkus-google-drive-deployment,camel-quarkus-google-mail-deployment,camel-quarkus-google-sheets-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
</properties>
<dependencies>
@@ -55,6 +55,10 @@
<artifactId>camel-quarkus-google-mail</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-sheets</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
diff --git a/integration-tests/google/src/main/java/org/apache/camel/quarkus/component/google/it/GoogleSheetsResource.java b/integration-tests/google/src/main/java/org/apache/camel/quarkus/component/google/it/GoogleSheetsResource.java
new file mode 100644
index 0000000..bfffa32
--- /dev/null
+++ b/integration-tests/google/src/main/java/org/apache/camel/quarkus/component/google/it/GoogleSheetsResource.java
@@ -0,0 +1,110 @@
+/*
+ * 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.it;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PATCH;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+import com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest;
+import com.google.api.services.sheets.v4.model.Request;
+import com.google.api.services.sheets.v4.model.Spreadsheet;
+import com.google.api.services.sheets.v4.model.SpreadsheetProperties;
+import com.google.api.services.sheets.v4.model.UpdateSpreadsheetPropertiesRequest;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+
+@Path("/google-sheets")
+public class GoogleSheetsResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/create")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response createSheet(String title) throws Exception {
+ SpreadsheetProperties sheetProperties = new SpreadsheetProperties();
+ sheetProperties.setTitle(title);
+
+ Spreadsheet sheet = new Spreadsheet();
+ sheet.setProperties(sheetProperties);
+
+ Spreadsheet response = producerTemplate.requestBody("google-sheets://spreadsheets/create?inBody=content", sheet,
+ Spreadsheet.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response.getSpreadsheetId())
+ .build();
+ }
+
+ @Path("/read")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response readSheet(@QueryParam("spreadsheetId") String spreadsheetId) {
+ try {
+ Spreadsheet response = producerTemplate.requestBody("google-sheets://spreadsheets/get?inBody=spreadsheetId",
+ spreadsheetId,
+ Spreadsheet.class);
+ if (response != null) {
+ return Response.ok(response.getProperties().getTitle()).build();
+ } else {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ } catch (CamelExecutionException e) {
+ Exception exchangeException = e.getExchange().getException();
+ if (exchangeException != null && exchangeException.getCause() instanceof GoogleJsonResponseException) {
+ GoogleJsonResponseException originalException = (GoogleJsonResponseException) exchangeException.getCause();
+ return Response.status(originalException.getStatusCode()).build();
+ }
+ throw e;
+ }
+ }
+
+ @Path("/update")
+ @PATCH
+ @Consumes(MediaType.TEXT_PLAIN)
+ public Response updateSheet(@QueryParam("spreadsheetId") String spreadsheetId, String title) {
+ BatchUpdateSpreadsheetRequest request = new BatchUpdateSpreadsheetRequest()
+ .setIncludeSpreadsheetInResponse(true)
+ .setRequests(Collections
+ .singletonList(new Request().setUpdateSpreadsheetProperties(new UpdateSpreadsheetPropertiesRequest()
+ .setProperties(new SpreadsheetProperties().setTitle(title))
+ .setFields("title"))));
+
+ final Map<String, Object> headers = new HashMap<>();
+ headers.put("CamelGoogleSheets.spreadsheetId", spreadsheetId);
+ headers.put("CamelGoogleSheets.batchUpdateSpreadsheetRequest", request);
+ producerTemplate.requestBodyAndHeaders("google-sheets://spreadsheets/batchUpdate", null, headers);
+ return Response.ok().build();
+ }
+
+}
diff --git a/integration-tests/google/src/main/resources/application.properties b/integration-tests/google/src/main/resources/application.properties
index c54d3a0..eeaf467 100644
--- a/integration-tests/google/src/main/resources/application.properties
+++ b/integration-tests/google/src/main/resources/application.properties
@@ -33,3 +33,8 @@ camel.component.google-drive.configuration.client-id={{env:GOOGLE_API_CLIENT_ID}
camel.component.google-drive.configuration.client-secret={{env:GOOGLE_API_CLIENT_SECRET}}
camel.component.google-drive.configuration.refresh-token={{env:GOOGLE_API_REFRESH_TOKEN}}
+# Camel Google Sheets
+camel.component.google-sheets.configuration.application-name={{env:GOOGLE_API_APPLICATION_NAME}}
+camel.component.google-sheets.configuration.client-id={{env:GOOGLE_API_CLIENT_ID}}
+camel.component.google-sheets.configuration.client-secret={{env:GOOGLE_API_CLIENT_SECRET}}
+camel.component.google-sheets.configuration.refresh-token={{env:GOOGLE_API_REFRESH_TOKEN}}
diff --git a/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java b/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java
index b609a91..cab11b3 100644
--- a/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java
+++ b/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java
@@ -103,7 +103,7 @@ class GoogleComponentsTest {
.statusCode(204);
// Wait for calendar deletion to occur
- Thread.sleep(500);
+ Thread.sleep(1000);
RestAssured.given()
.queryParam("calendarId", calendarId)
@@ -185,4 +185,44 @@ class GoogleComponentsTest {
.then()
.statusCode(404);
}
+
+ @Test
+ public void testGoogleSheetsComponent() {
+ String title = "Camel Quarkus Google Sheet";
+
+ // Create
+ String sheetId = RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(title)
+ .post("/google-sheets/create")
+ .then()
+ .statusCode(201)
+ .extract()
+ .body()
+ .asString();
+
+ // Read
+ RestAssured.given()
+ .queryParam("spreadsheetId", sheetId)
+ .get("/google-sheets/read")
+ .then()
+ .statusCode(200)
+ .body(is(title));
+
+ // Update
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .queryParam("spreadsheetId", sheetId)
+ .body(title + " Updated")
+ .patch("/google-sheets/update")
+ .then()
+ .statusCode(200);
+
+ RestAssured.given()
+ .queryParam("spreadsheetId", sheetId)
+ .get("/google-sheets/read")
+ .then()
+ .statusCode(200)
+ .body(is(title + " Updated"));
+ }
}
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 29078aa..b4205e3 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -286,6 +286,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-sheets-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-graphql-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 62ebed9..1bf7340 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -329,6 +329,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-sheets</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-graphql</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -977,6 +982,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-google-sheets</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>