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 fe41f8d  STORM-3464: examples-mongodb: fix all checkstyle warnings
     new bc42472  Merge pull request #3082 from 
krichter722/checkstyle-mongodb-examples
fe41f8d is described below

commit fe41f8d02f80971a06e89d1095397a201888dbfb
Author: Karl-Philipp Richter <krich...@posteo.de>
AuthorDate: Sat Jul 6 18:30:38 2019 +0200

    STORM-3464: examples-mongodb: fix all checkstyle warnings
---
 examples/storm-mongodb-examples/pom.xml                  |  2 +-
 .../apache/storm/mongodb/topology/InsertWordCount.java   |  4 ++--
 .../apache/storm/mongodb/topology/LookupWordCount.java   |  6 +++---
 .../apache/storm/mongodb/topology/TotalWordCounter.java  | 16 +++++++++-------
 .../apache/storm/mongodb/topology/UpdateWordCount.java   |  4 ++--
 .../org/apache/storm/mongodb/topology/WordCounter.java   |  8 +++++---
 .../org/apache/storm/mongodb/topology/WordSpout.java     |  9 +++++----
 .../org/apache/storm/mongodb/trident/PrintFunction.java  |  7 ++++---
 .../apache/storm/mongodb/trident/WordCountTrident.java   |  3 ++-
 .../storm/mongodb/trident/WordCountTridentMap.java       |  8 ++++----
 10 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/examples/storm-mongodb-examples/pom.xml 
b/examples/storm-mongodb-examples/pom.xml
index faecbed..3766f7e 100644
--- a/examples/storm-mongodb-examples/pom.xml
+++ b/examples/storm-mongodb-examples/pom.xml
@@ -87,7 +87,7 @@
                 <artifactId>maven-checkstyle-plugin</artifactId>
                 <!--Note - the version would be inherited-->
                 <configuration>
-                    <maxAllowedViolations>38</maxAllowedViolations>
+                    <maxAllowedViolations>0</maxAllowedViolations>
                 </configuration>
             </plugin>
             <plugin>
diff --git 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/InsertWordCount.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/InsertWordCount.java
index 3b27fd1..f877fca 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/InsertWordCount.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/InsertWordCount.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.topology;
 
 import org.apache.storm.Config;
