camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject [17/21] git commit: Ensure application name is set on drive client
Date Mon, 08 Sep 2014 13:57:54 GMT
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 <janstey@gmail.com>
Authored: Fri Sep 5 00:26:01 2014 -0230
Committer: Jonathan Anstey <janstey@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 {
 


Mime
View raw message