You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/09/07 12:49:15 UTC
[camel-quarkus] 01/02: Dropbox native support
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 757529d29bf329c256612e07b111241010ffcac7
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Sep 7 07:44:40 2020 +0100
Dropbox native support
Fixes #1577
---
docs/modules/ROOT/pages/reference/components.adoc | 4 +-
.../ROOT/pages/reference/extensions/dropbox.adoc | 8 +-
docs/modules/ROOT/pages/reference/index.adoc | 4 +-
.../component/dropbox/it/DropboxResource.java | 51 ----------
extensions-jvm/pom.xml | 1 -
.../dropbox/deployment/pom.xml | 0
.../dropbox/deployment/DropboxProcessor.java | 31 ++++---
{extensions-jvm => extensions}/dropbox/pom.xml | 1 -
.../dropbox/runtime/pom.xml | 0
.../main/resources/META-INF/quarkus-extension.yaml | 3 +-
extensions/pom.xml | 1 +
integration-tests/dropbox/README.adoc | 12 +++
.../dropbox}/pom.xml | 62 ++++++++++---
.../component/dropbox/it/DropboxResource.java | 103 +++++++++++++++++++++
.../quarkus/component/dropbox/it/DropboxIT.java | 19 ++--
.../quarkus/component/dropbox/it/DropboxTest.java | 36 ++++++-
integration-tests/pom.xml | 1 +
tooling/scripts/test-categories.yaml | 1 +
18 files changed, 232 insertions(+), 106 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/components.adoc b/docs/modules/ROOT/pages/reference/components.adoc
index eace763..b030c34 100644
--- a/docs/modules/ROOT/pages/reference/components.adoc
+++ b/docs/modules/ROOT/pages/reference/components.adoc
@@ -280,8 +280,8 @@ Stable | 1.0.0 | Map between Java beans using the Dozer mapping library.
| xref:reference/extensions/drill.adoc[Drill] | [.camel-element-artifact]##camel-quarkus-drill## | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Perform queries against an Apache Drill cluster.
-| xref:reference/extensions/dropbox.adoc[Dropbox] | [.camel-element-artifact]##camel-quarkus-dropbox## | [.camel-element-JVM]##JVM## +
-Preview | 1.1.0 | Upload, download and manage files, folders, groups, collaborations, etc on Dropbox.
+| xref:reference/extensions/dropbox.adoc[Dropbox] | [.camel-element-artifact]##camel-quarkus-dropbox## | [.camel-element-Native]##Native## +
+Stable | 1.1.0 | Upload, download and manage files, folders, groups, collaborations, etc on Dropbox.
| xref:reference/extensions/ehcache.adoc[Ehcache] | [.camel-element-artifact]##camel-quarkus-ehcache## | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Perform caching operations using Ehcache.
diff --git a/docs/modules/ROOT/pages/reference/extensions/dropbox.adoc b/docs/modules/ROOT/pages/reference/extensions/dropbox.adoc
index 0256dfb..36a6f10 100644
--- a/docs/modules/ROOT/pages/reference/extensions/dropbox.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/dropbox.adoc
@@ -6,7 +6,7 @@
:page-aliases: extensions/dropbox.adoc
[.badges]
-[.badge-key]##Since Camel Quarkus##[.badge-version]##1.1.0## [.badge-key]##JVM##[.badge-supported]##supported## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##Since Camel Quarkus##[.badge-version]##1.1.0## [.badge-key]##JVM##[.badge-supported]##supported## [.badge-key]##Native##[.badge-supported]##supported##
Upload, download and manage files, folders, groups, collaborations, etc on Dropbox.
@@ -27,3 +27,9 @@ Please refer to the above link for usage and configuration details.
----
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+
+== SSL in native mode
+
+This extension auto-enables SSL support in native mode. Hence you do not need to add
+`quarkus.ssl.native=true` to your `application.properties` yourself. See also
+https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
diff --git a/docs/modules/ROOT/pages/reference/index.adoc b/docs/modules/ROOT/pages/reference/index.adoc
index 6881fd5..cb4b585 100644
--- a/docs/modules/ROOT/pages/reference/index.adoc
+++ b/docs/modules/ROOT/pages/reference/index.adoc
@@ -287,8 +287,8 @@ Stable | 1.0.0 | Map between Java beans using the Dozer mapping library.
| xref:reference/extensions/drill.adoc[Drill] | camel-quarkus-drill | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Perform queries against an Apache Drill cluster.
-| xref:reference/extensions/dropbox.adoc[Dropbox] | camel-quarkus-dropbox | [.camel-element-JVM]##JVM## +
-Preview | 1.1.0 | Upload, download and manage files, folders, groups, collaborations, etc on Dropbox.
+| xref:reference/extensions/dropbox.adoc[Dropbox] | camel-quarkus-dropbox | [.camel-element-Native]##Native## +
+Stable | 1.1.0 | Upload, download and manage files, folders, groups, collaborations, etc on Dropbox.
| xref:reference/extensions/ehcache.adoc[Ehcache] | camel-quarkus-ehcache | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Perform caching operations using Ehcache.
diff --git a/extensions-jvm/dropbox/integration-test/src/main/java/org/apache/camel/quarkus/component/dropbox/it/DropboxResource.java b/extensions-jvm/dropbox/integration-test/src/main/java/org/apache/camel/quarkus/component/dropbox/it/DropboxResource.java
deleted file mode 100644
index e0db93d..0000000
--- a/extensions-jvm/dropbox/integration-test/src/main/java/org/apache/camel/quarkus/component/dropbox/it/DropboxResource.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.component.dropbox.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
-
-@Path("/dropbox")
-@ApplicationScoped
-public class DropboxResource {
-
- private static final Logger LOG = Logger.getLogger(DropboxResource.class);
-
- private static final String COMPONENT_DROPBOX = "dropbox";
- @Inject
- CamelContext context;
-
- @Path("/load/component/dropbox")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response loadComponentDropbox() throws Exception {
- /* This is an autogenerated test */
- if (context.getComponent(COMPONENT_DROPBOX) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_DROPBOX);
- return Response.status(500, COMPONENT_DROPBOX + " could not be loaded from the Camel context").build();
- }
-}
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index ba8d5de..f8852af 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -64,7 +64,6 @@
<module>djl</module>
<module>dns</module>
<module>drill</module>
- <module>dropbox</module>
<module>ehcache</module>
<module>elsql</module>
<module>etcd</module>
diff --git a/extensions-jvm/dropbox/deployment/pom.xml b/extensions/dropbox/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/dropbox/deployment/pom.xml
rename to extensions/dropbox/deployment/pom.xml
diff --git a/extensions-jvm/dropbox/deployment/src/main/java/org/apache/camel/quarkus/component/dropbox/deployment/DropboxProcessor.java b/extensions/dropbox/deployment/src/main/java/org/apache/camel/quarkus/component/dropbox/deployment/DropboxProcessor.java
similarity index 58%
rename from extensions-jvm/dropbox/deployment/src/main/java/org/apache/camel/quarkus/component/dropbox/deployment/DropboxProcessor.java
rename to extensions/dropbox/deployment/src/main/java/org/apache/camel/quarkus/component/dropbox/deployment/DropboxProcessor.java
index 2a5a7b6..745ed30 100644
--- a/extensions-jvm/dropbox/deployment/src/main/java/org/apache/camel/quarkus/component/dropbox/deployment/DropboxProcessor.java
+++ b/extensions/dropbox/deployment/src/main/java/org/apache/camel/quarkus/component/dropbox/deployment/DropboxProcessor.java
@@ -17,16 +17,13 @@
package org.apache.camel.quarkus.component.dropbox.deployment;
import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
class DropboxProcessor {
- private static final Logger LOG = Logger.getLogger(DropboxProcessor.class);
private static final String FEATURE = "camel-dropbox";
@BuildStep
@@ -34,13 +31,19 @@ class DropboxProcessor {
return new FeatureBuildItem(FEATURE);
}
- /**
- * Remove this once this extension starts supporting the native mode.
- */
- @BuildStep(onlyIf = NativeBuild.class)
- @Record(value = ExecutionTime.RUNTIME_INIT)
- void warnJvmInNative(JvmOnlyRecorder recorder) {
- JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
- recorder.warnJvmInNative(FEATURE); // warn at runtime
+ @BuildStep
+ ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
+ return new ExtensionSslNativeSupportBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ RuntimeInitializedClassBuildItem runtimeInitializedClasses() {
+ return new RuntimeInitializedClassBuildItem("com.dropbox.core.http.SSLConfig");
+ }
+
+ @BuildStep
+ NativeImageResourceBuildItem nativeImageResources() {
+ // Required by com.dropbox.core.http.SSLConfig
+ return new NativeImageResourceBuildItem("com/dropbox/core/trusted-certs.raw", "com/dropbox/core/sdk-version.txt");
}
}
diff --git a/extensions-jvm/dropbox/pom.xml b/extensions/dropbox/pom.xml
similarity index 97%
rename from extensions-jvm/dropbox/pom.xml
rename to extensions/dropbox/pom.xml
index 20cf3b6..144a8d5 100644
--- a/extensions-jvm/dropbox/pom.xml
+++ b/extensions/dropbox/pom.xml
@@ -35,6 +35,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
- <module>integration-test</module>
</modules>
</project>
diff --git a/extensions-jvm/dropbox/runtime/pom.xml b/extensions/dropbox/runtime/pom.xml
similarity index 100%
rename from extensions-jvm/dropbox/runtime/pom.xml
rename to extensions/dropbox/runtime/pom.xml
diff --git a/extensions-jvm/dropbox/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/dropbox/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 97%
rename from extensions-jvm/dropbox/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/dropbox/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 86854d4..040c009 100644
--- a/extensions-jvm/dropbox/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ b/extensions/dropbox/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,9 +24,8 @@
name: "Camel Dropbox"
description: "Upload, download and manage files, folders, groups, collaborations, etc on Dropbox"
metadata:
- unlisted: true
guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/dropbox.html"
categories:
- "integration"
status:
- - "preview"
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index db5b167..9cb288c 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -88,6 +88,7 @@
<module>debezium-sqlserver</module>
<module>direct</module>
<module>dozer</module>
+ <module>dropbox</module>
<module>elasticsearch-rest</module>
<module>endpointdsl</module>
<module>exec</module>
diff --git a/integration-tests/dropbox/README.adoc b/integration-tests/dropbox/README.adoc
new file mode 100644
index 0000000..25cfaca
--- /dev/null
+++ b/integration-tests/dropbox/README.adoc
@@ -0,0 +1,12 @@
+== Camel Quarkus Dropbox Integration Tests
+
+To run the Dropbox integration tests, you need a valid Dropbox https://www.dropbox.com/developers[developer account]. Then from
+the developer console, create a new app and make a note of the access token.
+
+Then set the following environment variables. Note that `DROPBOX_CLIENT_IDENTIFIER` should be set to the name of your Dropbox app:
+
+[source,shell]
+----
+export DROPBOX_ACCESS_TOKEN=your-access-token
+export DROPBOX_CLIENT_IDENTIFIER=your-client-identifier
+----
diff --git a/extensions-jvm/dropbox/integration-test/pom.xml b/integration-tests/dropbox/pom.xml
similarity index 61%
rename from extensions-jvm/dropbox/integration-test/pom.xml
rename to integration-tests/dropbox/pom.xml
index eee158a..464f892 100644
--- a/extensions-jvm/dropbox/integration-test/pom.xml
+++ b/integration-tests/dropbox/pom.xml
@@ -23,25 +23,14 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
<version>1.1.0-SNAPSHOT</version>
- <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
</parent>
- <artifactId>camel-quarkus-dropbox-integration-test</artifactId>
- <name>Camel Quarkus :: Dropbox :: Integration Test</name>
+ <artifactId>camel-quarkus-integration-test-dropbox</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Dropbox</name>
<description>Integration tests for Camel Quarkus Dropbox extension</description>
- <properties>
- <!-- mvnd, a.k.a. Maven Daemon: https://github.com/mvndaemon/mvnd -->
- <!-- The following rule tells mvnd to build the listed deployment modules before this module. -->
- <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not -->
- <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
- <!-- Please update the rule whenever you change the dependencies of this module by running -->
- <!-- mvn process-resources -Pformat from the root directory -->
- <mvnd.builder.rule>camel-quarkus-dropbox-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
- </properties>
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -75,6 +64,21 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by runing `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dropbox-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
<build>
@@ -92,4 +96,34 @@
</plugin>
</plugins>
</build>
+
+ <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/dropbox/src/main/java/org/apache/camel/quarkus/component/dropbox/it/DropboxResource.java b/integration-tests/dropbox/src/main/java/org/apache/camel/quarkus/component/dropbox/it/DropboxResource.java
new file mode 100644
index 0000000..c2d504d
--- /dev/null
+++ b/integration-tests/dropbox/src/main/java/org/apache/camel/quarkus/component/dropbox/it/DropboxResource.java
@@ -0,0 +1,103 @@
+/*
+ * 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.dropbox.it;
+
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.dropbox.core.v2.files.DownloadErrorException;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+
+import static org.apache.camel.component.dropbox.util.DropboxConstants.HEADER_PUT_FILE_NAME;
+
+@Path("/dropbox")
+public class DropboxResource {
+
+ public static final String REMOTE_PATH = "/camel/quarkus/";
+ public static final String FILE_NAME = "test.txt";
+ public static final String FILE_CONTENT = "Hello Camel Quarkus DropBox";
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/create")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response createFile() throws Exception {
+ java.nio.file.Path path = Files.write(Paths.get("target", FILE_NAME), FILE_CONTENT.getBytes(StandardCharsets.UTF_8));
+ String result = producerTemplate.requestBodyAndHeader(
+ "dropbox://put?uploadMode=add&accessToken={{DROPBOX_ACCESS_TOKEN}}&clientIdentifier={{DROPBOX_CLIENT_IDENTIFIER}}&localPath="
+ + path.toString()
+ + "&remotePath=" + REMOTE_PATH,
+ null,
+ HEADER_PUT_FILE_NAME, FILE_NAME, String.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(result)
+ .build();
+ }
+
+ @Path("/read")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response readFile() {
+ try {
+ String content = producerTemplate.requestBody(
+ "dropbox://get?accessToken={{DROPBOX_ACCESS_TOKEN}}&clientIdentifier={{DROPBOX_CLIENT_IDENTIFIER}}&remotePath="
+ + REMOTE_PATH
+ + FILE_NAME,
+ null,
+ String.class);
+ if (content != null) {
+ return Response.ok(content).build();
+ } else {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ } catch (CamelExecutionException e) {
+ Exception exchangeException = e.getExchange().getException();
+ if (exchangeException != null && exchangeException.getCause() instanceof DownloadErrorException) {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ throw e;
+ }
+ }
+
+ @Path("/delete")
+ @DELETE
+ public Response deleteFile() {
+ producerTemplate
+ .requestBody(
+ "dropbox://del?accessToken={{DROPBOX_ACCESS_TOKEN}}&clientIdentifier={{DROPBOX_CLIENT_IDENTIFIER}}&remotePath="
+ + REMOTE_PATH + FILE_NAME,
+ (Object) null);
+ return Response.status(Response.Status.NO_CONTENT).build();
+ }
+}
diff --git a/extensions-jvm/dropbox/integration-test/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java b/integration-tests/dropbox/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxIT.java
similarity index 70%
copy from extensions-jvm/dropbox/integration-test/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
copy to integration-tests/dropbox/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxIT.java
index 802a3e6..cdc354e 100644
--- a/extensions-jvm/dropbox/integration-test/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
+++ b/integration-tests/dropbox/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxIT.java
@@ -16,19 +16,12 @@
*/
package org.apache.camel.quarkus.component.dropbox.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.NativeImageTest;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
-@QuarkusTest
-class DropboxTest {
-
- @Test
- public void loadComponentDropbox() {
- /* A simple autogenerated test */
- RestAssured.get("/dropbox/load/component/dropbox")
- .then()
- .statusCode(200);
- }
+@EnabledIfEnvironmentVariable(named = "DROPBOX_ACCESS_TOKEN", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "DROPBOX_CLIENT_IDENTIFIER", matches = ".+")
+@NativeImageTest
+class DropboxIT extends DropboxTest {
}
diff --git a/extensions-jvm/dropbox/integration-test/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java b/integration-tests/dropbox/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
similarity index 50%
rename from extensions-jvm/dropbox/integration-test/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
rename to integration-tests/dropbox/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
index 802a3e6..b9e4f5a 100644
--- a/extensions-jvm/dropbox/integration-test/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
+++ b/integration-tests/dropbox/src/test/java/org/apache/camel/quarkus/component/dropbox/it/DropboxTest.java
@@ -18,17 +18,43 @@ package org.apache.camel.quarkus.component.dropbox.it;
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;
+
+@EnabledIfEnvironmentVariable(named = "DROPBOX_ACCESS_TOKEN", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "DROPBOX_CLIENT_IDENTIFIER", matches = ".+")
@QuarkusTest
class DropboxTest {
@Test
- public void loadComponentDropbox() {
- /* A simple autogenerated test */
- RestAssured.get("/dropbox/load/component/dropbox")
+ public void testDropboxComponent() {
+ // Create
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .post("/dropbox/create")
.then()
- .statusCode(200);
- }
+ .statusCode(201);
+
+ // Read
+ RestAssured.given()
+ .get("/dropbox/read")
+ .then()
+ .statusCode(200)
+ .body(is(DropboxResource.FILE_CONTENT));
+ // Delete
+ RestAssured.given()
+ .delete("/dropbox/delete")
+ .then()
+ .statusCode(204);
+
+ // Verify deletion
+ RestAssured.given()
+ .get("/dropbox/read")
+ .then()
+ .statusCode(404);
+ }
}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index fa41cd9..f55637b 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -81,6 +81,7 @@
<module>dataformats-json</module>
<module>debezium</module>
<module>dozer</module>
+ <module>dropbox</module>
<module>elasticsearch-rest</module>
<module>exec</module>
<module>fhir</module>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 0665ab8..b07a6b1 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -70,6 +70,7 @@ xml-json-olingo4:
- rest-binding-mode-xml
- xml
- dataformats-json
+ - dropbox
- olingo4
dozer-ispn-social:
- dozer