You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/02/17 15:51:29 UTC
[camel-quarkus] branch master updated: Resolves #162 adds camel-box
support
This is an automated email from the ASF dual-hosted git repository.
acosentino 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 5f82c11 Resolves #162 adds camel-box support
new f64b94c Merge pull request #722 from johnpoth/camel-box
5f82c11 is described below
commit 5f82c11f00278d6f744484afd8c84a8f343087f1
Author: John Poth <po...@gmail.com>
AuthorDate: Tue Feb 4 16:52:19 2020 +0100
Resolves #162 adds camel-box support
---
.github/workflows/pr-build.yaml | 1 +
.../pages/list-of-camel-quarkus-extensions.adoc | 5 +-
extensions/box/deployment/pom.xml | 81 +++++++++++++
.../component/box/deployment/BoxProcessor.java | 100 ++++++++++++++++
extensions/box/pom.xml | 39 +++++++
extensions/box/runtime/pom.xml | 82 +++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 27 +++++
extensions/pom.xml | 1 +
extensions/readme.adoc | 5 +-
integration-tests/box/README.adoc | 17 +++
integration-tests/box/pom.xml | 129 +++++++++++++++++++++
.../quarkus/component/box/it/BoxResource.java | 100 ++++++++++++++++
.../quarkus/component/box/it/BoxRouteBuilder.java | 41 +++++++
.../box/src/main/resources/application.properties | 35 ++++++
.../camel/quarkus/component/box/it/BoxIT.java | 29 +++++
.../camel/quarkus/component/box/it/BoxTest.java | 55 +++++++++
integration-tests/pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
19 files changed, 761 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml
index c9fd9ed..50e96ee 100644
--- a/.github/workflows/pr-build.yaml
+++ b/.github/workflows/pr-build.yaml
@@ -409,6 +409,7 @@ jobs:
-Dnative \
-Ddocker \
-DskipTests \
+ -pl :camel-quarkus-integration-test-box \
-pl :camel-quarkus-integration-test-salesforce \
-pl :camel-quarkus-integration-test-slack \
-pl :camel-quarkus-integration-test-twitter
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 b884fda..c88fe48 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: 64 in 55 JAR artifacts (0 deprecated)
+Number of Camel components: 65 in 56 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -72,6 +72,9 @@ Number of Camel components: 64 in 55 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/bean-validator-component.html[Bean Validator] (camel-quarkus-bean-validator) +
`bean-validator:label` | 1.0.0-M1 | The Validator component performs bean validation of the message body using the Java Bean Validation API.
+| link:https://camel.apache.org/components/latest/box-component.html[Box] (camel-quarkus-box) +
+`box:apiName/methodName` | 1.2.0 | For uploading downloading and managing files folders groups collaborations etc on box DOT com.
+
| link:https://camel.apache.org/components/latest/class-component.html[Class] (camel-quarkus-bean) +
`class:beanName` | 0.2.0 | The class component is for invoking Java classes (Java beans) from Camel.
diff --git a/extensions/box/deployment/pom.xml b/extensions/box/deployment/pom.xml
new file mode 100644
index 0000000..b5f5af6
--- /dev/null
+++ b/extensions/box/deployment/pom.xml
@@ -0,0 +1,81 @@
+<?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-box-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-box-deployment</artifactId>
+ <name>Camel Quarkus :: Box :: 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>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jsoup</groupId>
+ <artifactId>jsoup</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-box</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/box/deployment/src/main/java/org/apache/camel/quarkus/component/box/deployment/BoxProcessor.java b/extensions/box/deployment/src/main/java/org/apache/camel/quarkus/component/box/deployment/BoxProcessor.java
new file mode 100644
index 0000000..f8f21cf
--- /dev/null
+++ b/extensions/box/deployment/src/main/java/org/apache/camel/quarkus/component/box/deployment/BoxProcessor.java
@@ -0,0 +1,100 @@
+/*
+ * 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.box.deployment;
+
+import com.box.sdk.BoxAPIRequest;
+import com.box.sdk.BoxDeveloperEditionAPIConnection;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
+import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.camel.component.box.BoxCollaborationsManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxCommentsManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxConfiguration;
+import org.apache.camel.component.box.BoxEventLogsManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxEventsManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxFilesManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxFoldersManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxGroupsManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxSearchManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxTasksManagerEndpointConfiguration;
+import org.apache.camel.component.box.BoxUsersManagerEndpointConfiguration;
+import org.apache.camel.quarkus.core.deployment.UnbannedReflectiveBuildItem;
+
+class BoxProcessor {
+
+ private static final String FEATURE = "camel-box";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
+ return new ExtensionSslNativeSupportBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ AdditionalApplicationArchiveMarkerBuildItem boxArchiveMarker() {
+ return new AdditionalApplicationArchiveMarkerBuildItem("com/box/sdk");
+ }
+
+ @BuildStep
+ void configure(BuildProducer<RuntimeInitializedClassBuildItem> runtimeClasses) {
+ // Avoid use of sun.security.provider.NativePRNG at image runtime
+ runtimeClasses.produce(new RuntimeInitializedClassBuildItem(BoxDeveloperEditionAPIConnection.class.getCanonicalName()));
+ runtimeClasses.produce(new RuntimeInitializedClassBuildItem(BoxAPIRequest.class.getCanonicalName()));
+ }
+
+ @BuildStep()
+ UnbannedReflectiveBuildItem boxEndpointConfigurations() {
+ return new UnbannedReflectiveBuildItem(
+ BoxCollaborationsManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxCommentsManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxEventLogsManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxEventsManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxFilesManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxFoldersManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxGroupsManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxSearchManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxTasksManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxUsersManagerEndpointConfiguration.class.getCanonicalName(),
+ BoxConfiguration.class.getCanonicalName());
+ }
+
+ @BuildStep()
+ ReflectiveClassBuildItem boxEndpointConfiguration() {
+ return new ReflectiveClassBuildItem(true, true,
+ BoxCollaborationsManagerEndpointConfiguration.class,
+ BoxCommentsManagerEndpointConfiguration.class,
+ BoxEventLogsManagerEndpointConfiguration.class,
+ BoxEventsManagerEndpointConfiguration.class,
+ BoxFilesManagerEndpointConfiguration.class,
+ BoxFoldersManagerEndpointConfiguration.class,
+ BoxGroupsManagerEndpointConfiguration.class,
+ BoxSearchManagerEndpointConfiguration.class,
+ BoxTasksManagerEndpointConfiguration.class,
+ BoxUsersManagerEndpointConfiguration.class,
+ BoxConfiguration.class);
+ }
+
+}
diff --git a/extensions/box/pom.xml b/extensions/box/pom.xml
new file mode 100644
index 0000000..8eca69f
--- /dev/null
+++ b/extensions/box/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-box-parent</artifactId>
+ <name>Camel Quarkus :: Box</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/box/runtime/pom.xml b/extensions/box/runtime/pom.xml
new file mode 100644
index 0000000..ace3e75
--- /dev/null
+++ b/extensions/box/runtime/pom.xml
@@ -0,0 +1,82 @@
+<?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-box-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-box</artifactId>
+ <name>Camel Quarkus :: Box :: Runtime</name>
+
+ <properties>
+ <firstVersion>1.2.0</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</groupId>
+ <artifactId>camel-box</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/box/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/box/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..f2b3659
--- /dev/null
+++ b/extensions/box/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+---
+name: "Camel Quarkus Box"
+description: "Camel Box support"
+metadata:
+ keywords:
+ - "camel"
+ - "box"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 2ece525..19fb5be 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -61,6 +61,7 @@
<module>bean</module>
<module>bean-validator</module>
<module>bindy</module>
+ <module>box</module>
<module>consul</module>
<module>controlbus</module>
<module>csv</module>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index ef64f14..43c33e5 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension
== Camel Components
// components: START
-Number of Camel components: 64 in 55 JAR artifacts (0 deprecated)
+Number of Camel components: 65 in 56 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -59,6 +59,9 @@ Number of Camel components: 64 in 55 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/bean-validator-component.html[Bean Validator] (camel-quarkus-bean-validator) +
`bean-validator:label` | 1.0.0-M1 | The Validator component performs bean validation of the message body using the Java Bean Validation API.
+| link:https://camel.apache.org/components/latest/box-component.html[Box] (camel-quarkus-box) +
+`box:apiName/methodName` | 1.2.0 | For uploading downloading and managing files folders groups collaborations etc on box DOT com.
+
| link:https://camel.apache.org/components/latest/class-component.html[Class] (camel-quarkus-bean) +
`class:beanName` | 0.2.0 | The class component is for invoking Java classes (Java beans) from Camel.
diff --git a/integration-tests/box/README.adoc b/integration-tests/box/README.adoc
new file mode 100644
index 0000000..40dcdaa
--- /dev/null
+++ b/integration-tests/box/README.adoc
@@ -0,0 +1,17 @@
+== Camel Quarkus Box Integration Tests
+
+To run the `camel-quarkus-box` integration tests, you must first create a Box developer account https://account.box.com/login.
+
+Then set the following environment variables:
+
+[source,shell]
+----
+export BOX_USER_NAME=my-user-name
+export BOX_USER_PASSWORD=my-user-password
+export BOX_CLIENT_ID=my-client-id
+export BOX_CLIENT_SECRET=my-client_secret
+----
+
+Enjoy!
+
+
diff --git a/integration-tests/box/pom.xml b/integration-tests/box/pom.xml
new file mode 100644
index 0000000..ecb9472
--- /dev/null
+++ b/integration-tests/box/pom.xml
@@ -0,0 +1,129 @@
+<?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.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-box</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Box</name>
+ <description>Integration tests for Camel Quarkus Box extension</description>
+
+ <properties>
+ <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/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 rule whenever you change the dependencies of this module by running -->
+ <!-- mvn process-resources -Pformat from the root directory -->
+ <mvnd.builder.rule>camel-quarkus-direct-deployment,camel-quarkus-box-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-box</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jsoup</groupId>
+ <artifactId>jsoup</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ <quarkus.native.additional-build-args>-Dio.netty.noUnsafe=true</quarkus.native.additional-build-args>
+ </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>
+ <configuration>
+ <systemProperties>
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/box/src/main/java/org/apache/camel/quarkus/component/box/it/BoxResource.java b/integration-tests/box/src/main/java/org/apache/camel/quarkus/component/box/it/BoxResource.java
new file mode 100644
index 0000000..4df6763
--- /dev/null
+++ b/integration-tests/box/src/main/java/org/apache/camel/quarkus/component/box/it/BoxResource.java
@@ -0,0 +1,100 @@
+/*
+ * 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.box.it;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.box.sdk.BoxFile;
+import org.apache.camel.ProducerTemplate;
+import org.jboss.logging.Logger;
+
+@Path("/box")
+@ApplicationScoped
+public class BoxResource {
+
+ private static final Logger LOG = Logger.getLogger(BoxResource.class);
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/uploadFile/{parentFolder}/{name}")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response uploadFile(String content, @PathParam("parentFolder") String parentFolder, @PathParam("name") String name)
+ throws Exception {
+ LOG.infof("Uploading file to box: %s under the root folder with name %s", content, name);
+ final Map<String, Object> headers = new HashMap<>();
+ headers.put("CamelBox.parentFolderId", parentFolder);
+ headers.put("CamelBox.content", new ByteArrayInputStream(content.getBytes()));
+ headers.put("CamelBox.fileName", name);
+ final BoxFile response = producerTemplate.requestBodyAndHeaders("direct:upload-file", null, headers, BoxFile.class);
+ LOG.infof("Got response from box: %s", response);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response.getID())
+ .build();
+ }
+
+ @Path("/downloadFile")
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response downloadFile(String fileId) throws Exception {
+ LOG.infof("Downloading from box: %s", fileId);
+ final Map<String, Object> headers = new HashMap<>();
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ headers.put("CamelBox.output", output);
+ producerTemplate.requestBodyAndHeaders("direct:download-file", fileId, headers, OutputStream.class);
+ String response = output.toString();
+ LOG.infof("Got response from box: %s", response);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response)
+ .build();
+ }
+
+ @Path("/deleteFile")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deleteFile(String fileId) throws Exception {
+ LOG.infof("Deleting file from Box with id: %s", fileId);
+ final String response = producerTemplate.requestBody("direct:delete-file", fileId, String.class);
+ LOG.infof("Got response from box: %s", response);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response)
+ .build();
+ }
+}
diff --git a/integration-tests/box/src/main/java/org/apache/camel/quarkus/component/box/it/BoxRouteBuilder.java b/integration-tests/box/src/main/java/org/apache/camel/quarkus/component/box/it/BoxRouteBuilder.java
new file mode 100644
index 0000000..a73265c
--- /dev/null
+++ b/integration-tests/box/src/main/java/org/apache/camel/quarkus/component/box/it/BoxRouteBuilder.java
@@ -0,0 +1,41 @@
+/*
+ * 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.box.it;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.box.internal.BoxApiCollection;
+import org.apache.camel.component.box.internal.BoxFilesManagerApiMethod;
+
+public class BoxRouteBuilder extends RouteBuilder {
+
+ private static final String PATH_PREFIX = BoxApiCollection.getCollection()
+ .getApiName(BoxFilesManagerApiMethod.class).getName();
+
+ @Override
+ public void configure() {
+
+ from("direct:upload-file")
+ .to("box://" + PATH_PREFIX + "/uploadFile?check=true");
+
+ from("direct:download-file")
+ .to("box://" + PATH_PREFIX + "/downloadFile?inBody=fileId");
+
+ from("direct:delete-file")
+ .to("box://" + PATH_PREFIX + "/deleteFile?inBody=fileId");
+
+ }
+}
diff --git a/integration-tests/box/src/main/resources/application.properties b/integration-tests/box/src/main/resources/application.properties
new file mode 100644
index 0000000..4b873f3
--- /dev/null
+++ b/integration-tests/box/src/main/resources/application.properties
@@ -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.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.ssl.native=true
+
+#
+# Camel :: Box
+#
+
+#############################################################################
+## Authentication properties for Box Component using STANDARD_AUTHENTICATION
+#############################################################################
+
+camel.component.box.configuration = #class:org.apache.camel.component.box.BoxConfiguration
+camel.component.box.configuration.authenticationType = STANDARD_AUTHENTICATION
+camel.component.box.configuration.userName = {{env:BOX_USER_NAME}}
+camel.component.box.configuration.userPassword = {{env:BOX_USER_PASSWORD}}
+camel.component.box.configuration.clientId = {{env:BOX_CLIENT_ID}}
+camel.component.box.configuration.clientSecret = {{env:BOX_CLIENT_SECRET}}
diff --git a/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/BoxIT.java b/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/BoxIT.java
new file mode 100644
index 0000000..47947d4
--- /dev/null
+++ b/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/BoxIT.java
@@ -0,0 +1,29 @@
+/*
+ * 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.box.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@EnabledIfEnvironmentVariable(named = "BOX_USER_NAME", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "BOX_USER_PASSWORD", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "BOX_CLIENT_ID", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "BOX_CLIENT_SECRET", matches = ".+")
+@NativeImageTest
+class BoxIT extends BoxTest {
+
+}
diff --git a/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/BoxTest.java b/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/BoxTest.java
new file mode 100644
index 0000000..ee04cca
--- /dev/null
+++ b/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/BoxTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.box.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@EnabledIfEnvironmentVariable(named = "BOX_USER_NAME", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "BOX_USER_PASSWORD", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "BOX_CLIENT_ID", matches = ".+")
+@EnabledIfEnvironmentVariable(named = "BOX_CLIENT_SECRET", matches = ".+")
+@QuarkusTest
+class BoxTest {
+
+ @Test
+ public void testUploadDownloadDeleteFile() {
+ String fileName = "CamelQuarkusTestFile_Upload.txt";
+ String content = "This is the CamelQuarkusTestFile.";
+
+ // upload
+ final String fileId = RestAssured.given() //
+ .contentType(ContentType.TEXT).body(content).post("/box/uploadFile/0/" + fileName) //
+ .then().statusCode(201).extract().body().asString();
+
+ // download
+ final String fileContent = RestAssured.given() //
+ .contentType(ContentType.TEXT).body(fileId).get("/box/downloadFile") //
+ .then().statusCode(201).extract().body().asString();
+
+ Assertions.assertEquals(content, fileContent, "File contents do not match!");
+
+ // delete
+ RestAssured.given() //
+ .contentType(ContentType.TEXT).body(fileId).post("/box/deleteFile") //
+ .then().statusCode(201);
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 0fba9c4..6a9aa99 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -174,6 +174,7 @@
<module>bean</module>
<module>bean-validator</module>
<module>bindy</module>
+ <module>box</module>
<module>consul</module>
<module>controlbus</module>
<module>csv</module>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index f9b32c5..c2650f7 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -156,6 +156,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-box-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-consul-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 01ae072..aafc95a 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -168,6 +168,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-box</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-caffeine-lrucache</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -632,6 +637,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-box</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-consul</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>