@@ -35,8 +36,6 @@ public class InsertWordCount {
     
 
     public static void main(String[] args) throws Exception {
-        Config config = new Config();
-
         String url = TEST_MONGODB_URL;
         String collectionName = TEST_MONGODB_COLLECTION_NAME;
 
@@ -67,6 +66,7 @@ public class InsertWordCount {
             System.out.println("Usage: InsertWordCount <mongodb url> <mongodb 
collection> [topology name]");
             return;
         }
+        Config config = new Config();
         StormSubmitter.submitTopology(topoName, config, 
builder.createTopology());
     }
 }
diff --git 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/LookupWordCount.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/LookupWordCount.java
index c9d43bd..6aaec42 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/LookupWordCount.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/LookupWordCount.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.topology;
 
 import org.apache.storm.Config;
@@ -36,8 +37,6 @@ public class LookupWordCount {
     private static final String TEST_MONGODB_COLLECTION_NAME = "wordcount";
 
     public static void main(String[] args) throws Exception {
-        Config config = new Config();
-
         String url = TEST_MONGODB_URL;
         String collectionName = TEST_MONGODB_COLLECTION_NAME;
 
@@ -70,7 +69,8 @@ public class LookupWordCount {
             System.out.println("Usage: LookupWordCount <mongodb url> <mongodb 
collection> [topology name]");
             return;
         }
-        
+
+        Config config = new Config();
         StormSubmitter.submitTopology(topoName, config, 
builder.createTopology());
     }
 }
diff --git 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/TotalWordCounter.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/TotalWordCounter.java
index b5d20cb..148f2f9 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/TotalWordCounter.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/TotalWordCounter.java
@@ -15,8 +15,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.topology;
 
+import static org.apache.storm.utils.Utils.tuple;
+
+import java.math.BigInteger;
+import java.util.Map;
+import java.util.Random;
+
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.BasicOutputCollector;
 import org.apache.storm.topology.IBasicBolt;
@@ -26,17 +33,12 @@ import org.apache.storm.tuple.Tuple;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.math.BigInteger;
-import java.util.Map;
-import java.util.Random;
-
-import static org.apache.storm.utils.Utils.tuple;
-
 public class TotalWordCounter implements IBasicBolt {
 
     private BigInteger total = BigInteger.ZERO;
     private static final Logger LOG = 
LoggerFactory.getLogger(TotalWordCounter.class);
     private static final Random RANDOM = new Random();
+
     @Override
     public void prepare(Map<String, Object> topoConf, TopologyContext context) 
{
     }
@@ -49,7 +51,7 @@ public class TotalWordCounter implements IBasicBolt {
         total = total.add(new BigInteger(input.getValues().get(1).toString()));
         collector.emit(tuple(total.toString()));
         //prints the total with low probability.
-        if(RANDOM.nextInt(1000) > 995) {
+        if (RANDOM.nextInt(1000) > 995) {
             LOG.info("Running total = " + total);
         }
     }
diff --git 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/UpdateWordCount.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/UpdateWordCount.java
index 8e4f757..54205ea 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/UpdateWordCount.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/UpdateWordCount.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.topology;
 
 import org.apache.storm.Config;
@@ -37,8 +38,6 @@ public class UpdateWordCount {
     
 
     public static void main(String[] args) throws Exception {
-        Config config = new Config();
-
         String url = TEST_MONGODB_URL;
         String collectionName = TEST_MONGODB_COLLECTION_NAME;
 
@@ -78,6 +77,7 @@ public class UpdateWordCount {
             System.out.println("Usage: UpdateWordCount <mongodb url> <mongodb 
collection> [topology name]");
             return;
         }
+        Config config = new Config();
         StormSubmitter.submitTopology(topoName, config, 
builder.createTopology());
     }
 }
diff --git 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/WordCounter.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/WordCounter.java
index ec96346..05c04bc 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/WordCounter.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/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.mongodb.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-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/WordSpout.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/WordSpout.java
index aa14373..96cab5e 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/WordSpout.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/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.mongodb.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-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/PrintFunction.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/PrintFunction.java
index 3db91f9..66410f3 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/PrintFunction.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/PrintFunction.java
@@ -15,16 +15,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.trident;
 
+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 org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Random;
-
 public class PrintFunction extends BaseFunction {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(PrintFunction.class);
@@ -33,7 +34,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-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTrident.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTrident.java
index ef5a39a..858ea53 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTrident.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTrident.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.trident;
 
 import org.apache.storm.Config;
@@ -36,7 +37,7 @@ import org.apache.storm.tuple.Values;
 
 public class WordCountTrident {
 
-    public static StormTopology buildTopology(String url, String 
collectionName){
+    public static StormTopology buildTopology(String url, String 
collectionName) {
         Fields fields = new Fields("word", "count");
         FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                 new Values("storm", 1),
diff --git 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTridentMap.java
 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTridentMap.java
index 0ff2c51..18f79dc 100644
--- 
a/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTridentMap.java
+++ 
b/examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/trident/WordCountTridentMap.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.storm.mongodb.trident;
 
 import org.apache.storm.Config;
@@ -37,7 +38,7 @@ import org.apache.storm.tuple.Values;
 
 public class WordCountTridentMap {
 
-    public static StormTopology buildTopology(String url, String 
collectionName){
+    public static StormTopology buildTopology(String url, String 
collectionName) {
         Fields fields = new Fields("word", "count");
         FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                 new Values("storm", 1),
@@ -50,13 +51,12 @@ public class WordCountTridentMap {
         MongoMapper mapper = new SimpleMongoMapper()
                 .withFields("word", "count");
 
-        QueryFilterCreator filterCreator = new SimpleQueryFilterCreator()
-                .withField("word");
-
         MongoMapState.Options options = new MongoMapState.Options();
         options.url = url;
         options.collectionName = collectionName;
         options.mapper = mapper;
+        QueryFilterCreator filterCreator = new SimpleQueryFilterCreator()
+                .withField("word");
         options.queryCreator = filterCreator;
 
         StateFactory factory = MongoMapState.transactional(options);

Reply via email to