streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject [streams] 01/01: STREAMS-552
Date Mon, 04 Dec 2017 20:54:37 GMT
This is an automated email from the ASF dual-hosted git repository.

sblackmon pushed a commit to branch STREAMS-552
in repository https://gitbox.apache.org/repos/asf/streams.git

commit c77a617febaa5e9889ce9a94db6cba263295457c
Author: Steve Blackmon @steveblackmon <sblackmon@apache.org>
AuthorDate: Mon Dec 4 14:42:09 2017 -0600

    STREAMS-552
    
    STREAMS-552: Disable .debug() by default in org.apache.streams.twitter.api.Twitter (https://issues.apache.org/jira/browse/STREAMS-552)
---
 .../main/java/org/apache/streams/twitter/api/Twitter.java   | 13 +++++++++----
 .../apache/streams/twitter/config/TwitterConfiguration.json |  8 ++++++++
 .../src/main/resources/reference.conf                       |  1 +
 .../src/test/resources/TwitterIT.conf                       |  1 +
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/api/Twitter.java
b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/api/Twitter.java
index 1ba580d..679e6b1 100644
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/api/Twitter.java
+++ b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/api/Twitter.java
@@ -81,6 +81,8 @@ public class Twitter implements Account, AccountActivity, DirectMessages,
Favori
     properties.put("format", TwitterDateTimeFormat.TWITTER_FORMAT);
   }
 
+  RestClientBuilder restClientBuilder;
+
   RestClient restClient;
 
   private Twitter(TwitterConfiguration configuration) throws InstantiationException {
@@ -102,8 +104,7 @@ public class Twitter implements Account, AccountActivity, DirectMessages,
Favori
       .addInterceptorLast((HttpRequestInterceptor) (httpRequest, httpContext) -> LOGGER.debug(httpRequest.getRequestLine().getUri()))
       .addInterceptorLast((HttpResponseInterceptor) (httpResponse, httpContext) -> LOGGER.debug(httpResponse.getStatusLine().toString()))
       .build();
-    this.restClient = new RestClientBuilder()
-      .debug()
+    this.restClientBuilder = new RestClientBuilder()
       .httpClient(httpclient, true)
       .parser(
         JsonParser.DEFAULT.builder()
@@ -120,8 +121,12 @@ public class Twitter implements Account, AccountActivity, DirectMessages,
Favori
       .retryable(
         configuration.getRetryMax().intValue(),
         configuration.getRetrySleepMs(),
-        new TwitterRetryHandler())
-      .build();
+        new TwitterRetryHandler());
+    if( configuration.getDebug() ) {
+      restClientBuilder = restClientBuilder.debug();
+    }
+
+    this.restClient = restClientBuilder.build();
     this.mapper = StreamsJacksonMapper.getInstance();
   }
 
diff --git a/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/TwitterConfiguration.json
b/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/TwitterConfiguration.json
index d69468f..975b0bf 100644
--- a/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/TwitterConfiguration.json
+++ b/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/TwitterConfiguration.json
@@ -24,10 +24,18 @@
             "type": "string",
             "description": "The version"
         },
+        "debug": {
+            "type": "boolean",
+            "description": "Whether to enable juneau debug logging"
+        },
         "endpoint": {
             "type": "string",
             "description": "The endpoint"
         },
+        "environment": {
+            "type": "string",
+            "description": "The environment"
+        },
         "jsonStoreEnabled": {
             "type": "boolean"
         },
diff --git a/streams-contrib/streams-provider-twitter/src/main/resources/reference.conf b/streams-contrib/streams-provider-twitter/src/main/resources/reference.conf
index 0a9a2bd..4229ffa 100644
--- a/streams-contrib/streams-provider-twitter/src/main/resources/reference.conf
+++ b/streams-contrib/streams-provider-twitter/src/main/resources/reference.conf
@@ -12,6 +12,7 @@ twitter {
     }
     with = "user"
     replies = "all"
+    debug = false
     threadsPerProvider = 10
     retrySleepMs = 1000
     retryMax = 10
diff --git a/streams-contrib/streams-provider-twitter/src/test/resources/TwitterIT.conf b/streams-contrib/streams-provider-twitter/src/test/resources/TwitterIT.conf
index a1f90fe..b274137 100644
--- a/streams-contrib/streams-provider-twitter/src/test/resources/TwitterIT.conf
+++ b/streams-contrib/streams-provider-twitter/src/test/resources/TwitterIT.conf
@@ -16,6 +16,7 @@
 # under the License.
 include "../../../../twitter.conf"
 twitter {
+  debug = true
   retrySleepMs = 100
   retryMax = 1
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@streams.apache.org" <commits@streams.apache.org>.

Mime
View raw message