This is an automated email from the ASF dual-hosted git repository.

srdo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 5438a01  STORM-3465: examples-redis: fix all checkstyle warnings
     new 65d545e  Merge pull request #3083 from 
krichter722/checkstyle-redis-examples
5438a01 is described below

commit 5438a0157eb0cfeb87ffa66633b23286fcc806fe
Author: Karl-Philipp Richter <krich...@posteo.de>
AuthorDate: Sat Jul 6 18:39:42 2019 +0200

    STORM-3465: examples-redis: fix all checkstyle warnings
---
 examples/storm-redis-examples/pom.xml                         |  2 +-
 .../storm/redis/tools/Base64ToBinaryStateMigrationUtil.java   |  1 -
 .../java/org/apache/storm/redis/topology/LookupWordCount.java | 11 ++++++-----
 .../org/apache/storm/redis/topology/PersistentWordCount.java  |  4 ++--
 .../org/apache/storm/redis/topology/WhitelistWordCount.java   |  8 ++++----
 .../java/org/apache/storm/redis/topology/WordCounter.java     |  8 +++++---
 .../main/java/org/apache/storm/redis/topology/WordSpout.java  |  9 +++++----
 .../java/org/apache/storm/redis/trident/PrintFunction.java    | 10 ++++++----
 .../org/apache/storm/redis/trident/WordCountLookupMapper.java | 11 ++++++-----
 .../org/apache/storm/redis/trident/WordCountStoreMapper.java  |  3 ++-
 .../org/apache/storm/redis/trident/WordCountTridentRedis.java |  4 +++-
 .../storm/redis/trident/WordCountTridentRedisCluster.java     |  8 +++++---
 .../storm/redis/trident/WordCountTridentRedisClusterMap.java  |  8 +++++---
 .../apache/storm/redis/trident/WordCountTridentRedisMap.java  |  4 +++-
 14 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/examples/storm-redis-examples/pom.xml 
b/examples/storm-redis-examples/pom.xml
index 1a8914f..4ec2347 100644
--- a/examples/storm-redis-examples/pom.xml
+++ b/examples/storm-redis-examples/pom.xml
@@ -91,7 +91,7 @@
                 <artifactId>maven-checkstyle-plugin</artifactId>
                 <!--Note - the version would be inherited-->
                 <configuration>
-                    <maxAllowedViolations>54</maxAllowedViolations>
+                    <maxAllowedViolations>0</maxAllowedViolations>
                 </configuration>
             </plugin>
             <plugin>
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/tools/Base64ToBinaryStateMigrationUtil.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/tools/Base64ToBinaryStateMigrationUtil.java
index 68bf9dd..9f060b8 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/tools/Base64ToBinaryStateMigrationUtil.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/tools/Base64ToBinaryStateMigrationUtil.java
@@ -38,7 +38,6 @@ import org.slf4j.LoggerFactory;
 
 import redis.clients.util.SafeEncoder;
 
