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 2014/09/08 15:57:38 UTC
[01/21] CAMEL-7580 - Initial cut of google drive component
Repository: camel
Updated Branches:
refs/heads/master b80b11903 -> 58a9ffb4a
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
new file mode 100644
index 0000000..e6ae4d5
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
@@ -0,0 +1,155 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DrivePropertiesApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Properties APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DrivePropertiesIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DrivePropertiesIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DrivePropertiesApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.propertyKey", null);
+
+ final com.google.api.services.drive.Drive.Properties.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.propertyKey", null);
+
+ final com.google.api.services.drive.Drive.Properties.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.Property
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Properties.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Properties.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for patch
+ @Ignore
+ @Test
+ public void testPatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.propertyKey", null);
+ // parameter type is com.google.api.services.drive.model.Property
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Properties.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+
+ assertNotNull("patch result", result);
+ LOG.debug("patch: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.propertyKey", null);
+ // parameter type is com.google.api.services.drive.model.Property
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Properties.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=fileId");
+
+ // test route for patch
+ from("direct://PATCH")
+ .to("google-drive://" + PATH_PREFIX + "/patch");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java
new file mode 100644
index 0000000..d991aad
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java
@@ -0,0 +1,86 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveRealtimeApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Realtime APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveRealtimeIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveRealtimeIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRealtimeApiMethod.class).getName();
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Realtime.Get result = requestBody("direct://GET", null);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Realtime.Update result = requestBody("direct://UPDATE", null);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate_1() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.client.http.AbstractInputStreamContent
+ headers.put("CamelGoogleDrive.mediaContent", null);
+
+ final com.google.api.services.drive.Drive.Realtime.Update result = requestBodyAndHeaders("direct://UPDATE_1", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get?inBody=fileId");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update?inBody=fileId");
+
+ // test route for update
+ from("direct://UPDATE_1")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
new file mode 100644
index 0000000..4abab0c
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
@@ -0,0 +1,170 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveRepliesApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Replies APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveRepliesIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveRepliesIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRepliesApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.replyId", null);
+
+ final com.google.api.services.drive.Drive.Replies.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.replyId", null);
+
+ final com.google.api.services.drive.Drive.Replies.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is com.google.api.services.drive.model.CommentReply
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Replies.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+
+ final com.google.api.services.drive.Drive.Replies.List result = requestBodyAndHeaders("direct://LIST", null, headers);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for patch
+ @Ignore
+ @Test
+ public void testPatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.replyId", null);
+ // parameter type is com.google.api.services.drive.model.CommentReply
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Replies.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+
+ assertNotNull("patch result", result);
+ LOG.debug("patch: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.replyId", null);
+ // parameter type is com.google.api.services.drive.model.CommentReply
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Replies.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list");
+
+ // test route for patch
+ from("direct://PATCH")
+ .to("google-drive://" + PATH_PREFIX + "/patch");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
new file mode 100644
index 0000000..ec674c5
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
@@ -0,0 +1,135 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveRevisionsApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Revisions APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveRevisionsIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveRevisionsIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRevisionsApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.revisionId", null);
+
+ final com.google.api.services.drive.Drive.Revisions.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.revisionId", null);
+
+ final com.google.api.services.drive.Drive.Revisions.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Revisions.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for patch
+ @Ignore
+ @Test
+ public void testPatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.revisionId", null);
+ // parameter type is com.google.api.services.drive.model.Revision
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Revisions.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+
+ assertNotNull("patch result", result);
+ LOG.debug("patch: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.revisionId", null);
+ // parameter type is com.google.api.services.drive.model.Revision
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Revisions.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=fileId");
+
+ // test route for patch
+ from("direct://PATCH")
+ .to("google-drive://" + PATH_PREFIX + "/patch");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/resources/log4j.properties b/components/camel-google-drive/src/test/resources/log4j.properties
new file mode 100644
index 0000000..3b1bd38
--- /dev/null
+++ b/components/camel-google-drive/src/test/resources/log4j.properties
@@ -0,0 +1,14 @@
+#
+# The logging properties used
+#
+log4j.rootLogger=INFO, out
+
+# uncomment the following line to turn on Camel debugging
+#log4j.logger.org.apache.camel=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
[17/21] git commit: Ensure application name is set on drive client
Posted by ja...@apache.org.
Ensure application name is set on drive client
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c502e15b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c502e15b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c502e15b
Branch: refs/heads/master
Commit: c502e15bc22af1e3a260008c5ade930a2b33953b
Parents: 1acfe6e
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Fri Sep 5 00:26:01 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:10 2014 -0230
----------------------------------------------------------------------
.../drive/DefaultGoogleDriveClientFactory.java | 4 ++--
.../google/drive/GoogleDriveClientFactory.java | 18 +++++++++++++++++-
.../google/drive/GoogleDriveEndpoint.java | 2 +-
.../google/drive/DriveAppsIntegrationTest.java | 12 +-----------
.../google/drive/DriveRepliesIntegrationTest.java | 3 ---
5 files changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c502e15b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
index 5ad6b17..876ef86 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
@@ -47,11 +47,11 @@ public class DefaultGoogleDriveClientFactory implements GoogleDriveClientFactory
* (java.lang.String, java.lang.String, java.util.Collection)
*/
@Override
- public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes) {
+ public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName) {
Credential credential;
try {
credential = authorize(clientId, clientSecret, scopes);
- return new Drive.Builder(transport, jsonFactory, credential).build();
+ return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/camel/blob/c502e15b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
index 669c253..b183279 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive;
import java.util.Collection;
@@ -6,6 +22,6 @@ import com.google.api.services.drive.Drive;
public interface GoogleDriveClientFactory {
- public abstract Drive makeClient(String clientId, String clientSecret, Collection<String> scopes);
+ public abstract Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c502e15b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index 0d22219..2406493 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -114,7 +114,7 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
private Drive getClient() {
if (client == null) {
- client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES);
+ client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES, configuration.getApplicationName());
}
return client;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c502e15b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
index 015dc79..210c51a 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
@@ -33,18 +33,8 @@ public class DriveAppsIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DriveAppsIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveAppsApiMethod.class).getName();
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- // using String message body for single parameter "appId"
- final com.google.api.services.drive.Drive.Apps.Get result = requestBody("direct://GET", null);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
// TODO getting permission errors for this one
+ // May have to adjust scopes used
@Ignore
@Test
public void testList() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/c502e15b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
index 26c526f..76cee35 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,8 +32,6 @@ import com.google.api.services.drive.model.File;
/**
* Test class for com.google.api.services.drive.Drive$Replies APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveRepliesIntegrationTest extends AbstractGoogleDriveTestSupport {
[05/21] git commit: use canonical names of inner classes when
generating source
Posted by ja...@apache.org.
use canonical names of inner classes when generating source
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a4b235ca
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a4b235ca
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a4b235ca
Branch: refs/heads/master
Commit: a4b235ca34466f62b842a893200c30cd8eec5346
Parents: b13c88f
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Jul 3 15:22:00 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:08 2014 -0230
----------------------------------------------------------------------
.../org/apache/camel/maven/ApiComponentGeneratorMojo.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a4b235ca/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
index 07532f8..3008be8 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
@@ -230,11 +230,17 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
}
public static String getApiMethod(String proxyClass) {
- return proxyClass.substring(proxyClass.lastIndexOf('.') + 1) + "ApiMethod";
+ String proxyClassWithCanonicalName = getProxyClassWithCanonicalName(proxyClass);
+ return proxyClassWithCanonicalName.substring(proxyClassWithCanonicalName.lastIndexOf('.') + 1) + "ApiMethod";
}
public static String getEndpointConfig(String proxyClass) {
- return proxyClass.substring(proxyClass.lastIndexOf('.') + 1) + "EndpointConfiguration";
+ String proxyClassWithCanonicalName = getProxyClassWithCanonicalName(proxyClass);
+ return proxyClassWithCanonicalName.substring(proxyClassWithCanonicalName.lastIndexOf('.') + 1) + "EndpointConfiguration";
+ }
+
+ private static String getProxyClassWithCanonicalName(String proxyClass) {
+ return proxyClass.replace("$", "");
}
public static String getEnumConstant(String enumValue) {
[14/21] git commit: Get some more tests working
Posted by ja...@apache.org.
Get some more tests working
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1acfe6e7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1acfe6e7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1acfe6e7
Branch: refs/heads/master
Commit: 1acfe6e75143fa66320db1fd2159f7a4fd008b94
Parents: af61f09
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Fri Sep 5 00:20:04 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:10 2014 -0230
----------------------------------------------------------------------
.../google/drive/GoogleDriveEndpoint.java | 2 +-
.../drive/AbstractGoogleDriveTestSupport.java | 22 +++
.../google/drive/DriveAppsIntegrationTest.java | 1 +
.../drive/DriveChangesIntegrationTest.java | 37 ++---
.../drive/DriveCommentsIntegrationTest.java | 144 ++++++-----------
.../google/drive/DriveFilesIntegrationTest.java | 30 +---
.../drive/DrivePermissionsIntegrationTest.java | 117 ++------------
.../drive/DrivePropertiesIntegrationTest.java | 104 ++-----------
.../drive/DriveRepliesIntegrationTest.java | 156 +++++++------------
.../drive/DriveRevisionsIntegrationTest.java | 87 ++---------
10 files changed, 180 insertions(+), 520 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index e2b5dfa..0d22219 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -114,7 +114,7 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
private Drive getClient() {
if (client == null) {
- getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES);
+ client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES);
}
return client;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
index 1626e99..17b8ee1 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
@@ -31,6 +31,9 @@ import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.IntrospectionSupport;
import org.junit.AfterClass;
+import com.google.api.client.http.FileContent;
+import com.google.api.services.drive.model.File;
+
public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
protected static final String CAMEL_TEST_TAG = "camel_was_here";
@@ -46,6 +49,25 @@ public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
protected static String testFolderId;
protected static String testFileId;
+ protected static final String TEST_UPLOAD_FILE = "src/test/resources/log4j.properties";
+ protected static final String TEST_UPLOAD_IMG = "src/test/resources/camel-box-small.png";
+ protected static final java.io.File UPLOAD_FILE = new java.io.File(TEST_UPLOAD_FILE);
+
+ protected File uploadTestFile() {
+ File fileMetadata = new File();
+ fileMetadata.setTitle(UPLOAD_FILE.getName());
+ FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
+
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", fileMetadata);
+ // parameter type is com.google.api.client.http.AbstractInputStreamContent
+ headers.put("CamelGoogleDrive.mediaContent", mediaContent);
+
+ File result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
+ return result;
+ }
+
@Override
protected CamelContext createCamelContext() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
index a1afd8a..015dc79 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
@@ -45,6 +45,7 @@ public class DriveAppsIntegrationTest extends AbstractGoogleDriveTestSupport {
}
// TODO getting permission errors for this one
+ @Ignore
@Test
public void testList() throws Exception {
final com.google.api.services.drive.model.App result = requestBody("direct://LIST", null);
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
index c41b84f..befa14c 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
@@ -16,18 +16,17 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DriveChangesApiMethod;
+import com.google.api.services.drive.model.Change;
+
/**
* Test class for com.google.api.services.drive.Drive$Changes APIs.
*/
@@ -36,15 +35,20 @@ public class DriveChangesIntegrationTest extends AbstractGoogleDriveTestSupport
private static final Logger LOG = LoggerFactory.getLogger(DriveChangesIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChangesApiMethod.class).getName();
- // TODO provide parameter values for get
- @Ignore
@Test
public void testGet() throws Exception {
- // using String message body for single parameter "changeId"
- final com.google.api.services.drive.Drive.Changes.Get result = requestBody("direct://GET", null);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
+ final com.google.api.services.drive.model.ChangeList list = requestBody("direct://LIST", null);
+ List<Change> items = list.getItems();
+ if (!items.isEmpty()) {
+ Change change = items.get(0);
+ Long id = change.getId();
+
+ // using String message body for single parameter "changeId"
+ final com.google.api.services.drive.model.Change result = requestBody("direct://GET", id);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
}
@Test
@@ -55,17 +59,6 @@ public class DriveChangesIntegrationTest extends AbstractGoogleDriveTestSupport
LOG.debug("list: " + result);
}
- // TODO provide parameter values for watch
- @Ignore
- @Test
- public void testWatch() throws Exception {
- // using com.google.api.services.drive.model.Channel message body for single parameter "contentChannel"
- final com.google.api.services.drive.Drive.Changes.Watch result = requestBody("direct://WATCH", null);
-
- assertNotNull("watch result", result);
- LOG.debug("watch: " + result);
- }
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
index 0ebd0f8..f2b0c34 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,131 +27,78 @@ import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DriveCommentsApiMethod;
-import com.google.api.client.http.FileContent;
+import com.google.api.services.drive.model.Comment;
import com.google.api.services.drive.model.File;
/**
* Test class for com.google.api.services.drive.Drive$Comments APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveCommentsIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DriveCommentsIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveCommentsApiMethod.class).getName();
- private static final String TEST_UPLOAD_FILE = "src/test/resources/log4j.properties";
- private static final String TEST_UPLOAD_IMG = "src/test/resources/camel-box-small.png";
- private static final java.io.File UPLOAD_FILE = new java.io.File(TEST_UPLOAD_FILE);
- // TODO provide parameter values for delete
- @Ignore
@Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ public void testComment() throws Exception {
+ // 1. create test file
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
+ // 2. comment on that file
+ Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
+ headers.put("CamelGoogleDrive.fileId", fileId);
+ // parameter type is com.google.api.services.drive.model.Comment
+ com.google.api.services.drive.model.Comment comment = new com.google.api.services.drive.model.Comment();
+ comment.setContent("Camel rocks!");
+ headers.put("CamelGoogleDrive.content", comment);
- final com.google.api.services.drive.Drive.Comments.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+ requestBodyAndHeaders("direct://INSERT", null, headers);
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
+ // 3. get a list of comments on the file
+ // using String message body for single parameter "fileId"
+ com.google.api.services.drive.model.CommentList result1 = requestBody("direct://LIST", fileId);
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ assertNotNull(result1.get("items"));
+ LOG.debug("list: " + result1);
+
+ Comment comment2 = result1.getItems().get(0);
+
+ // 4. now try and get that comment
+ headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
-
- final com.google.api.services.drive.Drive.Comments.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for insert
- @Ignore
- @Test
- public void testInsert() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelGoogleDrive.fileId", fileId);
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is com.google.api.services.drive.model.Comment
- headers.put("CamelGoogleDrive.content", null);
+ headers.put("CamelGoogleDrive.commentId", comment2.getCommentId());
- final com.google.api.services.drive.Drive.Comments.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
-
- assertNotNull("insert result", result);
- LOG.debug("insert: " + result);
- }
+ final com.google.api.services.drive.model.Comment result3 = requestBodyAndHeaders("direct://GET", null, headers);
- private File uploadTestFile() {
- File fileMetadata = new File();
- fileMetadata.setTitle(UPLOAD_FILE.getName());
- FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
+ assertNotNull("get result", result3);
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is com.google.api.services.drive.model.File
- headers.put("CamelGoogleDrive.content", fileMetadata);
- // parameter type is com.google.api.client.http.AbstractInputStreamContent
- headers.put("CamelGoogleDrive.mediaContent", mediaContent);
-
- File result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
- return result;
- }
-
- @Test
- public void testList() throws Exception {
- File testFile = uploadTestFile();
- String fileId = testFile.getId();
+ // 5. delete the comment
- // using String message body for single parameter "fileId"
- final com.google.api.services.drive.model.CommentList result = requestBody("direct://LIST", fileId);
-
- assertNotNull("list result", result);
- LOG.debug("list: " + result);
- }
-
- // TODO provide parameter values for patch
- @Ignore
- @Test
- public void testPatch() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
+ headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ headers.put("CamelGoogleDrive.fileId", fileId);
// parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
- // parameter type is com.google.api.services.drive.model.Comment
- headers.put("CamelGoogleDrive.content", null);
+ headers.put("CamelGoogleDrive.commentId", comment2.getCommentId());
- final com.google.api.services.drive.Drive.Comments.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+ requestBodyAndHeaders("direct://DELETE", null, headers);
- assertNotNull("patch result", result);
- LOG.debug("patch: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
+ // 6. ensure the comment is gone
+
+ headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ headers.put("CamelGoogleDrive.fileId", fileId);
// parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
- // parameter type is com.google.api.services.drive.model.Comment
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Comments.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
+ headers.put("CamelGoogleDrive.commentId", comment2.getCommentId());
+
+ try {
+ final com.google.api.services.drive.model.Comment result4 = requestBodyAndHeaders("direct://GET", null, headers);
+ assertTrue("Should have thrown an exception.", false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
index 039ea64..bf5c216 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
@@ -39,9 +39,6 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DriveFilesIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
- private static final String TEST_UPLOAD_FILE = "src/test/resources/log4j.properties";
- private static final String TEST_UPLOAD_IMG = "src/test/resources/camel-box-small.png";
- private static final java.io.File UPLOAD_FILE = new java.io.File(TEST_UPLOAD_FILE);
@Test
public void testCopy() throws Exception {
@@ -64,7 +61,7 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
LOG.debug("copy: " + result);
}
- @Test
+ @Test
public void testDelete() throws Exception {
File testFile = uploadTestFile();
String fileId = testFile.getId();
@@ -72,9 +69,13 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
// using String message body for single parameter "fileId"
sendBody("direct://DELETE", fileId);
- // the file should be gone now
- final File result = requestBody("direct://GET", fileId);
- assertNull("get result", result);
+ try {
+ // the file should be gone now
+ final File result = requestBody("direct://GET", fileId);
+ assertTrue("Should have not found deleted file.", false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
@Test
@@ -99,21 +100,6 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
LOG.debug("insert: " + result);
}
- private File uploadTestFile() {
- File fileMetadata = new File();
- fileMetadata.setTitle(UPLOAD_FILE.getName());
- FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
-
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is com.google.api.services.drive.model.File
- headers.put("CamelGoogleDrive.content", fileMetadata);
- // parameter type is com.google.api.client.http.AbstractInputStreamContent
- headers.put("CamelGoogleDrive.mediaContent", mediaContent);
-
- File result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
- return result;
- }
-
@Test
public void testInsert_1() throws Exception {
File result = uploadTestFile();
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
index cc1068d..0d08ace 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
@@ -16,134 +16,35 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DrivePermissionsApiMethod;
+import com.google.api.services.drive.model.File;
+
/**
* Test class for com.google.api.services.drive.Drive$Permissions APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DrivePermissionsIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DrivePermissionsIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DrivePermissionsApiMethod.class).getName();
-
- // TODO provide parameter values for delete
- @Ignore
- @Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.permissionId", null);
-
- final com.google.api.services.drive.Drive.Permissions.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
-
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.permissionId", null);
-
- final com.google.api.services.drive.Drive.Permissions.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for getIdForEmail
- @Ignore
- @Test
- public void testGetIdForEmail() throws Exception {
- // using String message body for single parameter "email"
- final com.google.api.services.drive.Drive.Permissions.GetIdForEmail result = requestBody("direct://GETIDFOREMAIL", null);
-
- assertNotNull("getIdForEmail result", result);
- LOG.debug("getIdForEmail: " + result);
- }
-
- // TODO provide parameter values for insert
- @Ignore
- @Test
- public void testInsert() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is com.google.api.services.drive.model.Permission
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Permissions.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
-
- assertNotNull("insert result", result);
- LOG.debug("insert: " + result);
- }
-
- // TODO provide parameter values for list
- @Ignore
+
@Test
public void testList() throws Exception {
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Permissions.List result = requestBody("direct://LIST", null);
+ final com.google.api.services.drive.model.PermissionList result = requestBody("direct://LIST", fileId);
assertNotNull("list result", result);
LOG.debug("list: " + result);
}
- // TODO provide parameter values for patch
- @Ignore
- @Test
- public void testPatch() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.permissionId", null);
- // parameter type is com.google.api.services.drive.model.Permission
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Permissions.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
-
- assertNotNull("patch result", result);
- LOG.debug("patch: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.permissionId", null);
- // parameter type is com.google.api.services.drive.model.Permission
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Permissions.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
- }
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -175,6 +76,10 @@ public class DrivePermissionsIntegrationTest extends AbstractGoogleDriveTestSupp
// test route for update
from("direct://UPDATE")
.to("google-drive://" + PATH_PREFIX + "/update");
+
+ // just used to upload file for test
+ from("direct://INSERT_1")
+ .to("google-drive://drive-files/insert");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
index 63e9cc6..a1e066c 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
@@ -16,122 +16,35 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DrivePropertiesApiMethod;
+import com.google.api.services.drive.model.File;
+
/**
* Test class for com.google.api.services.drive.Drive$Properties APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DrivePropertiesIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DrivePropertiesIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DrivePropertiesApiMethod.class).getName();
- // TODO provide parameter values for delete
- @Ignore
- @Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.propertyKey", null);
-
- final com.google.api.services.drive.Drive.Properties.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
-
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.propertyKey", null);
-
- final com.google.api.services.drive.Drive.Properties.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for insert
- @Ignore
- @Test
- public void testInsert() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is com.google.api.services.drive.model.Property
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Properties.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
-
- assertNotNull("insert result", result);
- LOG.debug("insert: " + result);
- }
-
- // TODO provide parameter values for list
- @Ignore
@Test
public void testList() throws Exception {
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Properties.List result = requestBody("direct://LIST", null);
+ final com.google.api.services.drive.model.PropertyList result = requestBody("direct://LIST", fileId);
assertNotNull("list result", result);
LOG.debug("list: " + result);
}
- // TODO provide parameter values for patch
- @Ignore
- @Test
- public void testPatch() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.propertyKey", null);
- // parameter type is com.google.api.services.drive.model.Property
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Properties.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
-
- assertNotNull("patch result", result);
- LOG.debug("patch: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.propertyKey", null);
- // parameter type is com.google.api.services.drive.model.Property
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Properties.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
- }
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
@@ -160,7 +73,10 @@ public class DrivePropertiesIntegrationTest extends AbstractGoogleDriveTestSuppo
// test route for update
from("direct://UPDATE")
.to("google-drive://" + PATH_PREFIX + "/update");
-
+
+ // just used to upload file for test
+ from("direct://INSERT_1")
+ .to("google-drive://drive-files/insert");
}
};
}
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
index acee830..26c526f 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
@@ -24,10 +24,13 @@ import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DriveRepliesApiMethod;
+import com.google.api.services.drive.model.Comment;
+import com.google.api.services.drive.model.File;
+
/**
* Test class for com.google.api.services.drive.Drive$Replies APIs.
* TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
@@ -38,114 +41,59 @@ public class DriveRepliesIntegrationTest extends AbstractGoogleDriveTestSupport
private static final Logger LOG = LoggerFactory.getLogger(DriveRepliesIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRepliesApiMethod.class).getName();
- // TODO provide parameter values for delete
- @Ignore
- @Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.replyId", null);
-
- final com.google.api.services.drive.Drive.Replies.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
-
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.replyId", null);
-
- final com.google.api.services.drive.Drive.Replies.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for insert
- @Ignore
@Test
- public void testInsert() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
+ public void testReplyToComment() throws Exception {
+ // 1. create test file
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
+ // 2. comment on that file
+ Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", fileId);
+ // parameter type is com.google.api.services.drive.model.Comment
+ com.google.api.services.drive.model.Comment comment = new com.google.api.services.drive.model.Comment();
+ comment.setContent("Camel rocks!");
+ headers.put("CamelGoogleDrive.content", comment);
+
+ requestBodyAndHeaders("direct://INSERT_COMMENT", null, headers);
+
+ // 3. get a list of comments on the file
+ // using String message body for single parameter "fileId"
+ com.google.api.services.drive.model.CommentList result1 = requestBody("direct://LIST_COMMENTS", fileId);
+
+ assertNotNull(result1.get("items"));
+ LOG.debug("list: " + result1);
+
+ Comment comment2 = result1.getItems().get(0);
+ String commentId = comment2.getCommentId();
+
+ // 4. add reply
+ headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", fileId);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", commentId);
// parameter type is com.google.api.services.drive.model.CommentReply
- headers.put("CamelGoogleDrive.content", null);
+ com.google.api.services.drive.model.CommentReply reply = new com.google.api.services.drive.model.CommentReply();
+ reply.setContent("I know :-)");
+ headers.put("CamelGoogleDrive.content", reply);
- final com.google.api.services.drive.Drive.Replies.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
-
- assertNotNull("insert result", result);
- LOG.debug("insert: " + result);
- }
+ requestBodyAndHeaders("direct://INSERT", null, headers);
- // TODO provide parameter values for list
- @Ignore
- @Test
- public void testList() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
+ // 5. list replies on comment to file
+
+ headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ headers.put("CamelGoogleDrive.fileId", fileId);
// parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
+ headers.put("CamelGoogleDrive.commentId", commentId);
- final com.google.api.services.drive.Drive.Replies.List result = requestBodyAndHeaders("direct://LIST", null, headers);
+ final com.google.api.services.drive.model.CommentReplyList result = requestBodyAndHeaders("direct://LIST", null, headers);
assertNotNull("list result", result);
LOG.debug("list: " + result);
- }
- // TODO provide parameter values for patch
- @Ignore
- @Test
- public void testPatch() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.replyId", null);
- // parameter type is com.google.api.services.drive.model.CommentReply
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Replies.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
-
- assertNotNull("patch result", result);
- LOG.debug("patch: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.commentId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.replyId", null);
- // parameter type is com.google.api.services.drive.model.CommentReply
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Replies.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
}
@Override
@@ -175,6 +123,18 @@ public class DriveRepliesIntegrationTest extends AbstractGoogleDriveTestSupport
// test route for update
from("direct://UPDATE")
.to("google-drive://" + PATH_PREFIX + "/update");
+
+ // just used to upload file for test
+ from("direct://INSERT_1")
+ .to("google-drive://" + GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName() + "/insert");
+
+ // test route for insert
+ from("direct://INSERT_COMMENT")
+ .to("google-drive://drive-comments/insert");
+
+ // test route for list
+ from("direct://LIST_COMMENTS")
+ .to("google-drive://drive-comments/list?inBody=fileId");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/1acfe6e7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
index 5a41004..22ab865 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
@@ -16,107 +16,35 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DriveRevisionsApiMethod;
+import com.google.api.services.drive.model.File;
+
/**
* Test class for com.google.api.services.drive.Drive$Revisions APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveRevisionsIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DriveRevisionsIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRevisionsApiMethod.class).getName();
- // TODO provide parameter values for delete
- @Ignore
- @Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.revisionId", null);
-
- final com.google.api.services.drive.Drive.Revisions.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
-
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.revisionId", null);
-
- final com.google.api.services.drive.Drive.Revisions.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for list
- @Ignore
@Test
public void testList() throws Exception {
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Revisions.List result = requestBody("direct://LIST", null);
+ final com.google.api.services.drive.model.RevisionList result = requestBody("direct://LIST", fileId);
assertNotNull("list result", result);
LOG.debug("list: " + result);
}
- // TODO provide parameter values for patch
- @Ignore
- @Test
- public void testPatch() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.revisionId", null);
- // parameter type is com.google.api.services.drive.model.Revision
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Revisions.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
-
- assertNotNull("patch result", result);
- LOG.debug("patch: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.revisionId", null);
- // parameter type is com.google.api.services.drive.model.Revision
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Revisions.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
- }
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -141,6 +69,9 @@ public class DriveRevisionsIntegrationTest extends AbstractGoogleDriveTestSuppor
from("direct://UPDATE")
.to("google-drive://" + PATH_PREFIX + "/update");
+ // just used to upload file for test
+ from("direct://INSERT_1")
+ .to("google-drive://drive-files/insert");
}
};
}
[16/21] git commit: minor refactorings
Posted by ja...@apache.org.
minor refactorings
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/77848e1c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/77848e1c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/77848e1c
Branch: refs/heads/master
Commit: 77848e1c4517c50e49f6acece774d929a06003ea
Parents: 68530db
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Sep 4 00:28:56 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:10 2014 -0230
----------------------------------------------------------------------
.../drive/DefaultGoogleDriveClientFactory.java | 71 ++++++++++++++++++
.../google/drive/GoogleDriveClientFactory.java | 11 +++
.../google/drive/GoogleDriveConsumer.java | 5 +-
.../google/drive/GoogleDriveEndpoint.java | 75 +++++---------------
.../google/drive/GoogleDriveProducer.java | 5 +-
.../src/test/resources/test-options.properties | 6 +-
6 files changed, 104 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/77848e1c/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
new file mode 100644
index 0000000..5ad6b17
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
@@ -0,0 +1,71 @@
+/**
+ * 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.component.google.drive;
+
+import java.util.Collection;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.drive.Drive;
+
+public class DefaultGoogleDriveClientFactory implements GoogleDriveClientFactory {
+ private NetHttpTransport transport;
+ private JacksonFactory jsonFactory;
+ private FileDataStoreFactory dataStoreFactory;
+ // TODO Directory to store user credentials
+ private static final java.io.File DATA_STORE_DIR = new java.io.File(System.getProperty("user.home"), ".store/drive_sample");
+
+ public DefaultGoogleDriveClientFactory() {
+ this.transport = new NetHttpTransport();
+ this.jsonFactory = new JacksonFactory();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.camel.component.google.drive.GoogleDriveClientFactory#makeClient
+ * (java.lang.String, java.lang.String, java.util.Collection)
+ */
+ @Override
+ public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes) {
+ Credential credential;
+ try {
+ credential = authorize(clientId, clientSecret, scopes);
+ return new Drive.Builder(transport, jsonFactory, credential).build();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ // Authorizes the installed application to access user's protected data.
+ private Credential authorize(String clientId, String clientSecret, Collection<String> scopes) throws Exception {
+ dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
+ // set up authorization code flow
+ // TODO refresh token support too
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, clientId, clientSecret, scopes).setDataStoreFactory(dataStoreFactory).build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/77848e1c/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
new file mode 100644
index 0000000..669c253
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
@@ -0,0 +1,11 @@
+package org.apache.camel.component.google.drive;
+
+import java.util.Collection;
+
+import com.google.api.services.drive.Drive;
+
+public interface GoogleDriveClientFactory {
+
+ public abstract Drive makeClient(String clientId, String clientSecret, Collection<String> scopes);
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/77848e1c/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
index 3490c0c..43ef2d4 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
@@ -39,13 +39,10 @@ public class GoogleDriveConsumer extends AbstractApiConsumer<GoogleDriveApiName,
@Override
protected Object doInvokeMethod(Map<String, Object> properties) throws RuntimeCamelException {
AbstractGoogleClientRequest request = (AbstractGoogleClientRequest) super.doInvokeMethod(properties);
- // TODO set any generic params, like OAuth token, etc.
try {
return request.execute();
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new RuntimeCamelException(e);
}
- return null;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/77848e1c/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index 852438f..e2b5dfa 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -17,7 +17,6 @@
package org.apache.camel.component.google.drive;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -33,13 +32,6 @@ import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
import org.apache.camel.component.google.drive.internal.GoogleDriveConstants;
import org.apache.camel.component.google.drive.internal.GoogleDrivePropertiesHelper;
-import com.google.api.client.auth.oauth2.Credential;
-import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
-import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
-import com.google.api.client.http.javanet.NetHttpTransport;
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
@@ -51,14 +43,7 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
private Object apiProxy;
private Drive client;
- // TODO these need to be configurable
- private NetHttpTransport transport = new NetHttpTransport();
- private JacksonFactory jsonFactory = new JacksonFactory();
- private FileDataStoreFactory dataStoreFactory;
-
- // TODO Directory to store user credentials
- private static final java.io.File DATA_STORE_DIR = new java.io.File(
- System.getProperty("user.home"), ".store/drive_sample");
+ private GoogleDriveClientFactory clientFactory;
private static final List<String> DEFAULT_SCOPES = Arrays.asList(DriveScopes.DRIVE_FILE, DriveScopes.DRIVE_APPS_READONLY, DriveScopes.DRIVE_METADATA_READONLY,
DriveScopes.DRIVE);
@@ -66,7 +51,6 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
public GoogleDriveEndpoint(String uri, GoogleDriveComponent component,
GoogleDriveApiName apiName, String methodName, GoogleDriveConfiguration endpointConfiguration) {
super(uri, component, apiName, methodName, GoogleDriveApiCollection.getCollection().getHelper(apiName), endpointConfiguration);
-
}
public Producer createProducer() throws Exception {
@@ -92,25 +76,9 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
protected String getThreadProfileName() {
return GoogleDriveConstants.THREAD_PROFILE_NAME;
}
-
- // Authorizes the installed application to access user's protected data.
- private Credential authorize() throws Exception {
- dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
- // set up authorization code flow
- // TODO refresh token support too
- GoogleAuthorizationCodeFlow flow =
- new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, configuration.getClientId(), configuration.getClientSecret(),
- DEFAULT_SCOPES).setDataStoreFactory(dataStoreFactory)
- .build();
- // authorize
- return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
- }
-
@Override
protected void afterConfigureProperties() {
- // TODO create API proxy, set connection properties, etc.
-
switch ((GoogleDriveApiName) apiName) {
case DRIVE_FILES:
apiProxy = getClient().files();
@@ -132,20 +100,7 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
break;
case DRIVE_PROPERTIES:
apiProxy = getClient().properties();
- break;
-// Still need to support these drive APIs
-// case DRIVE_CHANNELS:
-// apiProxy = getClient().channels();
-// break;
-// case DRIVE_CHILDREN:
-// apiProxy = getClient().children();
-// break;
-// case DRIVE_PARENTS:
-// apiProxy = getClient().parents();
-// break;
-// case DRIVE_REALTIME:
-// apiProxy = getClient().realtime();
-// break;
+ break;
case DRIVE_REPLIES:
apiProxy = getClient().replies();
break;
@@ -156,23 +111,27 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
throw new IllegalArgumentException("Invalid API name " + apiName);
}
}
-
- public Drive getClient() {
+
+ private Drive getClient() {
if (client == null) {
- Credential credential;
- try {
- credential = authorize();
- client = new Drive.Builder(transport, jsonFactory, credential).build();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES);
}
return client;
}
-
+
@Override
public Object getApiProxy(ApiMethod method, Map<String, Object> args) {
return apiProxy;
}
+
+ public GoogleDriveClientFactory getClientFactory() {
+ if (clientFactory == null) {
+ clientFactory = new DefaultGoogleDriveClientFactory();
+ }
+ return clientFactory;
+ }
+
+ public void setClientFactory(GoogleDriveClientFactory clientFactory) {
+ this.clientFactory = clientFactory;
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/77848e1c/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
index 485cf61..3579453 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
@@ -40,14 +40,11 @@ public class GoogleDriveProducer extends AbstractApiProducer<GoogleDriveApiName,
@Override
protected Object doInvokeMethod(ApiMethod method, Map<String, Object> properties) throws RuntimeCamelException {
AbstractGoogleClientRequest request = (AbstractGoogleClientRequest) super.doInvokeMethod(method, properties);
- // TODO set any generic params, like OAuth token, etc.
try {
return request.execute();
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new RuntimeCamelException(e);
}
- return null;
}
protected String getThreadProfileName() {
http://git-wip-us.apache.org/repos/asf/camel/blob/77848e1c/components/camel-google-drive/src/test/resources/test-options.properties
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/resources/test-options.properties b/components/camel-google-drive/src/test/resources/test-options.properties
index 8e21b12..710ec6a 100644
--- a/components/camel-google-drive/src/test/resources/test-options.properties
+++ b/components/camel-google-drive/src/test/resources/test-options.properties
@@ -19,6 +19,6 @@
## Login properties for Google Drive Component
#####################################
## Application client id and secret
-clientId=
-clientSecret=
-applicationName=
+clientId=907911893802-1tvr7lrt5f8k4sco2rigdo5kf4lfht4d.apps.googleusercontent.com
+clientSecret=g53qS_MTceqexaoZC9YtTOI4
+applicationName=camel-google-drive/1.0
\ No newline at end of file
[08/21] git commit: Get some of the drive-file API tests working
Posted by ja...@apache.org.
Get some of the drive-file API tests working
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ffda80ee
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ffda80ee
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ffda80ee
Branch: refs/heads/master
Commit: ffda80ee7a1c9305050071f2207a7c2905069f47
Parents: 72e5aad
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Jul 10 19:48:01 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:09 2014 -0230
----------------------------------------------------------------------
.../drive/AbstractGoogleDriveTestSupport.java | 19 +--
.../google/drive/DriveFilesIntegrationTest.java | 166 +++++++++++--------
.../src/test/resources/camel-box-small.png | Bin 0 -> 38856 bytes
.../src/test/resources/test-options.properties | 24 +++
4 files changed, 133 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ffda80ee/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
index 45f7b51..1626e99 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
@@ -17,13 +17,10 @@
package org.apache.camel.component.google.drive;
import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
-import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -72,13 +69,13 @@ public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
throw new IOException(String.format("%s could not be loaded: %s", TEST_OPTIONS_PROPERTIES, e.getMessage()),
e);
}
-
- // cache test properties
- refreshToken = properties.getProperty(REFRESH_TOKEN_PROPERTY);
- testFolderId = properties.getProperty("testFolderId");
- testFileId = properties.getProperty("testFileId");
- testUserId = properties.getProperty("testUserId");
-
+//
+// // cache test properties
+// refreshToken = properties.getProperty(REFRESH_TOKEN_PROPERTY);
+// testFolderId = properties.getProperty("testFolderId");
+// testFileId = properties.getProperty("testFileId");
+// testUserId = properties.getProperty("testUserId");
+//
Map<String, Object> options = new HashMap<String, Object>();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
options.put(entry.getKey().toString(), entry.getValue());
@@ -92,7 +89,7 @@ public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
final GoogleDriveComponent component = new GoogleDriveComponent(context);
component.setConfiguration(configuration);
- context.addComponent("box", component);
+ context.addComponent("google-drive", component);
return context;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ffda80ee/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
index 5b38298..c8cd5a6 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
@@ -5,6 +5,7 @@
package org.apache.camel.component.google.drive;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
@@ -12,98 +13,129 @@ import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
+import com.google.api.client.http.FileContent;
+import com.google.api.client.util.DateTime;
+import com.google.api.services.drive.model.File;
+import com.google.api.services.drive.model.FileList;
+
/**
* Test class for com.google.api.services.drive.Drive$Files APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DriveFilesIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
-
- // TODO provide parameter values for copy
- @Ignore
+ private static final String TEST_UPLOAD_FILE = "src/test/resources/log4j.properties";
+ private static final String TEST_UPLOAD_IMG = "src/test/resources/camel-box-small.png";
+ private static final java.io.File UPLOAD_FILE = new java.io.File(TEST_UPLOAD_FILE);
+
@Test
public void testCopy() throws Exception {
+ File testFile = uploadTestFile();
+ String fromFileId = testFile.getId();
+
+ File toFile = new File();
+ toFile.setTitle(UPLOAD_FILE.getName() + "_copy");
+
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ headers.put("CamelGoogleDrive.fileId", fromFileId);
// parameter type is com.google.api.services.drive.model.File
- headers.put("CamelGoogleDrive.content", null);
+ headers.put("CamelGoogleDrive.content", toFile);
- final com.google.api.services.drive.Drive.Files.Copy result = requestBodyAndHeaders("direct://COPY", null, headers);
+ final File result = requestBodyAndHeaders("direct://COPY", null, headers);
assertNotNull("copy result", result);
+ assertEquals(toFile.getTitle(), result.getTitle());
LOG.debug("copy: " + result);
}
- // TODO provide parameter values for delete
- @Ignore
@Test
public void testDelete() throws Exception {
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Files.Delete result = requestBody("direct://DELETE", null);
+ sendBody("direct://DELETE", fileId);
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
+ // the file should be gone now
+ final File result = requestBody("direct://GET", fileId);
+ assertNull("get result", result);
}
- // TODO provide parameter values for get
- @Ignore
@Test
public void testGet() throws Exception {
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Files.Get result = requestBody("direct://GET", null);
+ final File result = requestBody("direct://GET", fileId);
assertNotNull("get result", result);
LOG.debug("get: " + result);
}
- // TODO provide parameter values for insert
- @Ignore
@Test
public void testInsert() throws Exception {
+ File file = new File();
+ file.setTitle(UPLOAD_FILE.getName());
// using com.google.api.services.drive.model.File message body for single parameter "content"
- final com.google.api.services.drive.Drive.Files.Insert result = requestBody("direct://INSERT", null);
-
+ File result = requestBody("direct://INSERT", file);
assertNotNull("insert result", result);
LOG.debug("insert: " + result);
}
- // TODO provide parameter values for insert
- @Ignore
- @Test
- public void testInsert_1() throws Exception {
+ private File uploadTestFile() {
+ File fileMetadata = new File();
+ fileMetadata.setTitle(UPLOAD_FILE.getName());
+ FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
+
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is com.google.api.services.drive.model.File
- headers.put("CamelGoogleDrive.content", null);
+ headers.put("CamelGoogleDrive.content", fileMetadata);
// parameter type is com.google.api.client.http.AbstractInputStreamContent
- headers.put("CamelGoogleDrive.mediaContent", null);
+ headers.put("CamelGoogleDrive.mediaContent", mediaContent);
- final com.google.api.services.drive.Drive.Files.Insert result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
+ File result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
+ return result;
+ }
+
+ @Test
+ public void testInsert_1() throws Exception {
+ File result = uploadTestFile();
assertNotNull("insert result", result);
LOG.debug("insert: " + result);
}
- @Ignore
@Test
public void testList() throws Exception {
- final com.google.api.services.drive.Drive.Files.List result = requestBody("direct://LIST", null);
-
+ // upload a test file
+ File theTestFile = uploadTestFile();
+
+ final FileList result = requestBody("direct://LIST", null);
assertNotNull("list result", result);
LOG.debug("list: " + result);
}
- // TODO provide parameter values for patch
@Ignore
@Test
public void testPatch() throws Exception {
+ // TODO have to support setting patch parameters before callinfg execute like:
+ /*
+ File file = new File();
+ file.setTitle(newTitle);
+
+ // Rename the file using a patch request.
+ Files.Patch patchRequest = service.files().patch(fileId, file);
+ patchRequest.setFields("title");
+
+ File updatedFile = patchRequest.execute();
+ */
+
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelGoogleDrive.fileId", null);
@@ -116,68 +148,72 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
LOG.debug("patch: " + result);
}
- // TODO provide parameter values for touch
- @Ignore
@Test
public void testTouch() throws Exception {
+ File theTestFile = uploadTestFile();
+ DateTime createdDate = theTestFile.getModifiedDate();
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Files.Touch result = requestBody("direct://TOUCH", null);
+ File result = requestBody("direct://TOUCH", theTestFile.getId());
assertNotNull("touch result", result);
- LOG.debug("touch: " + result);
+ assertTrue(result.getModifiedDate().getValue() > createdDate.getValue());
}
- // TODO provide parameter values for trash
- @Ignore
@Test
public void testTrash() throws Exception {
- // using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Files.Trash result = requestBody("direct://TRASH", null);
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
- assertNotNull("trash result", result);
- LOG.debug("trash: " + result);
- }
+ assertNotNull("trash result", requestBody("direct://TRASH", fileId));
+ assertNotNull("untrash result", requestBody("direct://UNTRASH", fileId));
- // TODO provide parameter values for untrash
- @Ignore
- @Test
- public void testUntrash() throws Exception {
- // using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Files.Untrash result = requestBody("direct://UNTRASH", null);
-
- assertNotNull("untrash result", result);
- LOG.debug("untrash: " + result);
- }
+ }
- // TODO provide parameter values for update
- @Ignore
@Test
public void testUpdate() throws Exception {
+ File theTestFile = uploadTestFile();
+
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ headers.put("CamelGoogleDrive.fileId", theTestFile.getId());
// parameter type is com.google.api.services.drive.model.File
- headers.put("CamelGoogleDrive.content", null);
+ headers.put("CamelGoogleDrive.content", theTestFile);
- final com.google.api.services.drive.Drive.Files.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+ File result = requestBodyAndHeaders("direct://UPDATE", null, headers);
assertNotNull("update result", result);
LOG.debug("update: " + result);
}
- // TODO provide parameter values for update
- @Ignore
@Test
- public void testUpdate_1() throws Exception {
+ public void testUpdate_1() throws Exception {
+
+ // First retrieve the file from the API.
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
+ // using String message body for single parameter "fileId"
+ final File file = requestBody("direct://GET", fileId);
+
+ // File's new metadata.
+ file.setTitle("camel.png");
+ file.setMimeType("application/vnd.google-apps.photo");
+
+ // File's new content.
+ java.io.File fileContent = new java.io.File(TEST_UPLOAD_IMG);
+ FileContent mediaContent = new FileContent("application/vnd.google-apps.photo", fileContent);
+
+ // Send the request to the API.
+
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
+ headers.put("CamelGoogleDrive.fileId", fileId);
// parameter type is com.google.api.services.drive.model.File
- headers.put("CamelGoogleDrive.content", null);
+ headers.put("CamelGoogleDrive.content", file);
// parameter type is com.google.api.client.http.AbstractInputStreamContent
- headers.put("CamelGoogleDrive.mediaContent", null);
+ headers.put("CamelGoogleDrive.mediaContent", mediaContent);
- final com.google.api.services.drive.Drive.Files.Update result = requestBodyAndHeaders("direct://UPDATE_1", null, headers);
+ File result = requestBodyAndHeaders("direct://UPDATE_1", null, headers);
assertNotNull("update result", result);
LOG.debug("update: " + result);
http://git-wip-us.apache.org/repos/asf/camel/blob/ffda80ee/components/camel-google-drive/src/test/resources/camel-box-small.png
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/resources/camel-box-small.png b/components/camel-google-drive/src/test/resources/camel-box-small.png
new file mode 100755
index 0000000..42a6417
Binary files /dev/null and b/components/camel-google-drive/src/test/resources/camel-box-small.png differ
http://git-wip-us.apache.org/repos/asf/camel/blob/ffda80ee/components/camel-google-drive/src/test/resources/test-options.properties
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/resources/test-options.properties b/components/camel-google-drive/src/test/resources/test-options.properties
new file mode 100644
index 0000000..8e21b12
--- /dev/null
+++ b/components/camel-google-drive/src/test/resources/test-options.properties
@@ -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.
+#
+
+#####################################
+## Login properties for Google Drive Component
+#####################################
+## Application client id and secret
+clientId=
+clientSecret=
+applicationName=
[15/21] git commit: Unit test updates
Posted by ja...@apache.org.
Unit test updates
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2243e251
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2243e251
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2243e251
Branch: refs/heads/master
Commit: 2243e251e0f9426a1a7ae3b0c6fdc2fef78cee8b
Parents: 61df41e
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Wed Sep 3 23:51:46 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:10 2014 -0230
----------------------------------------------------------------------
.../google/drive/GoogleDriveEndpoint.java | 53 +++++++--
.../google/drive/DriveAboutIntegrationTest.java | 9 +-
.../google/drive/DriveAppsIntegrationTest.java | 9 +-
.../drive/DriveChangesIntegrationTest.java | 5 +-
.../drive/DriveChannelsIntegrationTest.java | 51 ---------
.../drive/DriveChildrenIntegrationTest.java | 111 -------------------
.../drive/DriveCommentsIntegrationTest.java | 36 +++++-
.../google/drive/DriveFilesIntegrationTest.java | 1 -
.../drive/DriveParentsIntegrationTest.java | 111 -------------------
.../drive/DriveRealtimeIntegrationTest.java | 86 --------------
10 files changed, 81 insertions(+), 391 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index 44d4d4b..d61c70d 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -1,6 +1,8 @@
package org.apache.camel.component.google.drive;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import org.apache.camel.Consumer;
@@ -38,11 +40,12 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
private JacksonFactory jsonFactory = new JacksonFactory();
private FileDataStoreFactory dataStoreFactory;
- // Directory to store user credentials
+ // TODO Directory to store user credentials
private static final java.io.File DATA_STORE_DIR = new java.io.File(
- System.getProperty("user.home"), ".store/drive_sample");
-
+ System.getProperty("user.home"), ".store/drive_sample");
+ private static final List<String> DEFAULT_SCOPES = Arrays.asList(DriveScopes.DRIVE_FILE, DriveScopes.DRIVE_APPS_READONLY, DriveScopes.DRIVE_METADATA_READONLY,
+ DriveScopes.DRIVE);
public GoogleDriveEndpoint(String uri, GoogleDriveComponent component,
GoogleDriveApiName apiName, String methodName, GoogleDriveConfiguration endpointConfiguration) {
@@ -78,10 +81,10 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
private Credential authorize() throws Exception {
dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
// set up authorization code flow
- // TODO refresh token support too
- GoogleAuthorizationCodeFlow flow =
+ // TODO refresh token support too
+ GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, configuration.getClientId(), configuration.getClientSecret(),
- Collections.singleton(DriveScopes.DRIVE_FILE)).setDataStoreFactory(dataStoreFactory)
+ DEFAULT_SCOPES).setDataStoreFactory(dataStoreFactory)
.build();
// authorize
return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
@@ -96,7 +99,43 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
case DRIVE_FILES:
apiProxy = getClient().files();
break;
- // TODO add extra APIs here
+ case DRIVE_ABOUT:
+ apiProxy = getClient().about();
+ break;
+ case DRIVE_APPS:
+ apiProxy = getClient().apps();
+ break;
+ case DRIVE_CHANGES:
+ apiProxy = getClient().changes();
+ break;
+ case DRIVE_COMMENTS:
+ apiProxy = getClient().comments();
+ break;
+ case DRIVE_PERMISSIONS:
+ apiProxy = getClient().permissions();
+ break;
+ case DRIVE_PROPERTIES:
+ apiProxy = getClient().properties();
+ break;
+// Still need to support these drive APIs
+// case DRIVE_CHANNELS:
+// apiProxy = getClient().channels();
+// break;
+// case DRIVE_CHILDREN:
+// apiProxy = getClient().children();
+// break;
+// case DRIVE_PARENTS:
+// apiProxy = getClient().parents();
+// break;
+// case DRIVE_REALTIME:
+// apiProxy = getClient().realtime();
+// break;
+ case DRIVE_REPLIES:
+ apiProxy = getClient().replies();
+ break;
+ case DRIVE_REVISIONS:
+ apiProxy = getClient().revisions();
+ break;
default:
throw new IllegalArgumentException("Invalid API name " + apiName);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
index c20a9e5..8e6ca4a 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
@@ -4,11 +4,7 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,18 +14,15 @@ import org.apache.camel.component.google.drive.internal.DriveAboutApiMethod;
/**
* Test class for com.google.api.services.drive.Drive$About APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveAboutIntegrationTest extends AbstractGoogleDriveTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DriveAboutIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveAboutApiMethod.class).getName();
- @Ignore
@Test
public void testGet() throws Exception {
- final com.google.api.services.drive.Drive.About.Get result = requestBody("direct://GET", null);
+ final com.google.api.services.drive.model.About result = requestBody("direct://GET", null);
assertNotNull("get result", result);
LOG.debug("get: " + result);
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
index ffce4fe..4247134 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
@@ -4,9 +4,6 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
import org.junit.Ignore;
import org.junit.Test;
@@ -18,8 +15,6 @@ import org.apache.camel.component.google.drive.internal.DriveAppsApiMethod;
/**
* Test class for com.google.api.services.drive.Drive$Apps APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveAppsIntegrationTest extends AbstractGoogleDriveTestSupport {
@@ -37,10 +32,10 @@ public class DriveAppsIntegrationTest extends AbstractGoogleDriveTestSupport {
LOG.debug("get: " + result);
}
- @Ignore
+ // TODO getting permission errors for this one
@Test
public void testList() throws Exception {
- final com.google.api.services.drive.Drive.Apps.List result = requestBody("direct://LIST", null);
+ final com.google.api.services.drive.model.App result = requestBody("direct://LIST", null);
assertNotNull("list result", result);
LOG.debug("list: " + result);
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
index a6b3ea3..9573994 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
@@ -18,8 +18,6 @@ import org.apache.camel.component.google.drive.internal.DriveChangesApiMethod;
/**
* Test class for com.google.api.services.drive.Drive$Changes APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
*/
public class DriveChangesIntegrationTest extends AbstractGoogleDriveTestSupport {
@@ -37,10 +35,9 @@ public class DriveChangesIntegrationTest extends AbstractGoogleDriveTestSupport
LOG.debug("get: " + result);
}
- @Ignore
@Test
public void testList() throws Exception {
- final com.google.api.services.drive.Drive.Changes.List result = requestBody("direct://LIST", null);
+ final com.google.api.services.drive.model.ChangeList result = requestBody("direct://LIST", null);
assertNotNull("list result", result);
LOG.debug("list: " + result);
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java
deleted file mode 100644
index dcdbff7..0000000
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
- */
-package org.apache.camel.component.google.drive;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
-import org.apache.camel.component.google.drive.internal.DriveChannelsApiMethod;
-
-/**
- * Test class for com.google.api.services.drive.Drive$Channels APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
- */
-public class DriveChannelsIntegrationTest extends AbstractGoogleDriveTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(DriveChannelsIntegrationTest.class);
- private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChannelsApiMethod.class).getName();
-
- // TODO provide parameter values for stop
- @Ignore
- @Test
- public void testStop() throws Exception {
- // using com.google.api.services.drive.model.Channel message body for single parameter "contentChannel"
- final com.google.api.services.drive.Drive.Channels.Stop result = requestBody("direct://STOP", null);
-
- assertNotNull("stop result", result);
- LOG.debug("stop: " + result);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- // test route for stop
- from("direct://STOP")
- .to("google-drive://" + PATH_PREFIX + "/stop?inBody=contentChannel");
-
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
deleted file mode 100644
index f2ac396..0000000
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
- */
-package org.apache.camel.component.google.drive;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
-import org.apache.camel.component.google.drive.internal.DriveChildrenApiMethod;
-
-/**
- * Test class for com.google.api.services.drive.Drive$Children APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
- */
-public class DriveChildrenIntegrationTest extends AbstractGoogleDriveTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(DriveChildrenIntegrationTest.class);
- private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChildrenApiMethod.class).getName();
-
- // TODO provide parameter values for delete
- @Ignore
- @Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.folderId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.childId", null);
-
- final com.google.api.services.drive.Drive.Children.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
-
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.folderId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.childId", null);
-
- final com.google.api.services.drive.Drive.Children.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for insert
- @Ignore
- @Test
- public void testInsert() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.folderId", null);
- // parameter type is com.google.api.services.drive.model.ChildReference
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Children.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
-
- assertNotNull("insert result", result);
- LOG.debug("insert: " + result);
- }
-
- // TODO provide parameter values for list
- @Ignore
- @Test
- public void testList() throws Exception {
- // using String message body for single parameter "folderId"
- final com.google.api.services.drive.Drive.Children.List result = requestBody("direct://LIST", null);
-
- assertNotNull("list result", result);
- LOG.debug("list: " + result);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- // test route for delete
- from("direct://DELETE")
- .to("google-drive://" + PATH_PREFIX + "/delete");
-
- // test route for get
- from("direct://GET")
- .to("google-drive://" + PATH_PREFIX + "/get");
-
- // test route for insert
- from("direct://INSERT")
- .to("google-drive://" + PATH_PREFIX + "/insert");
-
- // test route for list
- from("direct://LIST")
- .to("google-drive://" + PATH_PREFIX + "/list?inBody=folderId");
-
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
index b952a93..4cb3882 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
@@ -12,10 +12,13 @@ import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.DriveCommentsApiMethod;
+import com.google.api.client.http.FileContent;
+import com.google.api.services.drive.model.File;
+
/**
* Test class for com.google.api.services.drive.Drive$Comments APIs.
* TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
@@ -25,7 +28,10 @@ public class DriveCommentsIntegrationTest extends AbstractGoogleDriveTestSupport
private static final Logger LOG = LoggerFactory.getLogger(DriveCommentsIntegrationTest.class);
private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveCommentsApiMethod.class).getName();
-
+ private static final String TEST_UPLOAD_FILE = "src/test/resources/log4j.properties";
+ private static final String TEST_UPLOAD_IMG = "src/test/resources/camel-box-small.png";
+ private static final java.io.File UPLOAD_FILE = new java.io.File(TEST_UPLOAD_FILE);
+
// TODO provide parameter values for delete
@Ignore
@Test
@@ -74,12 +80,28 @@ public class DriveCommentsIntegrationTest extends AbstractGoogleDriveTestSupport
LOG.debug("insert: " + result);
}
- // TODO provide parameter values for list
- @Ignore
+ private File uploadTestFile() {
+ File fileMetadata = new File();
+ fileMetadata.setTitle(UPLOAD_FILE.getName());
+ FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
+
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", fileMetadata);
+ // parameter type is com.google.api.client.http.AbstractInputStreamContent
+ headers.put("CamelGoogleDrive.mediaContent", mediaContent);
+
+ File result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
+ return result;
+ }
+
@Test
public void testList() throws Exception {
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
// using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Comments.List result = requestBody("direct://LIST", null);
+ final com.google.api.services.drive.model.CommentList result = requestBody("direct://LIST", fileId);
assertNotNull("list result", result);
LOG.debug("list: " + result);
@@ -148,6 +170,10 @@ public class DriveCommentsIntegrationTest extends AbstractGoogleDriveTestSupport
// test route for update
from("direct://UPDATE")
.to("google-drive://" + PATH_PREFIX + "/update");
+
+ // just used to upload file for test
+ from("direct://INSERT_1")
+ .to("google-drive://" + GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName() + "/insert");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
index 3c88d39..ddf62bf 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
@@ -5,7 +5,6 @@
package org.apache.camel.component.google.drive;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java
deleted file mode 100644
index 40b1f2a..0000000
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
- */
-package org.apache.camel.component.google.drive;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
-import org.apache.camel.component.google.drive.internal.DriveParentsApiMethod;
-
-/**
- * Test class for com.google.api.services.drive.Drive$Parents APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
- */
-public class DriveParentsIntegrationTest extends AbstractGoogleDriveTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(DriveParentsIntegrationTest.class);
- private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveParentsApiMethod.class).getName();
-
- // TODO provide parameter values for delete
- @Ignore
- @Test
- public void testDelete() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.parentId", null);
-
- final com.google.api.services.drive.Drive.Parents.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
-
- assertNotNull("delete result", result);
- LOG.debug("delete: " + result);
- }
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is String
- headers.put("CamelGoogleDrive.parentId", null);
-
- final com.google.api.services.drive.Drive.Parents.Get result = requestBodyAndHeaders("direct://GET", null, headers);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for insert
- @Ignore
- @Test
- public void testInsert() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is com.google.api.services.drive.model.ParentReference
- headers.put("CamelGoogleDrive.content", null);
-
- final com.google.api.services.drive.Drive.Parents.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
-
- assertNotNull("insert result", result);
- LOG.debug("insert: " + result);
- }
-
- // TODO provide parameter values for list
- @Ignore
- @Test
- public void testList() throws Exception {
- // using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Parents.List result = requestBody("direct://LIST", null);
-
- assertNotNull("list result", result);
- LOG.debug("list: " + result);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- // test route for delete
- from("direct://DELETE")
- .to("google-drive://" + PATH_PREFIX + "/delete");
-
- // test route for get
- from("direct://GET")
- .to("google-drive://" + PATH_PREFIX + "/get");
-
- // test route for insert
- from("direct://INSERT")
- .to("google-drive://" + PATH_PREFIX + "/insert");
-
- // test route for list
- from("direct://LIST")
- .to("google-drive://" + PATH_PREFIX + "/list?inBody=fileId");
-
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/2243e251/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java
deleted file mode 100644
index d991aad..0000000
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRealtimeIntegrationTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
- */
-package org.apache.camel.component.google.drive;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
-import org.apache.camel.component.google.drive.internal.DriveRealtimeApiMethod;
-
-/**
- * Test class for com.google.api.services.drive.Drive$Realtime APIs.
- * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
- * The class source won't be generated again if the generator MOJO finds it under src/test/java.
- */
-public class DriveRealtimeIntegrationTest extends AbstractGoogleDriveTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(DriveRealtimeIntegrationTest.class);
- private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRealtimeApiMethod.class).getName();
-
- // TODO provide parameter values for get
- @Ignore
- @Test
- public void testGet() throws Exception {
- // using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Realtime.Get result = requestBody("direct://GET", null);
-
- assertNotNull("get result", result);
- LOG.debug("get: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate() throws Exception {
- // using String message body for single parameter "fileId"
- final com.google.api.services.drive.Drive.Realtime.Update result = requestBody("direct://UPDATE", null);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
- }
-
- // TODO provide parameter values for update
- @Ignore
- @Test
- public void testUpdate_1() throws Exception {
- final Map<String, Object> headers = new HashMap<String, Object>();
- // parameter type is String
- headers.put("CamelGoogleDrive.fileId", null);
- // parameter type is com.google.api.client.http.AbstractInputStreamContent
- headers.put("CamelGoogleDrive.mediaContent", null);
-
- final com.google.api.services.drive.Drive.Realtime.Update result = requestBodyAndHeaders("direct://UPDATE_1", null, headers);
-
- assertNotNull("update result", result);
- LOG.debug("update: " + result);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- // test route for get
- from("direct://GET")
- .to("google-drive://" + PATH_PREFIX + "/get?inBody=fileId");
-
- // test route for update
- from("direct://UPDATE")
- .to("google-drive://" + PATH_PREFIX + "/update?inBody=fileId");
-
- // test route for update
- from("direct://UPDATE_1")
- .to("google-drive://" + PATH_PREFIX + "/update");
-
- }
- };
- }
-}
[20/21] git commit: Add batch CF for refreshToken scenarios
Posted by ja...@apache.org.
Add batch CF for refreshToken scenarios
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1bfb63fd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1bfb63fd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1bfb63fd
Branch: refs/heads/master
Commit: 1bfb63fd5b844ca5275afe2a3f66561e4e1d6b97
Parents: 30e1fdb
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Mon Sep 8 00:24:47 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:11 2014 -0230
----------------------------------------------------------------------
.../drive/BatchGoogleDriveClientFactory.java | 59 +++++++++++++++++
.../drive/DefaultGoogleDriveClientFactory.java | 63 ------------------
.../google/drive/GoogleDriveClientFactory.java | 2 +-
.../google/drive/GoogleDriveConfiguration.java | 2 -
.../google/drive/GoogleDriveEndpoint.java | 4 +-
.../InteractiveGoogleDriveClientFactory.java | 69 ++++++++++++++++++++
6 files changed, 131 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1bfb63fd/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
new file mode 100644
index 0000000..bb9c883
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
@@ -0,0 +1,59 @@
+/**
+ * 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.component.google.drive;
+
+import java.util.Collection;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.services.drive.Drive;
+
+public class BatchGoogleDriveClientFactory implements GoogleDriveClientFactory {
+ private NetHttpTransport transport;
+ private JacksonFactory jsonFactory;
+
+ public BatchGoogleDriveClientFactory() {
+ this.transport = new NetHttpTransport();
+ this.jsonFactory = new JacksonFactory();
+ }
+
+ @Override
+ public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName, String refreshToken) {
+ Credential credential;
+ try {
+ credential = authorize(clientId, clientSecret, scopes, refreshToken);
+ return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ // Authorizes the installed application to access user's protected data.
+ private Credential authorize(String clientId, String clientSecret, Collection<String> scopes, String refreshToken) throws Exception {
+ // authorize
+ return new GoogleCredential.Builder()
+ .setJsonFactory(jsonFactory)
+ .setTransport(transport)
+ .setClientSecrets(clientId, clientSecret)
+ .build()
+ .setRefreshToken(refreshToken);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1bfb63fd/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
deleted file mode 100644
index da9e796..0000000
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
+++ /dev/null
@@ -1,63 +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.component.google.drive;
-
-import java.util.Collection;
-
-import com.google.api.client.auth.oauth2.Credential;
-import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
-import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
-import com.google.api.client.http.javanet.NetHttpTransport;
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.client.util.store.FileDataStoreFactory;
-import com.google.api.services.drive.Drive;
-
-public class DefaultGoogleDriveClientFactory implements GoogleDriveClientFactory {
- private NetHttpTransport transport;
- private JacksonFactory jsonFactory;
- private FileDataStoreFactory dataStoreFactory;
- private static final java.io.File DATA_STORE_DIR = new java.io.File(".google_drive");
-
- public DefaultGoogleDriveClientFactory() {
- this.transport = new NetHttpTransport();
- this.jsonFactory = new JacksonFactory();
- }
-
- @Override
- public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName) {
- Credential credential;
- try {
- credential = authorize(clientId, clientSecret, scopes);
- return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
- }
-
- // Authorizes the installed application to access user's protected data.
- private Credential authorize(String clientId, String clientSecret, Collection<String> scopes) throws Exception {
- dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
- // set up authorization code flow
- // TODO refresh token support too
- GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, clientId, clientSecret, scopes).setDataStoreFactory(dataStoreFactory).build();
- // authorize
- return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1bfb63fd/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
index b183279..10a0089 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveClientFactory.java
@@ -22,6 +22,6 @@ import com.google.api.services.drive.Drive;
public interface GoogleDriveClientFactory {
- public abstract Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName);
+ public abstract Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName, String refreshToken);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1bfb63fd/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
index eb0db54..2f8b19c 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
@@ -16,8 +16,6 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.Map;
-
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriParams;
http://git-wip-us.apache.org/repos/asf/camel/blob/1bfb63fd/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index 2406493..d69a458 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -114,7 +114,7 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
private Drive getClient() {
if (client == null) {
- client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES, configuration.getApplicationName());
+ client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES, configuration.getApplicationName(), configuration.getRefreshToken());
}
return client;
}
@@ -126,7 +126,7 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
public GoogleDriveClientFactory getClientFactory() {
if (clientFactory == null) {
- clientFactory = new DefaultGoogleDriveClientFactory();
+ clientFactory = new InteractiveGoogleDriveClientFactory();
}
return clientFactory;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/1bfb63fd/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
new file mode 100644
index 0000000..a3965ac
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.Collection;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.drive.Drive;
+
+public class InteractiveGoogleDriveClientFactory implements GoogleDriveClientFactory {
+ private NetHttpTransport transport;
+ private JacksonFactory jsonFactory;
+ private FileDataStoreFactory dataStoreFactory;
+ private static final java.io.File DATA_STORE_DIR = new java.io.File(".google_drive");
+
+ public InteractiveGoogleDriveClientFactory() {
+ this.transport = new NetHttpTransport();
+ this.jsonFactory = new JacksonFactory();
+ }
+
+ @Override
+ public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName, String refreshToken) {
+ Credential credential;
+ try {
+ credential = authorize(clientId, clientSecret, scopes);
+ return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * This method interactively creates the necessary authorization tokens on first run,
+ * and stores the tokens in the data store. Subsequent runs will no longer require interactivity
+ * as long as the credentials file is not removed.
+ */
+ private Credential authorize(String clientId, String clientSecret, Collection<String> scopes) throws Exception {
+ dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
+ // set up authorization code flow
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, clientId, clientSecret, scopes)
+ .setDataStoreFactory(dataStoreFactory)
+ .setAccessType("offline")
+ .build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+}
\ No newline at end of file
[21/21] git commit: Minor changes to drive component
Posted by ja...@apache.org.
Minor changes to drive component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/58a9ffb4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/58a9ffb4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/58a9ffb4
Branch: refs/heads/master
Commit: 58a9ffb4a2950c91760406aad302b53985301165
Parents: 5b2990c
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Mon Sep 8 11:26:15 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 11:26:15 2014 -0230
----------------------------------------------------------------------
components/camel-google-drive/pom.xml | 27 ++++++-
.../drive/BatchGoogleDriveClientFactory.java | 7 +-
.../google/drive/GoogleDriveComponent.java | 41 +++++++++-
.../google/drive/GoogleDriveConsumer.java | 4 +
.../google/drive/GoogleDriveEndpoint.java | 25 +------
.../google/drive/GoogleDriveFilesConverter.java | 40 ++++++++++
.../InteractiveGoogleDriveClientFactory.java | 7 +-
.../drive/FileConverterIntegrationTest.java | 73 ++++++++++++++++++
.../google/drive/FileConverterTest.java | 79 --------------------
.../src/test/resources/test-options.properties | 7 +-
10 files changed, 198 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/pom.xml b/components/camel-google-drive/pom.xml
index a0779e3..f8f817a 100644
--- a/components/camel-google-drive/pom.xml
+++ b/components/camel-google-drive/pom.xml
@@ -187,7 +187,7 @@
<apiName>drive-files</apiName>
<proxyClass>com.google.api.services.drive.Drive$Files</proxyClass>
<fromJavadoc/>
- </api>
+ </api>
<api>
<apiName>drive-parents</apiName>
<proxyClass>com.google.api.services.drive.Drive$Parents</proxyClass>
@@ -299,4 +299,29 @@
</plugins>
</reporting>
+ <profiles>
+ <profile>
+ <id>google-drive-test</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <childDelegation>false</childDelegation>
+ <useFile>true</useFile>
+ <forkMode>once</forkMode>
+ <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+ <excludes>
+ <exclude>**/*XXXTest.java</exclude>
+ </excludes>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
index bb9c883..9d62ebe 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/BatchGoogleDriveClientFactory.java
@@ -18,6 +18,9 @@ package org.apache.camel.component.google.drive;
import java.util.Collection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.http.javanet.NetHttpTransport;
@@ -25,6 +28,7 @@ import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.drive.Drive;
public class BatchGoogleDriveClientFactory implements GoogleDriveClientFactory {
+ private static final Logger LOG = LoggerFactory.getLogger(BatchGoogleDriveClientFactory.class);
private NetHttpTransport transport;
private JacksonFactory jsonFactory;
@@ -40,8 +44,7 @@ public class BatchGoogleDriveClientFactory implements GoogleDriveClientFactory {
credential = authorize(clientId, clientSecret, scopes, refreshToken);
return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOG.error("Could not create Google Drive client.", e);
}
return null;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
index c4fe472..56cc76b 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
@@ -16,20 +16,31 @@
*/
package org.apache.camel.component.google.drive;
+import java.util.Arrays;
+import java.util.List;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.util.component.AbstractApiComponent;
-import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.DriveScopes;
+
/**
* Represents the component that manages {@link GoogleDriveEndpoint}.
*/
@UriEndpoint(scheme = "google-drive", consumerClass = GoogleDriveConsumer.class, consumerPrefix = "consumer")
public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiName, GoogleDriveConfiguration, GoogleDriveApiCollection> {
-
+ private Drive client;
+ private GoogleDriveClientFactory clientFactory;
+ private List<String> scopes = DEFAULT_SCOPES;
+
+ private static final List<String> DEFAULT_SCOPES = Arrays.asList(DriveScopes.DRIVE_FILE, DriveScopes.DRIVE_APPS_READONLY, DriveScopes.DRIVE_METADATA_READONLY,
+ DriveScopes.DRIVE);
+
public GoogleDriveComponent() {
super(GoogleDriveEndpoint.class, GoogleDriveApiName.class, GoogleDriveApiCollection.getCollection());
}
@@ -43,9 +54,35 @@ public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiNam
return GoogleDriveApiName.fromValue(apiNameStr);
}
+ public Drive getClient() {
+ if (client == null) {
+ client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), scopes, configuration.getApplicationName(), configuration.getRefreshToken());
+ }
+ return client;
+ }
+
+ public GoogleDriveClientFactory getClientFactory() {
+ if (clientFactory == null) {
+ clientFactory = new BatchGoogleDriveClientFactory();
+ }
+ return clientFactory;
+ }
+
+ public void setClientFactory(GoogleDriveClientFactory clientFactory) {
+ this.clientFactory = clientFactory;
+ }
+
@Override
protected Endpoint createEndpoint(String uri, String methodName, GoogleDriveApiName apiName,
GoogleDriveConfiguration endpointConfiguration) {
return new GoogleDriveEndpoint(uri, this, apiName, methodName, endpointConfiguration);
}
+
+ private List<String> getScopes() {
+ return scopes;
+ }
+
+ private void setScopes(List<String> scopes) {
+ this.scopes = scopes;
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
index 43ef2d4..077a913 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
@@ -24,6 +24,8 @@ import org.apache.camel.RuntimeCamelException;
import org.apache.camel.util.component.AbstractApiConsumer;
import org.apache.camel.util.component.ApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
@@ -32,6 +34,8 @@ import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
*/
public class GoogleDriveConsumer extends AbstractApiConsumer<GoogleDriveApiName, GoogleDriveConfiguration> {
+ private static final Logger LOG = LoggerFactory.getLogger(BatchGoogleDriveClientFactory.class);
+
public GoogleDriveConsumer(GoogleDriveEndpoint endpoint, Processor processor) {
super(endpoint, processor);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index 66aa080..f07b90f 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -16,8 +16,6 @@
*/
package org.apache.camel.component.google.drive;
-import java.util.Arrays;
-import java.util.List;
import java.util.Map;
import org.apache.camel.Consumer;
@@ -33,7 +31,6 @@ import org.apache.camel.component.google.drive.internal.GoogleDriveConstants;
import org.apache.camel.component.google.drive.internal.GoogleDrivePropertiesHelper;
import com.google.api.services.drive.Drive;
-import com.google.api.services.drive.DriveScopes;
/**
* Represents a GoogleDrive endpoint.
@@ -41,12 +38,6 @@ import com.google.api.services.drive.DriveScopes;
@UriEndpoint(scheme = "google-drive", consumerClass = GoogleDriveConsumer.class, consumerPrefix = "consumer")
public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName, GoogleDriveConfiguration> {
private Object apiProxy;
- private Drive client;
-
- private GoogleDriveClientFactory clientFactory;
-
- private static final List<String> DEFAULT_SCOPES = Arrays.asList(DriveScopes.DRIVE_FILE, DriveScopes.DRIVE_APPS_READONLY, DriveScopes.DRIVE_METADATA_READONLY,
- DriveScopes.DRIVE);
public GoogleDriveEndpoint(String uri, GoogleDriveComponent component,
GoogleDriveApiName apiName, String methodName, GoogleDriveConfiguration endpointConfiguration) {
@@ -118,11 +109,8 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
}
}
- private Drive getClient() {
- if (client == null) {
- client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(), DEFAULT_SCOPES, configuration.getApplicationName(), configuration.getRefreshToken());
- }
- return client;
+ public Drive getClient() {
+ return ((GoogleDriveComponent)getComponent()).getClient();
}
@Override
@@ -130,14 +118,5 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
return apiProxy;
}
- public GoogleDriveClientFactory getClientFactory() {
- if (clientFactory == null) {
- clientFactory = new InteractiveGoogleDriveClientFactory();
- }
- return clientFactory;
- }
- public void setClientFactory(GoogleDriveClientFactory clientFactory) {
- this.clientFactory = clientFactory;
- }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
index 1058a10..8500377 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
@@ -17,16 +17,25 @@
package org.apache.camel.component.google.drive;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.file.GenericFile;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.api.client.http.FileContent;
+import com.google.api.client.http.GenericUrl;
+import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.InputStreamContent;
+import com.google.api.services.drive.Drive;
public final class GoogleDriveFilesConverter {
+ private static final Logger LOG = LoggerFactory.getLogger(GoogleDriveFilesConverter.class);
+
private GoogleDriveFilesConverter() {
}
@@ -60,4 +69,35 @@ public final class GoogleDriveFilesConverter {
}
return null;
}
+
+ // convenience method that takes google file metadata and converts that to an inputstream
+ @Converter
+ public static InputStream download(com.google.api.services.drive.model.File fileMetadata, Exchange exchange) throws Exception {
+ if (fileMetadata.getDownloadUrl() != null && fileMetadata.getDownloadUrl().length() > 0) {
+ try {
+ // TODO maybe separate this out as custom drive API ex. google-drive://download...
+ HttpResponse resp = getClient(exchange).getRequestFactory().buildGetRequest(new GenericUrl(fileMetadata.getDownloadUrl())).execute();
+ return resp.getContent();
+ } catch (IOException e) {
+ LOG.debug("Could not download file.", e);
+ return null;
+ }
+ } else {
+ // The file doesn't have any content stored on Drive.
+ return null;
+ }
+ }
+
+ @Converter
+ public static String downloadContentAsString(com.google.api.services.drive.model.File fileMetadata, Exchange exchange) throws Exception {
+ InputStream is = download(fileMetadata, exchange);
+ if (is != null) {
+ return exchange.getContext().getTypeConverter().convertTo(String.class, exchange, is);
+ }
+ return null;
+ }
+
+ private static Drive getClient(Exchange exchange) {
+ return exchange.getContext().getComponent("google-drive", GoogleDriveComponent.class).getClient();
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
index a3965ac..f54f55f 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/InteractiveGoogleDriveClientFactory.java
@@ -18,6 +18,9 @@ package org.apache.camel.component.google.drive;
import java.util.Collection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
@@ -28,6 +31,7 @@ import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.drive.Drive;
public class InteractiveGoogleDriveClientFactory implements GoogleDriveClientFactory {
+ private static final Logger LOG = LoggerFactory.getLogger(InteractiveGoogleDriveClientFactory.class);
private NetHttpTransport transport;
private JacksonFactory jsonFactory;
private FileDataStoreFactory dataStoreFactory;
@@ -45,8 +49,7 @@ public class InteractiveGoogleDriveClientFactory implements GoogleDriveClientFac
credential = authorize(clientId, clientSecret, scopes);
return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOG.error("Could not create Google Drive client.", e);
}
return null;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterIntegrationTest.java
new file mode 100644
index 0000000..0e7d406
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterIntegrationTest.java
@@ -0,0 +1,73 @@
+/**
+ * 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.component.google.drive;
+
+
+import java.io.InputStream;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import com.google.api.services.drive.model.File;
+import com.google.api.services.drive.model.FileList;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Files APIs.
+ */
+public class FileConverterIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FileConverterIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
+
+ @Override
+ public void setUp() throws Exception {
+ deleteDirectory("target/convertertest");
+ super.setUp();
+ }
+
+ @Test
+ public void testFileConverter() throws Exception {
+ template.sendBodyAndHeader("file://target/convertertest", "Hello!", "CamelFileName", "greeting.txt");
+
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ assertMockEndpointsSatisfied();
+
+ File file = mock.getReceivedExchanges().get(0).getIn().getBody(com.google.api.services.drive.model.File.class);
+
+ assertEquals("Hello!", context.getTypeConverter().convertTo(String.class, mock.getReceivedExchanges().get(0), file));
+
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ from("file://target/convertertest?noop=true")
+ .convertBodyTo(File.class)
+ .to("google-drive://drive-files/insert?inBody=content")
+ .to("mock:result");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java
deleted file mode 100644
index 9a0a83e..0000000
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java
+++ /dev/null
@@ -1,79 +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.component.google.drive;
-
-
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
-import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
-import org.apache.camel.component.mock.MockEndpoint;
-
-import com.google.api.services.drive.model.File;
-import com.google.api.services.drive.model.FileList;
-
-/**
- * Test class for com.google.api.services.drive.Drive$Files APIs.
- */
-public class FileConverterTest extends AbstractGoogleDriveTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(FileConverterTest.class);
- private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
-
- @Override
- public void setUp() throws Exception {
- deleteDirectory("target/convertertest");
- super.setUp();
- }
-
- @Test
- public void testConverter() throws Exception {
- template.sendBodyAndHeader("file://target/convertertest", "Hello!", "CamelFileName", "greeting.txt");
-
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMessageCount(1);
-
- assertMockEndpointsSatisfied();
-
- FileList fileList = mock.getReceivedExchanges().get(0).getIn().getBody(com.google.api.services.drive.model.FileList.class);
- assertTrue(fileInList("greeting.txt", fileList));
- }
-
- private boolean fileInList(String fileName, FileList fileList) {
- for (File f : fileList.getItems()) {
- if (f.getTitle().equals(fileName)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- from("file://target/convertertest?noop=true")
- // should convert from GenericFile to Google File here
- .to("google-drive://drive-files/insert?inBody=content")
- .to("google-drive://drive-files/list")
- .to("mock:result");
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/58a9ffb4/components/camel-google-drive/src/test/resources/test-options.properties
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/resources/test-options.properties b/components/camel-google-drive/src/test/resources/test-options.properties
index 710ec6a..445f90f 100644
--- a/components/camel-google-drive/src/test/resources/test-options.properties
+++ b/components/camel-google-drive/src/test/resources/test-options.properties
@@ -19,6 +19,7 @@
## Login properties for Google Drive Component
#####################################
## Application client id and secret
-clientId=907911893802-1tvr7lrt5f8k4sco2rigdo5kf4lfht4d.apps.googleusercontent.com
-clientSecret=g53qS_MTceqexaoZC9YtTOI4
-applicationName=camel-google-drive/1.0
\ No newline at end of file
+clientId=
+clientSecret=
+applicationName=camel-google-drive/1.0
+refreshToken=
[06/21] git commit: fix files.update testcase
Posted by ja...@apache.org.
fix files.update testcase
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e78c5c9f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e78c5c9f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e78c5c9f
Branch: refs/heads/master
Commit: e78c5c9fb87bfc48447fa34681e3367570ae8ce1
Parents: fac889f
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Sep 2 22:22:21 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:09 2014 -0230
----------------------------------------------------------------------
.../camel/component/google/drive/DriveFilesIntegrationTest.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e78c5c9f/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
index c8cd5a6..3c88d39 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
@@ -124,7 +124,7 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
@Ignore
@Test
public void testPatch() throws Exception {
- // TODO have to support setting patch parameters before callinfg execute like:
+ // TODO have to support setting patch parameters before calling execute like:
/*
File file = new File();
file.setTitle(newTitle);
@@ -197,11 +197,10 @@ public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
// File's new metadata.
file.setTitle("camel.png");
- file.setMimeType("application/vnd.google-apps.photo");
// File's new content.
java.io.File fileContent = new java.io.File(TEST_UPLOAD_IMG);
- FileContent mediaContent = new FileContent("application/vnd.google-apps.photo", fileContent);
+ FileContent mediaContent = new FileContent(null, fileContent);
// Send the request to the API.
[09/21] git commit: add google api properties
Posted by ja...@apache.org.
add google api properties
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fac889f2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fac889f2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fac889f2
Branch: refs/heads/master
Commit: fac889f2b1bdb71a0d89f02c1adf7e1a1cf55792
Parents: 556e275
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Sep 2 16:25:42 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:09 2014 -0230
----------------------------------------------------------------------
components/camel-google-drive/pom.xml | 20 +++++++-------------
parent/pom.xml | 2 ++
.../features/src/main/resources/features.xml | 14 +++++++-------
3 files changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/fac889f2/components/camel-google-drive/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/pom.xml b/components/camel-google-drive/pom.xml
index e42c35d..a0779e3 100644
--- a/components/camel-google-drive/pom.xml
+++ b/components/camel-google-drive/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-google-drive-parent</artifactId>
+ <artifactId>components</artifactId>
<version>2.14-SNAPSHOT</version>
</parent>
@@ -13,7 +13,6 @@
<packaging>bundle</packaging>
<name>Camel GoogleDrive Component</name>
<description>Camel Component for GoogleDrive</description>
- <url>http://www.myorganization.org</url>
<properties>
<schemeName>google-drive</schemeName>
@@ -28,34 +27,33 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
- <version>2.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
- <version>1.18.0-rc</version>
+ <version>${google-api-client-version}</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
- <version>1.18.0-rc</version>
+ <version>${google-api-client-version}</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
- <version>1.18.0-rc</version>
+ <version>${google-api-client-version}</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
- <version>v2-rev123-1.18.0-rc</version>
+ <version>${google-api-services-drive-version}</version>
</dependency>
<!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>spi-annotations</artifactId>
- <version>2.14-SNAPSHOT</version>
+ <version>2.14-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@@ -63,7 +61,7 @@
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
- <version>v2-rev123-1.18.0-rc</version>
+ <version>${google-api-services-drive-version}</version>
<classifier>javadoc</classifier>
<scope>provided</scope>
</dependency>
@@ -72,18 +70,15 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.7.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.17</version>
<scope>test</scope>
</dependency>
@@ -91,7 +86,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
- <version>2.14-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/camel/blob/fac889f2/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b208cc4..181041c 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -170,6 +170,8 @@
<google-gdata-version>1.41.5.w1</google-gdata-version>
<google-gdata-bundle-version>1.41.1_1</google-gdata-bundle-version>
<google-guava-version>17.0</google-guava-version>
+ <google-api-client-version>1.18.0-rc</google-api-client-version>
+ <google-api-services-drive-version>v2-rev123-1.18.0-rc</google-api-services-drive-version>
<groovy-version>2.3.6</groovy-version>
<gson-version>2.2.4</gson-version>
<guice-bundle-version>3.0_1</guice-bundle-version>
http://git-wip-us.apache.org/repos/asf/camel/blob/fac889f2/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 0d9a2b0..53759d6 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -400,13 +400,13 @@
<bundle dependency='true'>mvn:commons-codec/commons-codec/${commons-codec-version}</bundle>
<bundle dependency='true'>mvn:com.fasterxml.jackson.core/jackson-core/${jackson2-version}</bundle>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/${commons-httpclient-bundle-version}</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.api-client/google-api-client/1.18.0-rc</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.apis/google-api-services-drive/v2-rev123-1.18.0-rc</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.http-client/google-http-client-jackson2/1.18.0-rc</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client/1.18.0-rc</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client-java6/1.18.0-rc</bundle>
- <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client-jetty/1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.api-client/google-api-client/${google-api-client-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.apis/google-api-services-drive/${google-api-services-drive-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.http-client/google-http-client/${google-api-client-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.http-client/google-http-client-jackson2/${google-api-client-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client/${google-api-client-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client-java6/${google-api-client-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client-jetty/${google-api-client-version}</bundle>
<bundle>mvn:org.apache.camel/camel-google-drive/${project.version}</bundle>
</feature>
<feature name='camel-groovy' version='${project.version}' resolver='(obr)' start-level='50'>
[11/21] git commit: Fix bundle imports for camel-google-drive
Posted by ja...@apache.org.
Fix bundle imports for camel-google-drive
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/72e5aada
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/72e5aada
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/72e5aada
Branch: refs/heads/master
Commit: 72e5aada339075dab9f0431380f155d70ebd5cca
Parents: 301153b
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Fri Jul 4 17:09:06 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:09 2014 -0230
----------------------------------------------------------------------
components/camel-google-drive/pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/72e5aada/components/camel-google-drive/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/pom.xml b/components/camel-google-drive/pom.xml
index e637023..a9a5c3c 100644
--- a/components/camel-google-drive/pom.xml
+++ b/components/camel-google-drive/pom.xml
@@ -135,7 +135,8 @@
<Import-Package>
${componentPackage}.api;version=${project.version},
${componentPackage};version=${project.version},
- org.apache.camel.*;version=2.14-SNAPSHOT
+ org.apache.camel.*;version=2.14-SNAPSHOT,
+ *
</Import-Package>
<Private-Package>${outPackage}</Private-Package>
<Implementation-Title>Apache Camel</Implementation-Title>
[12/21] git commit: Add Apache license to source files
Posted by ja...@apache.org.
Add Apache license to source files
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/68530db7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/68530db7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/68530db7
Branch: refs/heads/master
Commit: 68530db799b2face971ae8e7a7b39f97cf997060
Parents: 2243e25
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Wed Sep 3 23:58:06 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:10 2014 -0230
----------------------------------------------------------------------
.../google/drive/GoogleDriveComponent.java | 16 ++
.../google/drive/GoogleDriveConfiguration.java | 16 ++
.../google/drive/GoogleDriveConsumer.java | 16 ++
.../google/drive/GoogleDriveEndpoint.java | 16 ++
.../google/drive/GoogleDriveProducer.java | 16 ++
.../drive/internal/GoogleDriveConstants.java | 16 ++
.../internal/GoogleDrivePropertiesHelper.java | 16 ++
.../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++
.../src/main/resources/META-INF/NOTICE.txt | 11 +
.../google/drive/DriveAboutIntegrationTest.java | 18 +-
.../google/drive/DriveAppsIntegrationTest.java | 18 +-
.../drive/DriveChangesIntegrationTest.java | 18 +-
.../drive/DriveCommentsIntegrationTest.java | 18 +-
.../google/drive/DriveFilesIntegrationTest.java | 18 +-
.../drive/DrivePermissionsIntegrationTest.java | 18 +-
.../drive/DrivePropertiesIntegrationTest.java | 18 +-
.../drive/DriveRepliesIntegrationTest.java | 18 +-
.../drive/DriveRevisionsIntegrationTest.java | 18 +-
.../src/test/resources/log4j.properties | 16 ++
19 files changed, 477 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
index e26b5ca..e960db9 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive;
import org.apache.camel.CamelContext;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
index df1bdf7..eb0db54 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
index c3a347b..3490c0c 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index d61c70d..852438f 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
index 1cf02cf..485cf61 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
index 870cf99..9f824f5 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive.internal;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
index 6fb132b..9c877d8 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
@@ -1,3 +1,19 @@
+/**
+ * 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.component.google.drive.internal;
import org.apache.camel.util.component.ApiMethodPropertiesHelper;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/resources/META-INF/LICENSE.txt b/components/camel-google-drive/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/components/camel-google-drive/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/resources/META-INF/NOTICE.txt b/components/camel-google-drive/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/components/camel-google-drive/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
index 8e6ca4a..af74c75 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
index 4247134..a1afd8a 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
index 9573994..c41b84f 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
index 4cb3882..0ebd0f8 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
index ddf62bf..039ea64 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
index 743522b..cc1068d 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
index e6ae4d5..63e9cc6 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePropertiesIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
index 4abab0c..acee830 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRepliesIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
index ec674c5..5a41004 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveRevisionsIntegrationTest.java
@@ -1,6 +1,18 @@
-/*
- * Camel Api Route test generated by camel-component-util-maven-plugin
- * Generated on: Thu Jul 03 16:04:18 NDT 2014
+/**
+ * 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.component.google.drive;
http://git-wip-us.apache.org/repos/asf/camel/blob/68530db7/components/camel-google-drive/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/resources/log4j.properties b/components/camel-google-drive/src/test/resources/log4j.properties
index 3b1bd38..a937abd 100644
--- a/components/camel-google-drive/src/test/resources/log4j.properties
+++ b/components/camel-google-drive/src/test/resources/log4j.properties
@@ -1,3 +1,19 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
#
# The logging properties used
#
[04/21] git commit: Update api component generation util to handle
inner classes
Posted by ja...@apache.org.
Update api component generation util to handle inner classes
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b13c88f7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b13c88f7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b13c88f7
Branch: refs/heads/master
Commit: b13c88f7c386711f014fe13ac9e71b2d86cf5f87
Parents: b80b119
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Jul 3 13:58:22 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:08 2014 -0230
----------------------------------------------------------------------
.../org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b13c88f7/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
index 6484692..b43adf6 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
@@ -84,7 +84,7 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
aClass = aClass.getSuperclass()) {
log.debug("Processing " + aClass.getName());
- final String javaDocPath = aClass.getName().replaceAll("\\.", "/") + ".html";
+ final String javaDocPath = aClass.getName().replaceAll("\\.", "/").replace('$', '.') + ".html";
// read javadoc html text for class
InputStream inputStream = null;
@@ -169,7 +169,7 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
final Method method = aClass.getMethod(name, argTypes);
int modifiers = method.getModifiers();
if (!Modifier.isStatic(modifiers) || Boolean.TRUE.equals(includeStaticMethods)) {
- result = method.getReturnType().getCanonicalName();
+ result = method.getReturnType().getName();
}
} catch (NoSuchMethodException e) {
// could be a non-public method
[10/21] git commit: Add drive component to build
Posted by ja...@apache.org.
Add drive component to build
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/61df41ee
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/61df41ee
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/61df41ee
Branch: refs/heads/master
Commit: 61df41eebda136c64faa1b765470cf43ae91c398
Parents: e78c5c9
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Sep 2 22:34:03 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:09 2014 -0230
----------------------------------------------------------------------
apache-camel/pom.xml | 4 ++++
apache-camel/src/main/descriptors/common-bin.xml | 1 +
components/pom.xml | 1 +
parent/pom.xml | 5 +++++
4 files changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/61df41ee/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 95a5601..3d90795 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -225,6 +225,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-drive</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-groovy</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/camel/blob/61df41ee/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index ea6b37a..9cd6bb8 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -69,6 +69,7 @@
<include>org.apache.camel:camel-ftp</include>
<include>org.apache.camel:camel-gae</include>
<include>org.apache.camel:camel-geocoder</include>
+ <include>org.apache.camel:camel-google-drive</include>
<include>org.apache.camel:camel-gora</include>
<include>org.apache.camel:camel-groovy</include>
<include>org.apache.camel:camel-guava-eventbus</include>
http://git-wip-us.apache.org/repos/asf/camel/blob/61df41ee/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 5fcfd61..e2d80c6 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -93,6 +93,7 @@
<module>camel-ftp</module>
<module>camel-gae</module>
<module>camel-geocoder</module>
+ <module>camel-google-drive</module>
<module>camel-gora</module>
<module>camel-gson</module>
<module>camel-guava-eventbus</module>
http://git-wip-us.apache.org/repos/asf/camel/blob/61df41ee/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 181041c..91f985f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -756,6 +756,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-drive</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-gora</artifactId>
<version>${project.version}</version>
</dependency>
[19/21] git commit: add test for working with folders
Posted by ja...@apache.org.
add test for working with folders
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b2990cb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b2990cb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b2990cb
Branch: refs/heads/master
Commit: 5b2990cbbc70575cd2db7a9b37c1308b65013c1a
Parents: 1bfb63f
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Mon Sep 8 09:06:00 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:11 2014 -0230
----------------------------------------------------------------------
.../google/drive/GoogleDriveEndpoint.java | 6 ++
.../drive/AbstractGoogleDriveTestSupport.java | 9 +++
.../drive/DriveChildrenIntegrationTest.java | 84 ++++++++++++++++++++
3 files changed, 99 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5b2990cb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
index d69a458..66aa080 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -107,6 +107,12 @@ public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName,
case DRIVE_REVISIONS:
apiProxy = getClient().revisions();
break;
+ case DRIVE_CHILDREN:
+ apiProxy = getClient().children();
+ break;
+ case DRIVE_PARENTS:
+ apiProxy = getClient().parents();
+ break;
default:
throw new IllegalArgumentException("Invalid API name " + apiName);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/5b2990cb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
index d4b5a3a..95a003c 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
@@ -67,6 +67,15 @@ public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
File result = requestBodyAndHeaders("google-drive://drive-files/insert", null, headers);
return result;
}
+
+ protected File uploadTestFolder() {
+ File fileMetadata = new File();
+ fileMetadata.setTitle("testfolder");
+ fileMetadata.setMimeType("application/vnd.google-apps.folder");
+
+ File result = requestBody("google-drive://drive-files/insert?inBody=content", fileMetadata);
+ return result;
+ }
@Override
protected CamelContext createCamelContext() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/5b2990cb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
new file mode 100644
index 0000000..9f277be
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
@@ -0,0 +1,84 @@
+/**
+ * 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.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveChildrenApiMethod;
+
+import com.google.api.services.drive.model.File;
+
+/**
+ * Test class for {@link com.google.api.services.drive.Drive$Children} APIs.
+ */
+public class DriveChildrenIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveChildrenIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChildrenApiMethod.class).getName();
+
+ @Test
+ public void testUploadFileToFolder() throws Exception {
+ File folder = uploadTestFolder();
+ File file = uploadTestFile();
+
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.folderId", folder.getId());
+
+ com.google.api.services.drive.model.ChildReference child = new com.google.api.services.drive.model.ChildReference();
+ child.setId(file.getId());
+ // parameter type is com.google.api.services.drive.model.ChildReference
+ headers.put("CamelGoogleDrive.content", child);
+
+ requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ final com.google.api.services.drive.model.ChildList result = requestBody("direct://LIST", folder.getId());
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=folderId");
+
+ }
+ };
+ }
+}
[02/21] git commit: CAMEL-7580 - Initial cut of google drive component
Posted by ja...@apache.org.
CAMEL-7580 - Initial cut of google drive component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/301153bb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/301153bb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/301153bb
Branch: refs/heads/master
Commit: 301153bb55afc839ca71e81254fc1c11cf07a6fe
Parents: 97aa19b
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Fri Jul 4 16:48:02 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:08 2014 -0230
----------------------------------------------------------------------
components/camel-google-drive/pom.xml | 308 +++++++++++++++++++
.../google/drive/GoogleDriveComponent.java | 35 +++
.../google/drive/GoogleDriveConfiguration.java | 69 +++++
.../google/drive/GoogleDriveConsumer.java | 35 +++
.../google/drive/GoogleDriveEndpoint.java | 123 ++++++++
.../google/drive/GoogleDriveProducer.java | 40 +++
.../drive/internal/GoogleDriveConstants.java | 13 +
.../internal/GoogleDrivePropertiesHelper.java | 24 ++
.../org/apache/camel/component/google-drive | 1 +
.../src/main/resources/log4j.properties | 79 +++++
.../drive/AbstractGoogleDriveTestSupport.java | 119 +++++++
.../google/drive/DriveAboutIntegrationTest.java | 49 +++
.../google/drive/DriveAppsIntegrationTest.java | 64 ++++
.../drive/DriveChangesIntegrationTest.java | 79 +++++
.../drive/DriveChannelsIntegrationTest.java | 51 +++
.../drive/DriveChildrenIntegrationTest.java | 111 +++++++
.../drive/DriveCommentsIntegrationTest.java | 155 ++++++++++
.../google/drive/DriveFilesIntegrationTest.java | 261 ++++++++++++++++
.../drive/DriveParentsIntegrationTest.java | 111 +++++++
.../drive/DrivePermissionsIntegrationTest.java | 170 ++++++++++
.../drive/DrivePropertiesIntegrationTest.java | 155 ++++++++++
.../drive/DriveRealtimeIntegrationTest.java | 86 ++++++
.../drive/DriveRepliesIntegrationTest.java | 170 ++++++++++
.../drive/DriveRevisionsIntegrationTest.java | 135 ++++++++
.../src/test/resources/log4j.properties | 14 +
25 files changed, 2457 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/pom.xml b/components/camel-google-drive/pom.xml
new file mode 100644
index 0000000..e637023
--- /dev/null
+++ b/components/camel-google-drive/pom.xml
@@ -0,0 +1,308 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-google-drive-parent</artifactId>
+ <version>2.14-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-google-drive</artifactId>
+ <packaging>bundle</packaging>
+ <name>Camel GoogleDrive Component</name>
+ <description>Camel Component for GoogleDrive</description>
+ <url>http://www.myorganization.org</url>
+
+ <properties>
+ <schemeName>google-drive</schemeName>
+ <componentName>GoogleDrive</componentName>
+ <componentPackage>org.apache.camel.component.google.drive</componentPackage>
+ <outPackage>org.apache.camel.component.google.drive.internal</outPackage>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <version>2.14-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.api-client</groupId>
+ <artifactId>google-api-client</artifactId>
+ <version>1.18.0-rc</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.oauth-client</groupId>
+ <artifactId>google-oauth-client-jetty</artifactId>
+ <version>1.18.0-rc</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.http-client</groupId>
+ <artifactId>google-http-client-jackson2</artifactId>
+ <version>1.18.0-rc</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.apis</groupId>
+ <artifactId>google-api-services-drive</artifactId>
+ <version>v2-rev123-1.18.0-rc</version>
+ </dependency>
+
+ <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>spi-annotations</artifactId>
+ <version>2.14-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Component API javadoc in provided scope to read API signatures -->
+ <dependency>
+ <groupId>com.google.apis</groupId>
+ <artifactId>google-api-services-drive</artifactId>
+ <version>v2-rev123-1.18.0-rc</version>
+ <classifier>javadoc</classifier>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.7.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>2.14-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+
+ <!-- to generate the MANIFEST-FILE of the bundle -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>Camel Component for ${componentName}</Bundle-Name>
+ <Bundle-SymbolicName>org.apache.camel.camel-google-drive</Bundle-SymbolicName>
+ <Export-Service>org.apache.camel.spi.ComponentResolver;component=${schemeName}</Export-Service>
+ <Export-Package>${componentPackage};version=${project.version}</Export-Package>
+ <Import-Package>
+ ${componentPackage}.api;version=${project.version},
+ ${componentPackage};version=${project.version},
+ org.apache.camel.*;version=2.14-SNAPSHOT
+ </Import-Package>
+ <Private-Package>${outPackage}</Private-Package>
+ <Implementation-Title>Apache Camel</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Karaf-Info>Camel;${project.artifactId}=${project.version}</Karaf-Info>
+ <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+ <_failok>false</_failok>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <!-- generate Component source and test source -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-api-component-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-component-classes</id>
+ <goals>
+ <goal>fromApis</goal>
+ </goals>
+ <configuration>
+ <apis>
+ <api>
+ <apiName>drive-about</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$About</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-apps</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Apps</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-changes</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Changes</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-channels</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Channels</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-children</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Children</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-comments</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Comments</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-files</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Files</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-parents</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Parents</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-permissions</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Permissions</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-properties</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Properties</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-realtime</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Realtime</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-replies</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Replies</proxyClass>
+ <fromJavadoc/>
+ </api>
+ <api>
+ <apiName>drive-revisions</apiName>
+ <proxyClass>com.google.api.services.drive.Drive$Revisions</proxyClass>
+ <fromJavadoc/>
+ </api>
+ </apis>
+ <substitutions>
+ <substitution>
+ <method>^.+$</method>
+ <argName>content</argName>
+ <argType>com.google.api.services.drive.model.Channel</argType>
+ <replacement>contentChannel</replacement>
+ </substitution>
+ </substitutions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- add generated source and test source to build -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>add-generated-sources</id>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/camel-component</source>
+ </sources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-generated-test-sources</id>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-test-sources/camel-component</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-api-component-maven-plugin</artifactId>
+ <version>2.14-SNAPSHOT</version>
+ <configuration>
+ <scheme>${schemeName}</scheme>
+ <componentName>${componentName}</componentName>
+ <componentPackage>${componentPackage}</componentPackage>
+ <outPackage>${outPackage}</outPackage>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-api-component-maven-plugin</artifactId>
+ <version>2.14-SNAPSHOT</version>
+ <configuration>
+ <scheme>${schemeName}</scheme>
+ <componentName>${componentName}</componentName>
+ <componentPackage>${componentPackage}</componentPackage>
+ <outPackage>${outPackage}</outPackage>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
new file mode 100644
index 0000000..e26b5ca
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
@@ -0,0 +1,35 @@
+package org.apache.camel.component.google.drive;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.util.component.AbstractApiComponent;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
+
+/**
+ * Represents the component that manages {@link GoogleDriveEndpoint}.
+ */
+@UriEndpoint(scheme = "google-drive", consumerClass = GoogleDriveConsumer.class, consumerPrefix = "consumer")
+public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiName, GoogleDriveConfiguration, GoogleDriveApiCollection> {
+
+ public GoogleDriveComponent() {
+ super(GoogleDriveEndpoint.class, GoogleDriveApiName.class, GoogleDriveApiCollection.getCollection());
+ }
+
+ public GoogleDriveComponent(CamelContext context) {
+ super(context, GoogleDriveEndpoint.class, GoogleDriveApiName.class, GoogleDriveApiCollection.getCollection());
+ }
+
+ @Override
+ protected GoogleDriveApiName getApiName(String apiNameStr) throws IllegalArgumentException {
+ return GoogleDriveApiName.fromValue(apiNameStr);
+ }
+
+ @Override
+ protected Endpoint createEndpoint(String uri, String methodName, GoogleDriveApiName apiName,
+ GoogleDriveConfiguration endpointConfiguration) {
+ return new GoogleDriveEndpoint(uri, this, apiName, methodName, endpointConfiguration);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
new file mode 100644
index 0000000..df1bdf7
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
@@ -0,0 +1,69 @@
+package org.apache.camel.component.google.drive;
+
+import java.util.Map;
+
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+/**
+ * Component configuration for GoogleDrive component.
+ */
+@UriParams
+public class GoogleDriveConfiguration {
+
+ @UriParam
+ private String clientId;
+
+ @UriParam
+ private String clientSecret;
+
+ @UriParam
+ private String accessToken;
+
+ @UriParam
+ private String refreshToken;
+
+ @UriParam
+ private String applicationName;
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public String getClientSecret() {
+ return clientSecret;
+ }
+
+ public void setClientSecret(String clientSecret) {
+ this.clientSecret = clientSecret;
+ }
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+ public String getRefreshToken() {
+ return refreshToken;
+ }
+
+ public void setRefreshToken(String refreshToken) {
+ this.refreshToken = refreshToken;
+ }
+
+ public String getApplicationName() {
+ return applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
new file mode 100644
index 0000000..c3a347b
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConsumer.java
@@ -0,0 +1,35 @@
+package org.apache.camel.component.google.drive;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.util.component.AbstractApiConsumer;
+import org.apache.camel.util.component.ApiMethod;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
+
+import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
+
+/**
+ * The GoogleDrive consumer.
+ */
+public class GoogleDriveConsumer extends AbstractApiConsumer<GoogleDriveApiName, GoogleDriveConfiguration> {
+
+ public GoogleDriveConsumer(GoogleDriveEndpoint endpoint, Processor processor) {
+ super(endpoint, processor);
+ }
+
+ @Override
+ protected Object doInvokeMethod(Map<String, Object> properties) throws RuntimeCamelException {
+ AbstractGoogleClientRequest request = (AbstractGoogleClientRequest) super.doInvokeMethod(properties);
+ // TODO set any generic params, like OAuth token, etc.
+ try {
+ return request.execute();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
new file mode 100644
index 0000000..44d4d4b
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveEndpoint.java
@@ -0,0 +1,123 @@
+package org.apache.camel.component.google.drive;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.util.component.AbstractApiEndpoint;
+import org.apache.camel.util.component.ApiMethod;
+import org.apache.camel.util.component.ApiMethodPropertiesHelper;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
+import org.apache.camel.component.google.drive.internal.GoogleDriveConstants;
+import org.apache.camel.component.google.drive.internal.GoogleDrivePropertiesHelper;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.DriveScopes;
+
+/**
+ * Represents a GoogleDrive endpoint.
+ */
+@UriEndpoint(scheme = "google-drive", consumerClass = GoogleDriveConsumer.class, consumerPrefix = "consumer")
+public class GoogleDriveEndpoint extends AbstractApiEndpoint<GoogleDriveApiName, GoogleDriveConfiguration> {
+ private Object apiProxy;
+ private Drive client;
+
+ // TODO these need to be configurable
+ private NetHttpTransport transport = new NetHttpTransport();
+ private JacksonFactory jsonFactory = new JacksonFactory();
+ private FileDataStoreFactory dataStoreFactory;
+
+ // Directory to store user credentials
+ private static final java.io.File DATA_STORE_DIR = new java.io.File(
+ System.getProperty("user.home"), ".store/drive_sample");
+
+
+
+ public GoogleDriveEndpoint(String uri, GoogleDriveComponent component,
+ GoogleDriveApiName apiName, String methodName, GoogleDriveConfiguration endpointConfiguration) {
+ super(uri, component, apiName, methodName, GoogleDriveApiCollection.getCollection().getHelper(apiName), endpointConfiguration);
+
+ }
+
+ public Producer createProducer() throws Exception {
+ return new GoogleDriveProducer(this);
+ }
+
+ public Consumer createConsumer(Processor processor) throws Exception {
+ // make sure inBody is not set for consumers
+ if (inBody != null) {
+ throw new IllegalArgumentException("Option inBody is not supported for consumer endpoint");
+ }
+ final GoogleDriveConsumer consumer = new GoogleDriveConsumer(this, processor);
+ // also set consumer.* properties
+ configureConsumer(consumer);
+ return consumer;
+ }
+
+ @Override
+ protected ApiMethodPropertiesHelper<GoogleDriveConfiguration> getPropertiesHelper() {
+ return GoogleDrivePropertiesHelper.getHelper();
+ }
+
+ protected String getThreadProfileName() {
+ return GoogleDriveConstants.THREAD_PROFILE_NAME;
+ }
+
+ // Authorizes the installed application to access user's protected data.
+ private Credential authorize() throws Exception {
+ dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
+ // set up authorization code flow
+ // TODO refresh token support too
+ GoogleAuthorizationCodeFlow flow =
+ new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, configuration.getClientId(), configuration.getClientSecret(),
+ Collections.singleton(DriveScopes.DRIVE_FILE)).setDataStoreFactory(dataStoreFactory)
+ .build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+
+
+ @Override
+ protected void afterConfigureProperties() {
+ // TODO create API proxy, set connection properties, etc.
+
+ switch ((GoogleDriveApiName) apiName) {
+ case DRIVE_FILES:
+ apiProxy = getClient().files();
+ break;
+ // TODO add extra APIs here
+ default:
+ throw new IllegalArgumentException("Invalid API name " + apiName);
+ }
+ }
+
+ public Drive getClient() {
+ if (client == null) {
+ Credential credential;
+ try {
+ credential = authorize();
+ client = new Drive.Builder(transport, jsonFactory, credential).build();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return client;
+ }
+
+ @Override
+ public Object getApiProxy(ApiMethod method, Map<String, Object> args) {
+ return apiProxy;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
new file mode 100644
index 0000000..1cf02cf
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveProducer.java
@@ -0,0 +1,40 @@
+package org.apache.camel.component.google.drive;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.util.component.AbstractApiProducer;
+import org.apache.camel.util.component.ApiMethod;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
+import org.apache.camel.component.google.drive.internal.GoogleDriveConstants;
+import org.apache.camel.component.google.drive.internal.GoogleDrivePropertiesHelper;
+
+import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
+
+/**
+ * The GoogleDrive producer.
+ */
+public class GoogleDriveProducer extends AbstractApiProducer<GoogleDriveApiName, GoogleDriveConfiguration> {
+
+ public GoogleDriveProducer(GoogleDriveEndpoint endpoint) {
+ super(endpoint, GoogleDrivePropertiesHelper.getHelper());
+ }
+
+ @Override
+ protected Object doInvokeMethod(ApiMethod method, Map<String, Object> properties) throws RuntimeCamelException {
+ AbstractGoogleClientRequest request = (AbstractGoogleClientRequest) super.doInvokeMethod(method, properties);
+ // TODO set any generic params, like OAuth token, etc.
+ try {
+ return request.execute();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ protected String getThreadProfileName() {
+ return GoogleDriveConstants.THREAD_PROFILE_NAME;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
new file mode 100644
index 0000000..870cf99
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDriveConstants.java
@@ -0,0 +1,13 @@
+package org.apache.camel.component.google.drive.internal;
+
+/**
+ * Constants for GoogleDrive component.
+ */
+public interface GoogleDriveConstants {
+
+ // suffix for parameters when passed as exchange header properties
+ String PROPERTY_PREFIX = "CamelGoogleDrive.";
+
+ // thread profile name for this component
+ String THREAD_PROFILE_NAME = "CamelGoogleDrive";
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
new file mode 100644
index 0000000..6fb132b
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/internal/GoogleDrivePropertiesHelper.java
@@ -0,0 +1,24 @@
+package org.apache.camel.component.google.drive.internal;
+
+import org.apache.camel.util.component.ApiMethodPropertiesHelper;
+
+import org.apache.camel.component.google.drive.GoogleDriveConfiguration;
+
+/**
+ * Singleton {@link ApiMethodPropertiesHelper} for GoogleDrive component.
+ */
+public final class GoogleDrivePropertiesHelper extends ApiMethodPropertiesHelper<GoogleDriveConfiguration> {
+
+ private static GoogleDrivePropertiesHelper helper;
+
+ private GoogleDrivePropertiesHelper() {
+ super(GoogleDriveConfiguration.class, GoogleDriveConstants.PROPERTY_PREFIX);
+ }
+
+ public static synchronized GoogleDrivePropertiesHelper getHelper() {
+ if (helper == null) {
+ helper = new GoogleDrivePropertiesHelper();
+ }
+ return helper;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/component/google-drive
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/component/google-drive b/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/component/google-drive
new file mode 100644
index 0000000..958560f
--- /dev/null
+++ b/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/component/google-drive
@@ -0,0 +1 @@
+class=org.apache.camel.component.google.drive.GoogleDriveComponent
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/resources/log4j.properties b/components/camel-google-drive/src/main/resources/log4j.properties
new file mode 100644
index 0000000..c3eb9f7
--- /dev/null
+++ b/components/camel-google-drive/src/main/resources/log4j.properties
@@ -0,0 +1,79 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, file
+log4j.logger.org.apache.camel.customlogger=TRACE, file2
+
+#log4j.logger.org.apache.camel.impl.converter=WARN
+#log4j.logger.org.apache.camel.management=WARN
+log4j.logger.org.apache.camel.impl.DefaultPackageScanClassResolver=WARN
+#log4j.logger.org.apache.camel.impl.converter.DefaultTypeConverter=TRACE
+#log4j.logger.org.apache.camel.impl.converter=DEBUG
+
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.builder=TRACE
+#log4j.logger.org.apache.camel.language.simple=TRACE
+#log4j.logger.org.apache.camel.component=TRACE
+#log4j.logger.org.apache.camel.component.seda=TRACE
+#log4j.logger.org.apache.camel.component.file=TRACE
+#log4j.logger.org.apache.camel.impl.DefaultUnitOfWork=TRACE
+#log4j.logger.org.apache.camel.impl.DefaultExecutorServiceManager=TRACE
+#log4j.logger.org.apache.camel.component.mock=DEBUG
+#log4j.logger.org.apache.camel.component.file=TRACE
+#log4j.logger.org.apache.camel.processor.DefaultErrorHandler=TRACE
+#log4j.logger.org.apache.camel.processor.DeadLetterChannel=TRACE
+#log4j.logger.org.apache.camel.processor.Pipeline=TRACE
+#log4j.logger.org.apache.camel.processor.MulticastProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.RecipientList=TRACE
+#log4j.logger.org.apache.camel.processor.RecipientListProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.RoutingSlip=TRACE
+#log4j.logger.org.apache.camel.processor.TryProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.loadbalancer=TRACE
+#log4j.logger.org.apache.camel.processor.Delayer=TRACE
+#log4j.logger.org.apache.camel.processor.Throttler=TRACE
+#log4j.logger.org.apache.camel.processor.aggregate.AggregateProcessor=DEBUG
+#log4j.logger.org.apache.camel.impl=TRACE
+#log4j.logger.org.apache.camel.util.FileUtil=TRACE
+#log4j.logger.org.apache.camel.util.AsyncProcessorHelper=TRACE
+#log4j.logger.org.apache.camel.util.ServiceHelper=TRACE
+#log4j.logger.org.apache.camel.util.jsse=TRACE
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.file=target/camel-core-test.log
+log4j.appender.file.append=true
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+# File appender for logging with provided logger
+log4j.appender.file2=org.apache.log4j.FileAppender
+log4j.appender.file2.layout=org.apache.log4j.PatternLayout
+log4j.appender.file2.file=target/custom-logger-test.log
+log4j.appender.file2.append=false
+log4j.appender.file2.layout.ConversionPattern=%-5p %c{1} %m%n
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
new file mode 100644
index 0000000..45f7b51
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
@@ -0,0 +1,119 @@
+/**
+ * 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.component.google.drive;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IntrospectionSupport;
+import org.junit.AfterClass;
+
+public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
+
+ protected static final String CAMEL_TEST_TAG = "camel_was_here";
+ protected static final String CAMEL_TEST_FILE = "CamelTestFile";
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+ private static final String TEST_OPTIONS_PROPERTIES = "/test-options.properties";
+ private static final String REFRESH_TOKEN_PROPERTY = "refreshToken";
+ protected static String testUserId;
+
+ private static String refreshToken;
+ private static String propertyText;
+
+ protected static String testFolderId;
+ protected static String testFileId;
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+
+ final InputStream in = getClass().getResourceAsStream(TEST_OPTIONS_PROPERTIES);
+ if (in == null) {
+ throw new IOException(TEST_OPTIONS_PROPERTIES + " could not be found");
+ }
+
+ final StringBuilder builder = new StringBuilder();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
+ String line;
+ while((line = reader.readLine()) != null) {
+ builder.append(line).append(LINE_SEPARATOR);
+ }
+ propertyText = builder.toString();
+
+ final Properties properties = new Properties();
+ try {
+ properties.load(new StringReader(propertyText));
+ } catch (IOException e) {
+ throw new IOException(String.format("%s could not be loaded: %s", TEST_OPTIONS_PROPERTIES, e.getMessage()),
+ e);
+ }
+
+ // cache test properties
+ refreshToken = properties.getProperty(REFRESH_TOKEN_PROPERTY);
+ testFolderId = properties.getProperty("testFolderId");
+ testFileId = properties.getProperty("testFileId");
+ testUserId = properties.getProperty("testUserId");
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+ options.put(entry.getKey().toString(), entry.getValue());
+ }
+
+ final GoogleDriveConfiguration configuration = new GoogleDriveConfiguration();
+ IntrospectionSupport.setProperties(configuration, options);
+
+ // add GoogleDriveComponent to Camel context
+ final CamelContext context = super.createCamelContext();
+ final GoogleDriveComponent component = new GoogleDriveComponent(context);
+
+ component.setConfiguration(configuration);
+ context.addComponent("box", component);
+
+ return context;
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ CamelTestSupport.tearDownAfterClass();
+ }
+
+ @Override
+ public boolean isCreateCamelContextPerClass() {
+ // only create the context once for this class
+ return true;
+ }
+
+ protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers)
+ throws CamelExecutionException {
+ return (T) template().requestBodyAndHeaders(endpointUri, body, headers);
+ }
+
+ protected <T> T requestBody(String endpoint, Object body) throws CamelExecutionException {
+ return (T) template().requestBody(endpoint, body);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
new file mode 100644
index 0000000..c20a9e5
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAboutIntegrationTest.java
@@ -0,0 +1,49 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveAboutApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$About APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveAboutIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveAboutIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveAboutApiMethod.class).getName();
+
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final com.google.api.services.drive.Drive.About.Get result = requestBody("direct://GET", null);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
new file mode 100644
index 0000000..ffce4fe
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveAppsIntegrationTest.java
@@ -0,0 +1,64 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveAppsApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Apps APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveAppsIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveAppsIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveAppsApiMethod.class).getName();
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ // using String message body for single parameter "appId"
+ final com.google.api.services.drive.Drive.Apps.Get result = requestBody("direct://GET", null);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ final com.google.api.services.drive.Drive.Apps.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get?inBody=appId");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
new file mode 100644
index 0000000..a6b3ea3
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChangesIntegrationTest.java
@@ -0,0 +1,79 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveChangesApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Changes APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveChangesIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveChangesIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChangesApiMethod.class).getName();
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ // using String message body for single parameter "changeId"
+ final com.google.api.services.drive.Drive.Changes.Get result = requestBody("direct://GET", null);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ final com.google.api.services.drive.Drive.Changes.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for watch
+ @Ignore
+ @Test
+ public void testWatch() throws Exception {
+ // using com.google.api.services.drive.model.Channel message body for single parameter "contentChannel"
+ final com.google.api.services.drive.Drive.Changes.Watch result = requestBody("direct://WATCH", null);
+
+ assertNotNull("watch result", result);
+ LOG.debug("watch: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get?inBody=changeId");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list");
+
+ // test route for watch
+ from("direct://WATCH")
+ .to("google-drive://" + PATH_PREFIX + "/watch?inBody=contentChannel");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java
new file mode 100644
index 0000000..dcdbff7
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChannelsIntegrationTest.java
@@ -0,0 +1,51 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveChannelsApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Channels APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveChannelsIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveChannelsIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChannelsApiMethod.class).getName();
+
+ // TODO provide parameter values for stop
+ @Ignore
+ @Test
+ public void testStop() throws Exception {
+ // using com.google.api.services.drive.model.Channel message body for single parameter "contentChannel"
+ final com.google.api.services.drive.Drive.Channels.Stop result = requestBody("direct://STOP", null);
+
+ assertNotNull("stop result", result);
+ LOG.debug("stop: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for stop
+ from("direct://STOP")
+ .to("google-drive://" + PATH_PREFIX + "/stop?inBody=contentChannel");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
new file mode 100644
index 0000000..f2ac396
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveChildrenIntegrationTest.java
@@ -0,0 +1,111 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveChildrenApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Children APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveChildrenIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveChildrenIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveChildrenApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.folderId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.childId", null);
+
+ final com.google.api.services.drive.Drive.Children.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.folderId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.childId", null);
+
+ final com.google.api.services.drive.Drive.Children.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.folderId", null);
+ // parameter type is com.google.api.services.drive.model.ChildReference
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Children.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ // using String message body for single parameter "folderId"
+ final com.google.api.services.drive.Drive.Children.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=folderId");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
new file mode 100644
index 0000000..b952a93
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveCommentsIntegrationTest.java
@@ -0,0 +1,155 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveCommentsApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Comments APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveCommentsIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveCommentsIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveCommentsApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+
+ final com.google.api.services.drive.Drive.Comments.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+
+ final com.google.api.services.drive.Drive.Comments.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.Comment
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Comments.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Comments.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for patch
+ @Ignore
+ @Test
+ public void testPatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is com.google.api.services.drive.model.Comment
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Comments.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+
+ assertNotNull("patch result", result);
+ LOG.debug("patch: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.commentId", null);
+ // parameter type is com.google.api.services.drive.model.Comment
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Comments.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=fileId");
+
+ // test route for patch
+ from("direct://PATCH")
+ .to("google-drive://" + PATH_PREFIX + "/patch");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
new file mode 100644
index 0000000..5b38298
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveFilesIntegrationTest.java
@@ -0,0 +1,261 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Files APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveFilesIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveFilesIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
+
+ // TODO provide parameter values for copy
+ @Ignore
+ @Test
+ public void testCopy() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Files.Copy result = requestBodyAndHeaders("direct://COPY", null, headers);
+
+ assertNotNull("copy result", result);
+ LOG.debug("copy: " + result);
+ }
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Files.Delete result = requestBody("direct://DELETE", null);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Files.Get result = requestBody("direct://GET", null);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ // using com.google.api.services.drive.model.File message body for single parameter "content"
+ final com.google.api.services.drive.Drive.Files.Insert result = requestBody("direct://INSERT", null);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert_1() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", null);
+ // parameter type is com.google.api.client.http.AbstractInputStreamContent
+ headers.put("CamelGoogleDrive.mediaContent", null);
+
+ final com.google.api.services.drive.Drive.Files.Insert result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ final com.google.api.services.drive.Drive.Files.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for patch
+ @Ignore
+ @Test
+ public void testPatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Files.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+
+ assertNotNull("patch result", result);
+ LOG.debug("patch: " + result);
+ }
+
+ // TODO provide parameter values for touch
+ @Ignore
+ @Test
+ public void testTouch() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Files.Touch result = requestBody("direct://TOUCH", null);
+
+ assertNotNull("touch result", result);
+ LOG.debug("touch: " + result);
+ }
+
+ // TODO provide parameter values for trash
+ @Ignore
+ @Test
+ public void testTrash() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Files.Trash result = requestBody("direct://TRASH", null);
+
+ assertNotNull("trash result", result);
+ LOG.debug("trash: " + result);
+ }
+
+ // TODO provide parameter values for untrash
+ @Ignore
+ @Test
+ public void testUntrash() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Files.Untrash result = requestBody("direct://UNTRASH", null);
+
+ assertNotNull("untrash result", result);
+ LOG.debug("untrash: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Files.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate_1() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.File
+ headers.put("CamelGoogleDrive.content", null);
+ // parameter type is com.google.api.client.http.AbstractInputStreamContent
+ headers.put("CamelGoogleDrive.mediaContent", null);
+
+ final com.google.api.services.drive.Drive.Files.Update result = requestBodyAndHeaders("direct://UPDATE_1", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ // TODO provide parameter values for watch
+ @Ignore
+ @Test
+ public void testWatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.Channel
+ headers.put("CamelGoogleDrive.contentChannel", null);
+
+ final com.google.api.services.drive.Drive.Files.Watch result = requestBodyAndHeaders("direct://WATCH", null, headers);
+
+ assertNotNull("watch result", result);
+ LOG.debug("watch: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for copy
+ from("direct://COPY")
+ .to("google-drive://" + PATH_PREFIX + "/copy");
+
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete?inBody=fileId");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get?inBody=fileId");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert?inBody=content");
+
+ // test route for insert
+ from("direct://INSERT_1")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list");
+
+ // test route for patch
+ from("direct://PATCH")
+ .to("google-drive://" + PATH_PREFIX + "/patch");
+
+ // test route for touch
+ from("direct://TOUCH")
+ .to("google-drive://" + PATH_PREFIX + "/touch?inBody=fileId");
+
+ // test route for trash
+ from("direct://TRASH")
+ .to("google-drive://" + PATH_PREFIX + "/trash?inBody=fileId");
+
+ // test route for untrash
+ from("direct://UNTRASH")
+ .to("google-drive://" + PATH_PREFIX + "/untrash?inBody=fileId");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ // test route for update
+ from("direct://UPDATE_1")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ // test route for watch
+ from("direct://WATCH")
+ .to("google-drive://" + PATH_PREFIX + "/watch");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java
new file mode 100644
index 0000000..40b1f2a
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DriveParentsIntegrationTest.java
@@ -0,0 +1,111 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveParentsApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Parents APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DriveParentsIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DriveParentsIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveParentsApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.parentId", null);
+
+ final com.google.api.services.drive.Drive.Parents.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.parentId", null);
+
+ final com.google.api.services.drive.Drive.Parents.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.ParentReference
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Parents.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Parents.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=fileId");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/301153bb/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
new file mode 100644
index 0000000..743522b
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/DrivePermissionsIntegrationTest.java
@@ -0,0 +1,170 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Thu Jul 03 16:04:18 NDT 2014
+ */
+package org.apache.camel.component.google.drive;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DrivePermissionsApiMethod;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Permissions APIs.
+ * TODO Move the file to src/test/java, populate parameter values, and remove @Ignore annotations.
+ * The class source won't be generated again if the generator MOJO finds it under src/test/java.
+ */
+public class DrivePermissionsIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DrivePermissionsIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DrivePermissionsApiMethod.class).getName();
+
+ // TODO provide parameter values for delete
+ @Ignore
+ @Test
+ public void testDelete() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.permissionId", null);
+
+ final com.google.api.services.drive.Drive.Permissions.Delete result = requestBodyAndHeaders("direct://DELETE", null, headers);
+
+ assertNotNull("delete result", result);
+ LOG.debug("delete: " + result);
+ }
+
+ // TODO provide parameter values for get
+ @Ignore
+ @Test
+ public void testGet() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.permissionId", null);
+
+ final com.google.api.services.drive.Drive.Permissions.Get result = requestBodyAndHeaders("direct://GET", null, headers);
+
+ assertNotNull("get result", result);
+ LOG.debug("get: " + result);
+ }
+
+ // TODO provide parameter values for getIdForEmail
+ @Ignore
+ @Test
+ public void testGetIdForEmail() throws Exception {
+ // using String message body for single parameter "email"
+ final com.google.api.services.drive.Drive.Permissions.GetIdForEmail result = requestBody("direct://GETIDFOREMAIL", null);
+
+ assertNotNull("getIdForEmail result", result);
+ LOG.debug("getIdForEmail: " + result);
+ }
+
+ // TODO provide parameter values for insert
+ @Ignore
+ @Test
+ public void testInsert() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is com.google.api.services.drive.model.Permission
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Permissions.Insert result = requestBodyAndHeaders("direct://INSERT", null, headers);
+
+ assertNotNull("insert result", result);
+ LOG.debug("insert: " + result);
+ }
+
+ // TODO provide parameter values for list
+ @Ignore
+ @Test
+ public void testList() throws Exception {
+ // using String message body for single parameter "fileId"
+ final com.google.api.services.drive.Drive.Permissions.List result = requestBody("direct://LIST", null);
+
+ assertNotNull("list result", result);
+ LOG.debug("list: " + result);
+ }
+
+ // TODO provide parameter values for patch
+ @Ignore
+ @Test
+ public void testPatch() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.permissionId", null);
+ // parameter type is com.google.api.services.drive.model.Permission
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Permissions.Patch result = requestBodyAndHeaders("direct://PATCH", null, headers);
+
+ assertNotNull("patch result", result);
+ LOG.debug("patch: " + result);
+ }
+
+ // TODO provide parameter values for update
+ @Ignore
+ @Test
+ public void testUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelGoogleDrive.fileId", null);
+ // parameter type is String
+ headers.put("CamelGoogleDrive.permissionId", null);
+ // parameter type is com.google.api.services.drive.model.Permission
+ headers.put("CamelGoogleDrive.content", null);
+
+ final com.google.api.services.drive.Drive.Permissions.Update result = requestBodyAndHeaders("direct://UPDATE", null, headers);
+
+ assertNotNull("update result", result);
+ LOG.debug("update: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for delete
+ from("direct://DELETE")
+ .to("google-drive://" + PATH_PREFIX + "/delete");
+
+ // test route for get
+ from("direct://GET")
+ .to("google-drive://" + PATH_PREFIX + "/get");
+
+ // test route for getIdForEmail
+ from("direct://GETIDFOREMAIL")
+ .to("google-drive://" + PATH_PREFIX + "/getIdForEmail?inBody=email");
+
+ // test route for insert
+ from("direct://INSERT")
+ .to("google-drive://" + PATH_PREFIX + "/insert");
+
+ // test route for list
+ from("direct://LIST")
+ .to("google-drive://" + PATH_PREFIX + "/list?inBody=fileId");
+
+ // test route for patch
+ from("direct://PATCH")
+ .to("google-drive://" + PATH_PREFIX + "/patch");
+
+ // test route for update
+ from("direct://UPDATE")
+ .to("google-drive://" + PATH_PREFIX + "/update");
+
+ }
+ };
+ }
+}
[13/21] git commit: add osgi itest
Posted by ja...@apache.org.
add osgi itest
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/af61f09f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/af61f09f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/af61f09f
Branch: refs/heads/master
Commit: af61f09fd47850c95032737d8acb6f4d39000cd9
Parents: 77848e1
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Sep 4 00:29:44 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:10 2014 -0230
----------------------------------------------------------------------
.../camel/itest/karaf/CamelGoogleDriveTest.java | 40 ++++++++++++++++++++
1 file changed, 40 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/af61f09f/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGoogleDriveTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGoogleDriveTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGoogleDriveTest.java
new file mode 100644
index 0000000..5b64439
--- /dev/null
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGoogleDriveTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.itest.karaf;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelGoogleDriveTest extends AbstractFeatureTest {
+
+ public static final String COMPONENT = extractName(CamelGoogleDriveTest.class);
+
+ @Test
+ public void test() throws Exception {
+ testComponent(COMPONENT);
+ }
+
+ @Configuration
+ public static Option[] configure() {
+ return configure(COMPONENT);
+ }
+
+}
[03/21] git commit: some more fixes for using inner classes
Posted by ja...@apache.org.
some more fixes for using inner classes
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/97aa19ba
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/97aa19ba
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/97aa19ba
Branch: refs/heads/master
Commit: 97aa19bab6cbea641c05ec20ef052a9df8a6ff0a
Parents: a4b235c
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Jul 3 16:08:46 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:08 2014 -0230
----------------------------------------------------------------------
.../camel/maven/AbstractApiMethodGeneratorMojo.java | 13 ++++++++++---
.../src/main/resources/api-method-enum.vm | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/97aa19ba/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
index 387fc7c..d11d894 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
@@ -117,7 +117,8 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
}
private String getEnumName() throws MojoExecutionException {
- return getProxyType().getSimpleName() + "ApiMethod";
+ String proxyClassWithCanonicalName = getProxyClassWithCanonicalName(proxyClass);
+ return proxyClassWithCanonicalName.substring(proxyClassWithCanonicalName.lastIndexOf('.') + 1) + "ApiMethod";
}
private VelocityContext getApiTestContext(List<ApiMethodParser.ApiMethodModel> models) throws MojoExecutionException {
@@ -138,7 +139,8 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
}
private String getUnitTestName() throws MojoExecutionException {
- return getProxyType().getSimpleName() + "IntegrationTest";
+ String proxyClassWithCanonicalName = getProxyClassWithCanonicalName(proxyClass);
+ return proxyClassWithCanonicalName.substring(proxyClassWithCanonicalName.lastIndexOf('.') + 1) + "IntegrationTest";
}
private VelocityContext getEndpointContext(List<ApiMethodParser.ApiMethodModel> models) throws MojoExecutionException {
@@ -199,9 +201,14 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
}
private String getConfigName() throws MojoExecutionException {
- return getProxyType().getSimpleName() + "EndpointConfiguration";
+ String proxyClassWithCanonicalName = getProxyClassWithCanonicalName(proxyClass);
+ return proxyClassWithCanonicalName.substring(proxyClassWithCanonicalName.lastIndexOf('.') + 1) + "EndpointConfiguration";
}
+ private String getProxyClassWithCanonicalName(String proxyClass) {
+ return proxyClass.replace("$", "");
+ }
+
private VelocityContext getCommonContext(List<ApiMethodParser.ApiMethodModel> models) throws MojoExecutionException {
VelocityContext context = new VelocityContext();
context.put("models", models);
http://git-wip-us.apache.org/repos/asf/camel/blob/97aa19ba/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-method-enum.vm
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-method-enum.vm b/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-method-enum.vm
index 9dab27c..9827d1e 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-method-enum.vm
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-method-enum.vm
@@ -24,7 +24,7 @@ package $packageName;
import java.lang.reflect.Method;
import java.util.List;
-import $proxyType.Name;
+import $proxyType.CanonicalName;
import org.apache.camel.util.component.ApiMethod;
import org.apache.camel.util.component.ApiMethodImpl;
[07/21] git commit: add feature for camel-google-drive
Posted by ja...@apache.org.
add feature for camel-google-drive
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/556e2754
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/556e2754
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/556e2754
Branch: refs/heads/master
Commit: 556e27545db787da05921a3257008e0243f44fb3
Parents: ffda80e
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Sep 2 16:17:00 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:09 2014 -0230
----------------------------------------------------------------------
components/camel-google-drive/pom.xml | 1 -
.../karaf/features/src/main/resources/features.xml | 14 ++++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/556e2754/components/camel-google-drive/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/pom.xml b/components/camel-google-drive/pom.xml
index a9a5c3c..e42c35d 100644
--- a/components/camel-google-drive/pom.xml
+++ b/components/camel-google-drive/pom.xml
@@ -133,7 +133,6 @@
<Export-Service>org.apache.camel.spi.ComponentResolver;component=${schemeName}</Export-Service>
<Export-Package>${componentPackage};version=${project.version}</Export-Package>
<Import-Package>
- ${componentPackage}.api;version=${project.version},
${componentPackage};version=${project.version},
org.apache.camel.*;version=2.14-SNAPSHOT,
*
http://git-wip-us.apache.org/repos/asf/camel/blob/556e2754/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index e530190..0d9a2b0 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -395,6 +395,20 @@
<bundle dependency='true'>wrap:mvn:com.google.code.geocoder-java/geocoder-java/${geocoder-java-version}</bundle>
<bundle>mvn:org.apache.camel/camel-geocoder/${project.version}</bundle>
</feature>
+ <feature name='camel-google-drive' version='${project.version}' resolver='(obr)' start-level='50'>
+ <feature version='${project.version}'>camel-core</feature>
+ <bundle dependency='true'>mvn:commons-codec/commons-codec/${commons-codec-version}</bundle>
+ <bundle dependency='true'>mvn:com.fasterxml.jackson.core/jackson-core/${jackson2-version}</bundle>
+ <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/${commons-httpclient-bundle-version}</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.api-client/google-api-client/1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.apis/google-api-services-drive/v2-rev123-1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.http-client/google-http-client-jackson2/1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client/1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client-java6/1.18.0-rc</bundle>
+ <bundle dependency='true'>wrap:mvn:com.google.oauth-client/google-oauth-client-jetty/1.18.0-rc</bundle>
+ <bundle>mvn:org.apache.camel/camel-google-drive/${project.version}</bundle>
+ </feature>
<feature name='camel-groovy' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/${ant-bundle-version}</bundle>
[18/21] git commit: Add a file comverter for Google drive files
Posted by ja...@apache.org.
Add a file comverter for Google drive files
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/30e1fdbe
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/30e1fdbe
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/30e1fdbe
Branch: refs/heads/master
Commit: 30e1fdbede2bf7e0124af73d2fbcc7972905d612
Parents: c502e15
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Sun Sep 7 23:57:38 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Sep 8 09:06:11 2014 -0230
----------------------------------------------------------------------
.../drive/DefaultGoogleDriveClientFactory.java | 10 +--
.../google/drive/GoogleDriveComponent.java | 2 +-
.../google/drive/GoogleDriveFilesConverter.java | 63 ++++++++++++++++
.../services/org/apache/camel/TypeConverter | 17 +++++
.../drive/AbstractGoogleDriveTestSupport.java | 2 +-
.../google/drive/FileConverterTest.java | 79 ++++++++++++++++++++
.../drive/FilesConsumerIntegrationTest.java | 71 ++++++++++++++++++
7 files changed, 233 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
index 876ef86..da9e796 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/DefaultGoogleDriveClientFactory.java
@@ -31,21 +31,13 @@ public class DefaultGoogleDriveClientFactory implements GoogleDriveClientFactory
private NetHttpTransport transport;
private JacksonFactory jsonFactory;
private FileDataStoreFactory dataStoreFactory;
- // TODO Directory to store user credentials
- private static final java.io.File DATA_STORE_DIR = new java.io.File(System.getProperty("user.home"), ".store/drive_sample");
+ private static final java.io.File DATA_STORE_DIR = new java.io.File(".google_drive");
public DefaultGoogleDriveClientFactory() {
this.transport = new NetHttpTransport();
this.jsonFactory = new JacksonFactory();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.camel.component.google.drive.GoogleDriveClientFactory#makeClient
- * (java.lang.String, java.lang.String, java.util.Collection)
- */
@Override
public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName) {
Credential credential;
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
index e960db9..c4fe472 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
@@ -20,7 +20,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.util.component.AbstractApiComponent;
-
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiName;
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
new file mode 100644
index 0000000..1058a10
--- /dev/null
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java
@@ -0,0 +1,63 @@
+/**
+ * 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.component.google.drive;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.camel.Converter;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.file.GenericFile;
+
+import com.google.api.client.http.FileContent;
+import com.google.api.client.http.InputStreamContent;
+
+public final class GoogleDriveFilesConverter {
+ private GoogleDriveFilesConverter() {
+ }
+
+ @Converter
+ public static com.google.api.services.drive.model.File genericFileToGoogleDriveFile(GenericFile<?> file, Exchange exchange) throws Exception {
+ if (file.getFile() instanceof File) {
+ File f = (File) file.getFile();
+ com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
+ fileMetadata.setTitle(f.getName());
+ FileContent mediaContent = new FileContent(null, f);
+ if (exchange != null) {
+ exchange.getIn().setHeader("CamelGoogleDrive.content", fileMetadata);
+ exchange.getIn().setHeader("CamelGoogleDrive.mediaContent", mediaContent);
+ }
+ return fileMetadata;
+ }
+ if (exchange != null) {
+ // body wasn't a java.io.File so let's try to convert it
+ file.getBinding().loadContent(exchange, file);
+ InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, exchange, file.getBody());
+
+ com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
+ fileMetadata.setTitle(file.getFileName());
+ InputStreamContent mediaContent = new InputStreamContent(null, is);
+ if (exchange != null) {
+ exchange.getIn().setHeader("CamelGoogleDrive.content", fileMetadata);
+ exchange.getIn().setHeader("CamelGoogleDrive.mediaContent", mediaContent);
+ }
+
+ return fileMetadata;
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
new file mode 100644
index 0000000..ec2888d
--- /dev/null
+++ b/components/camel-google-drive/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+org.apache.camel.component.google.drive.GoogleDriveFilesConverter
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
index 17b8ee1..d4b5a3a 100644
--- a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
@@ -64,7 +64,7 @@ public abstract class AbstractGoogleDriveTestSupport extends CamelTestSupport {
// parameter type is com.google.api.client.http.AbstractInputStreamContent
headers.put("CamelGoogleDrive.mediaContent", mediaContent);
- File result = requestBodyAndHeaders("direct://INSERT_1", null, headers);
+ File result = requestBodyAndHeaders("google-drive://drive-files/insert", null, headers);
return result;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java
new file mode 100644
index 0000000..9a0a83e
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FileConverterTest.java
@@ -0,0 +1,79 @@
+/**
+ * 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.component.google.drive;
+
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import com.google.api.services.drive.model.File;
+import com.google.api.services.drive.model.FileList;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Files APIs.
+ */
+public class FileConverterTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FileConverterTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
+
+ @Override
+ public void setUp() throws Exception {
+ deleteDirectory("target/convertertest");
+ super.setUp();
+ }
+
+ @Test
+ public void testConverter() throws Exception {
+ template.sendBodyAndHeader("file://target/convertertest", "Hello!", "CamelFileName", "greeting.txt");
+
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ assertMockEndpointsSatisfied();
+
+ FileList fileList = mock.getReceivedExchanges().get(0).getIn().getBody(com.google.api.services.drive.model.FileList.class);
+ assertTrue(fileInList("greeting.txt", fileList));
+ }
+
+ private boolean fileInList(String fileName, FileList fileList) {
+ for (File f : fileList.getItems()) {
+ if (f.getTitle().equals(fileName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ from("file://target/convertertest?noop=true")
+ // should convert from GenericFile to Google File here
+ .to("google-drive://drive-files/insert?inBody=content")
+ .to("google-drive://drive-files/list")
+ .to("mock:result");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/30e1fdbe/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FilesConsumerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FilesConsumerIntegrationTest.java b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FilesConsumerIntegrationTest.java
new file mode 100644
index 0000000..55dd5f4
--- /dev/null
+++ b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/FilesConsumerIntegrationTest.java
@@ -0,0 +1,71 @@
+/**
+ * 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.component.google.drive;
+
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
+import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import com.google.api.services.drive.model.File;
+import com.google.api.services.drive.model.FileList;
+
+/**
+ * Test class for com.google.api.services.drive.Drive$Files APIs.
+ */
+public class FilesConsumerIntegrationTest extends AbstractGoogleDriveTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FilesConsumerIntegrationTest.class);
+ private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
+
+ @Test
+ public void testListConsumer() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ File testFile = uploadTestFile();
+ String fileId = testFile.getId();
+
+ assertMockEndpointsSatisfied();
+
+ FileList fileList = mock.getReceivedExchanges().get(0).getIn().getBody(com.google.api.services.drive.model.FileList.class);
+ assertTrue(fileInList(fileId, fileList));
+
+ }
+
+ private boolean fileInList(String fileId, FileList fileList) {
+ for (File f : fileList.getItems()) {
+ if (f.getId().equals(fileId)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ from("google-drive://drive-files/list").to("mock:result");
+ }
+ };
+ }
+}