You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by krichter722 <gi...@git.apache.org> on 2018/03/19 01:26:00 UTC

[GitHub] storm pull request #2597: storm-mqtt-examples: fixed all checkstyle warnings

GitHub user krichter722 opened a pull request:

    https://github.com/apache/storm/pull/2597

    storm-mqtt-examples: fixed all checkstyle warnings

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/krichter722/storm checkstyle-fix-mqtt-examples

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/2597.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2597
    
----
commit e312bee882532343e74e90e8c6754e8d5236093f
Author: Karl-Philipp Richter <kr...@...>
Date:   2018-03-19T01:10:34Z

    storm-mqtt-examples: fixed all checkstyle warnings

----


---

[GitHub] storm pull request #2597: [STORM-3007] storm-mqtt-examples: fixed all checks...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2597#discussion_r177715753
  
    --- Diff: examples/storm-mqtt-examples/src/main/java/org/apache/storm/mqtt/examples/CustomMessageMapper.java ---
    @@ -15,35 +15,77 @@
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
    +
     package org.apache.storm.mqtt.examples;
     
    -import org.apache.storm.tuple.Fields;
    -import org.apache.storm.tuple.Values;
     import org.apache.storm.mqtt.MqttMessage;
     import org.apache.storm.mqtt.MqttMessageMapper;
    +import org.apache.storm.tuple.Fields;
    +import org.apache.storm.tuple.Values;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     /**
      * Given a topic name: "users/{user}/{location}/{deviceId}"
      * and a payload of "{temperature}/{humidity}"
    - * emits a tuple containing user(String), deviceId(String), location(String), temperature(float), humidity(float)
    - *
    + * emits a tuple containing
    + * {@code user(String), deviceId(String), location(String), temperature(float),
    + * humidity(float)}.
      */
    -public class CustomMessageMapper implements MqttMessageMapper {
    -    private static final Logger LOG = LoggerFactory.getLogger(CustomMessageMapper.class);
    -
    +public final class CustomMessageMapper implements MqttMessageMapper {
    +    private static final long serialVersionUID = 1L;
    +    /**
    --- End diff --
    
    I guess checkstyle doesn't require fields to be commented, and the name of fields are self-descriptive. Better to revert them.


---

[GitHub] storm issue #2597: [STORM-3007] storm-mqtt-examples: fixed all checkstyle wa...

Posted by krichter722 <gi...@git.apache.org>.
Github user krichter722 commented on the issue:

    https://github.com/apache/storm/pull/2597
  
    Requested changes incorporated. Thanks for the review.


---

[GitHub] storm pull request #2597: [STORM-3007] storm-mqtt-examples: fixed all checks...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2597#discussion_r177716911
  
    --- Diff: examples/storm-mqtt-examples/src/main/java/org/apache/storm/mqtt/examples/MqttBrokerPublisher.java ---
    @@ -15,35 +15,62 @@
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
    +
     package org.apache.storm.mqtt.examples;
     
    +import java.util.Random;
     
     import org.apache.activemq.broker.BrokerService;
     import org.apache.storm.mqtt.MqttLogger;
     import org.fusesource.mqtt.client.BlockingConnection;
     import org.fusesource.mqtt.client.MQTT;
     import org.fusesource.mqtt.client.QoS;
    +
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
    -import java.util.Random;
    -
    -public class MqttBrokerPublisher {
    -    private static final Logger LOG = LoggerFactory.getLogger(MqttBrokerPublisher.class);
    -
    +/**
    + * A MQTT example using a Storm topology.
    + */
    +public final class MqttBrokerPublisher {
    +    /**
    +     * The logger.
    +     */
    +    private static final Logger LOG = LoggerFactory.getLogger(
    +            MqttBrokerPublisher.class);
    +    /**
    +     * The broker.
    +     */
         private static BrokerService broker;
    -
    +    /**
    +     * The connection reference.
    +     */
         private static BlockingConnection connection;
    +    /**
    +     * The maximum temperature.
    +     */
    +    private static final int TEMPERATUR_MAX = 100;
    --- End diff --
    
    TEMPERATUR_MAX -> TEMPERATURE_MAX


---

[GitHub] storm pull request #2597: [STORM-3007] storm-mqtt-examples: fixed all checks...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2597#discussion_r177716685
  
    --- Diff: examples/storm-mqtt-examples/src/main/java/org/apache/storm/mqtt/examples/MqttBrokerPublisher.java ---
    @@ -15,35 +15,62 @@
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
    +
     package org.apache.storm.mqtt.examples;
     
    +import java.util.Random;
     
     import org.apache.activemq.broker.BrokerService;
     import org.apache.storm.mqtt.MqttLogger;
     import org.fusesource.mqtt.client.BlockingConnection;
     import org.fusesource.mqtt.client.MQTT;
     import org.fusesource.mqtt.client.QoS;
    +
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
    -import java.util.Random;
    -
    -public class MqttBrokerPublisher {
    -    private static final Logger LOG = LoggerFactory.getLogger(MqttBrokerPublisher.class);
    -
    +/**
    + * A MQTT example using a Storm topology.
    + */
    +public final class MqttBrokerPublisher {
    +    /**
    --- End diff --
    
    Same here: I guess checkstyle doesn't require fields to be commented, and the name of fields are self-descriptive. Better to revert them.


---

[GitHub] storm pull request #2597: [STORM-3007] storm-mqtt-examples: fixed all checks...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/storm/pull/2597


---

[GitHub] storm pull request #2597: [STORM-3007] storm-mqtt-examples: fixed all checks...

Posted by krichter722 <gi...@git.apache.org>.
Github user krichter722 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2597#discussion_r177723827
  
    --- Diff: examples/storm-mqtt-examples/src/main/java/org/apache/storm/mqtt/examples/CustomMessageMapper.java ---
    @@ -15,35 +15,77 @@
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
    +
     package org.apache.storm.mqtt.examples;
     
    -import org.apache.storm.tuple.Fields;
    -import org.apache.storm.tuple.Values;
     import org.apache.storm.mqtt.MqttMessage;
     import org.apache.storm.mqtt.MqttMessageMapper;
    +import org.apache.storm.tuple.Fields;
    +import org.apache.storm.tuple.Values;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     /**
      * Given a topic name: "users/{user}/{location}/{deviceId}"
      * and a payload of "{temperature}/{humidity}"
    - * emits a tuple containing user(String), deviceId(String), location(String), temperature(float), humidity(float)
    - *
    + * emits a tuple containing
    + * {@code user(String), deviceId(String), location(String), temperature(float),
    + * humidity(float)}.
      */
    -public class CustomMessageMapper implements MqttMessageMapper {
    -    private static final Logger LOG = LoggerFactory.getLogger(CustomMessageMapper.class);
    -
    +public final class CustomMessageMapper implements MqttMessageMapper {
    +    private static final long serialVersionUID = 1L;
    +    /**
    --- End diff --
    
    Correct. I assumed that `checkstyle:check` produces the same output as the checkstyle configuration run during `mvn validate`, but the former is much stricter.


---