-
 public class Base64ToBinaryStateMigrationUtil {
     private static final Logger LOG = 
LoggerFactory.getLogger(Base64ToBinaryStateMigrationUtil.class);
     private static final String OPTION_REDIS_HOST_SHORT = "h";
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/LookupWordCount.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/LookupWordCount.java
index 475bbab..54456ec 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/LookupWordCount.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/LookupWordCount.java
@@ -15,8 +15,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.topology;
 
+import com.google.common.collect.Lists;
+
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -36,11 +39,10 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.ITuple;
 import org.apache.storm.tuple.Tuple;
 import org.apache.storm.tuple.Values;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.Lists;
-
 public class LookupWordCount {
     private static final String WORD_SPOUT = "WORD_SPOUT";
     private static final String LOOKUP_BOLT = "LOOKUP_BOLT";
@@ -65,7 +67,7 @@ public class LookupWordCount {
             String countStr = input.getStringByField("count");
 
             // print lookup result with low probability
-            if(RANDOM.nextInt(1000) > 995) {
+            if (RANDOM.nextInt(1000) > 995) {
                 int count = 0;
                 if (countStr != null) {
                     count = Integer.parseInt(countStr);
@@ -82,8 +84,6 @@ public class LookupWordCount {
     }
 
     public static void main(String[] args) throws Exception {
-        Config config = new Config();
-
         String host = TEST_REDIS_HOST;
         int port = TEST_REDIS_PORT;
 
@@ -114,6 +114,7 @@ public class LookupWordCount {
             System.out.println("Usage: LookupWordCount <redis host> <redis 
port> (topology name)");
             return;
         }
+        Config config = new Config();
         StormSubmitter.submitTopology(topoName, config, 
builder.createTopology());
     }
 
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/PersistentWordCount.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/PersistentWordCount.java
index 4c7b0dc..eca75ea 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/PersistentWordCount.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/PersistentWordCount.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.topology;
 
 import org.apache.storm.Config;
@@ -36,8 +37,6 @@ public class PersistentWordCount {
     private static final int TEST_REDIS_PORT = 6379;
 
     public static void main(String[] args) throws Exception {
-        Config config = new Config();
-
         String host = TEST_REDIS_HOST;
         int port = TEST_REDIS_PORT;
 
@@ -68,6 +67,7 @@ public class PersistentWordCount {
             System.out.println("Usage: PersistentWordCount <redis host> <redis 
port> (topology name)");
             return;
         }
+        Config config = new Config();
         StormSubmitter.submitTopology(topoName, config, 
builder.createTopology());
     }
 
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WhitelistWordCount.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WhitelistWordCount.java
index 9999afe..8640335 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WhitelistWordCount.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WhitelistWordCount.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.topology;
 
 import java.util.Map;
@@ -62,7 +63,7 @@ public class WhitelistWordCount {
             String countStr = input.getStringByField("count");
 
             // print lookup result with low probability
-            if(RANDOM.nextInt(1000) > 995) {
+            if (RANDOM.nextInt(1000) > 995) {
                 int count = 0;
                 if (countStr != null) {
                     count = Integer.parseInt(countStr);
@@ -79,8 +80,6 @@ public class WhitelistWordCount {
     }
 
     public static void main(String[] args) throws Exception {
-        Config config = new Config();
-
         String host = TEST_REDIS_HOST;
         int port = TEST_REDIS_PORT;
 
@@ -96,12 +95,12 @@ public class WhitelistWordCount {
         RedisFilterMapper filterMapper = setupWhitelistMapper();
         RedisFilterBolt whitelistBolt = new RedisFilterBolt(poolConfig, 
filterMapper);
         WordCounter wordCounterBolt = new WordCounter();
-        PrintWordTotalCountBolt printBolt = new PrintWordTotalCountBolt();
 
         TopologyBuilder builder = new TopologyBuilder();
         builder.setSpout(WORD_SPOUT, spout, 1);
         builder.setBolt(WHITELIST_BOLT, whitelistBolt, 
1).shuffleGrouping(WORD_SPOUT);
         builder.setBolt(COUNT_BOLT, wordCounterBolt, 
1).fieldsGrouping(WHITELIST_BOLT, new Fields("word"));
+        PrintWordTotalCountBolt printBolt = new PrintWordTotalCountBolt();
         builder.setBolt(PRINT_BOLT, printBolt, 1).shuffleGrouping(COUNT_BOLT);
 
         String topoName = "test";
@@ -111,6 +110,7 @@ public class WhitelistWordCount {
             System.out.println("Usage: WhitelistWordCount <redis host> <redis 
port> [topology name]");
             return;
         }
+        Config config = new Config();
         StormSubmitter.submitTopology(topoName, config, 
builder.createTopology());
     }
 
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordCounter.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordCounter.java
index 8595d1e..a0b9714 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordCounter.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordCounter.java
@@ -15,8 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.topology;
 
+import com.google.common.collect.Maps;
+
+import java.util.Map;
+
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.BasicOutputCollector;
 import org.apache.storm.topology.IBasicBolt;
@@ -24,9 +29,6 @@ import org.apache.storm.topology.OutputFieldsDeclarer;
 import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Tuple;
 import org.apache.storm.tuple.Values;
-import com.google.common.collect.Maps;
-
-import java.util.Map;
 
 public class WordCounter implements IBasicBolt {
     private Map<String, Integer> wordCounter = Maps.newHashMap();
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordSpout.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordSpout.java
index a387762..ff3ec39 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordSpout.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/topology/WordSpout.java
@@ -15,8 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.topology;
 
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
+
 import org.apache.storm.spout.SpoutOutputCollector;
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.IRichSpout;
@@ -24,10 +29,6 @@ import org.apache.storm.topology.OutputFieldsDeclarer;
 import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Values;
 
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-
 public class WordSpout implements IRichSpout {
     boolean isDistributed;
     SpoutOutputCollector collector;
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/PrintFunction.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/PrintFunction.java
index 37d3936..f32cfe8 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/PrintFunction.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/PrintFunction.java
@@ -15,15 +15,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.Random;
+
 import org.apache.storm.trident.operation.BaseFunction;
 import org.apache.storm.trident.operation.TridentCollector;
 import org.apache.storm.trident.tuple.TridentTuple;
 
-import java.util.Random;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class PrintFunction extends BaseFunction {
 
@@ -33,7 +35,7 @@ public class PrintFunction extends BaseFunction {
 
     @Override
     public void execute(TridentTuple tuple, TridentCollector tridentCollector) 
{
-        if(RANDOM.nextInt(1000) > 995) {
+        if (RANDOM.nextInt(1000) > 995) {
             LOG.info(tuple.toString());
         }
     }
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountLookupMapper.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountLookupMapper.java
index a6ca8c9..04874d5 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountLookupMapper.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountLookupMapper.java
@@ -15,17 +15,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.storm.redis.common.mapper.RedisDataTypeDescription;
+import org.apache.storm.redis.common.mapper.RedisLookupMapper;
 import org.apache.storm.topology.OutputFieldsDeclarer;
 import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.ITuple;
 import org.apache.storm.tuple.Values;
-import org.apache.storm.redis.common.mapper.RedisDataTypeDescription;
-import org.apache.storm.redis.common.mapper.RedisLookupMapper;
-
-import java.util.ArrayList;
-import java.util.List;
 
 public class WordCountLookupMapper implements RedisLookupMapper {
     @Override
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountStoreMapper.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountStoreMapper.java
index 58df150..84538e2 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountStoreMapper.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountStoreMapper.java
@@ -15,11 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
-import org.apache.storm.tuple.ITuple;
 import org.apache.storm.redis.common.mapper.RedisDataTypeDescription;
 import org.apache.storm.redis.common.mapper.RedisStoreMapper;
+import org.apache.storm.tuple.ITuple;
 
 public class WordCountStoreMapper implements RedisStoreMapper {
     @Override
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedis.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedis.java
index c162ca6..b571635 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedis.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedis.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
 import org.apache.storm.Config;
@@ -34,7 +35,8 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Values;
 
 public class WordCountTridentRedis {
-    public static StormTopology buildTopology(String redisHost, Integer 
redisPort){
+
+    public static StormTopology buildTopology(String redisHost, Integer 
redisPort) {
         Fields fields = new Fields("word", "count");
         FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                 new Values("storm", 1),
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisCluster.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisCluster.java
index 687ac54..be515d8 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisCluster.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisCluster.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
 import java.net.InetSocketAddress;
@@ -38,7 +39,8 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Values;
 
 public class WordCountTridentRedisCluster {
-    public static StormTopology buildTopology(String redisHostPort){
+
+    public static StormTopology buildTopology(String redisHostPort) {
         Fields fields = new Fields("word", "count");
         FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                 new Values("storm", 1),
@@ -50,8 +52,8 @@ public class WordCountTridentRedisCluster {
 
         Set<InetSocketAddress> nodes = new HashSet<InetSocketAddress>();
         for (String hostPort : redisHostPort.split(",")) {
-            String[] host_port = hostPort.split(":");
-            nodes.add(new InetSocketAddress(host_port[0], 
Integer.valueOf(host_port[1])));
+            String[] hostPortSplit = hostPort.split(":");
+            nodes.add(new InetSocketAddress(hostPortSplit[0], 
Integer.valueOf(hostPortSplit[1])));
         }
         JedisClusterConfig clusterConfig = new 
JedisClusterConfig.Builder().setNodes(nodes)
                                         .build();
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisClusterMap.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisClusterMap.java
index 8cf0f3c..b1425c9 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisClusterMap.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisClusterMap.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
 import java.net.InetSocketAddress;
@@ -38,7 +39,8 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Values;
 
 public class WordCountTridentRedisClusterMap {
-    public static StormTopology buildTopology(String redisHostPort){
+
+    public static StormTopology buildTopology(String redisHostPort) {
         Fields fields = new Fields("word", "count");
         FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                 new Values("storm", 1),
@@ -50,8 +52,8 @@ public class WordCountTridentRedisClusterMap {
 
         Set<InetSocketAddress> nodes = new HashSet<InetSocketAddress>();
         for (String hostPort : redisHostPort.split(",")) {
-            String[] host_port = hostPort.split(":");
-            nodes.add(new InetSocketAddress(host_port[0], 
Integer.valueOf(host_port[1])));
+            String[] hostPortSplit = hostPort.split(":");
+            nodes.add(new InetSocketAddress(hostPortSplit[0], 
Integer.valueOf(hostPortSplit[1])));
         }
         JedisClusterConfig clusterConfig = new 
JedisClusterConfig.Builder().setNodes(nodes)
                                         .build();
diff --git 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisMap.java
 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisMap.java
index dac0a4d..2a7af97 100644
--- 
a/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisMap.java
+++ 
b/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountTridentRedisMap.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.redis.trident;
 
 import org.apache.storm.Config;
@@ -34,7 +35,8 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Values;
 
 public class WordCountTridentRedisMap {
-    public static StormTopology buildTopology(String redisHost, Integer 
redisPort){
+
+    public static StormTopology buildTopology(String redisHost, Integer 
redisPort) {
         Fields fields = new Fields("word", "count");
         FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                 new Values("storm", 1),

Reply via email to