You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by lindzh <gi...@git.apache.org> on 2017/07/31 10:03:30 UTC

[GitHub] incubator-rocketmq pull request #141: [ROCKETMQ-254] fix logger appender uni...

GitHub user lindzh opened a pull request:

    https://github.com/apache/incubator-rocketmq/pull/141

    [ROCKETMQ-254] fix logger appender unit test too long with mock

    LoggerAppender unit test cost much time, and in some cases it may cause test failure,fix this case this mockito.


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

    $ git pull https://github.com/lindzh/incubator-rocketmq logger_appender_test

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

    https://github.com/apache/incubator-rocketmq/pull/141.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 #141
    
----
commit 42075612f2f103c2df54475e93c8ebfb5d6de133
Author: lindzh <li...@163.com>
Date:   2017-07-31T09:58:27Z

    fix logger appender unit test too long with mock

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    
    [![Coverage Status](https://coveralls.io/builds/12790961/badge)](https://coveralls.io/builds/12790961)
    
    Coverage decreased (-0.6%) to 38.989% when pulling **0afab06e67404871cbd52f904c70c1a2a9e80876 on lindzh:logger_appender_test** into **bcc65e5471d9821e0edb90f6f637e3034ed1da44 on apache:develop**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq pull request #141: [ROCKETMQ-254] fix logger appender uni...

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

    https://github.com/apache/incubator-rocketmq/pull/141#discussion_r132088233
  
    --- Diff: logappender/src/main/java/org/apache/rocketmq/logappender/common/ProducerInstance.java ---
    @@ -70,24 +76,28 @@ public static MQProducer getInstance(String nameServerAddress, String group) thr
         }
     
     
    -    public static void removeAndClose(String nameServerAddress, String group) {
    +    public void removeAndClose(String nameServerAddress, String group) {
             if (group == null) {
                 group = DEFAULT_GROUP;
             }
             String genKey = genKey(nameServerAddress, group);
    -        MQProducer producer = producerMap.remove(genKey);
    +        MQProducer producer = getProducerInstance().producerMap.remove(genKey);
     
             if (producer != null) {
                 producer.shutdown();
             }
         }
     
    -    public static void closeAll() {
    -        Set<Map.Entry<String, MQProducer>> entries = producerMap.entrySet();
    +    public void closeAll() {
    +        Set<Map.Entry<String, MQProducer>> entries = getProducerInstance().producerMap.entrySet();
             for (Map.Entry<String, MQProducer> entry : entries) {
    -            producerMap.remove(entry.getKey());
    +            getProducerInstance().producerMap.remove(entry.getKey());
                 entry.getValue().shutdown();
             }
         }
     
    +    public static void setInstance(ProducerInstance instance1) {
    --- End diff --
    
    looks pretty dangerous to me.
    Especially considering you make it only for tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    
    [![Coverage Status](https://coveralls.io/builds/12777678/badge)](https://coveralls.io/builds/12777678)
    
    Coverage decreased (-0.4%) to 38.728% when pulling **9b5dfd8c0dbbaec8a1ba46e3d9171fd90bea262a on lindzh:logger_appender_test** into **d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    
    [![Coverage Status](https://coveralls.io/builds/12636199/badge)](https://coveralls.io/builds/12636199)
    
    Coverage decreased (-0.4%) to 38.718% when pulling **6cdfaacb2e01eae477d561c8f6efd0fed1afce09 on lindzh:logger_appender_test** into **d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq pull request #141: [ROCKETMQ-254] fix logger appender uni...

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

    https://github.com/apache/incubator-rocketmq/pull/141


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    Thanks @lindzh. I have merged it, please close this pr :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq pull request #141: [ROCKETMQ-254] fix logger appender uni...

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

    https://github.com/apache/incubator-rocketmq/pull/141#discussion_r130525133
  
    --- Diff: logappender/src/main/java/org/apache/rocketmq/logappender/common/ProducerInstance.java ---
    @@ -61,7 +68,7 @@ public static MQProducer getInstance(String nameServerAddress, String group) thr
             defaultMQProducer.setNamesrvAddr(nameServerAddress);
             MQProducer beforeProducer = null;
             //cas put producer
    --- End diff --
    
    what's the purpose for this comment :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    
    [![Coverage Status](https://coveralls.io/builds/12790961/badge)](https://coveralls.io/builds/12790961)
    
    Coverage decreased (-0.6%) to 38.989% when pulling **0afab06e67404871cbd52f904c70c1a2a9e80876 on lindzh:logger_appender_test** into **bcc65e5471d9821e0edb90f6f637e3034ed1da44 on apache:develop**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq pull request #141: [ROCKETMQ-254] fix logger appender uni...

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

    https://github.com/apache/incubator-rocketmq/pull/141#discussion_r130553480
  
    --- Diff: logappender/src/main/java/org/apache/rocketmq/logappender/common/ProducerInstance.java ---
    @@ -61,7 +68,7 @@ public static MQProducer getInstance(String nameServerAddress, String group) thr
             defaultMQProducer.setNamesrvAddr(nameServerAddress);
             MQProducer beforeProducer = null;
             //cas put producer
    --- End diff --
    
    This comment has been deleted.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    
    [![Coverage Status](https://coveralls.io/builds/12774185/badge)](https://coveralls.io/builds/12774185)
    
    Coverage decreased (-0.5%) to 38.622% when pulling **ee2e2cdb01c3711504215c6f3b55a5e9223dbd42 on lindzh:logger_appender_test** into **d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq pull request #141: [ROCKETMQ-254] fix logger appender uni...

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

    https://github.com/apache/incubator-rocketmq/pull/141#discussion_r132391646
  
    --- Diff: logappender/src/main/java/org/apache/rocketmq/logappender/common/ProducerInstance.java ---
    @@ -70,24 +76,28 @@ public static MQProducer getInstance(String nameServerAddress, String group) thr
         }
     
     
    -    public static void removeAndClose(String nameServerAddress, String group) {
    +    public void removeAndClose(String nameServerAddress, String group) {
             if (group == null) {
                 group = DEFAULT_GROUP;
             }
             String genKey = genKey(nameServerAddress, group);
    -        MQProducer producer = producerMap.remove(genKey);
    +        MQProducer producer = getProducerInstance().producerMap.remove(genKey);
     
             if (producer != null) {
                 producer.shutdown();
             }
         }
     
    -    public static void closeAll() {
    -        Set<Map.Entry<String, MQProducer>> entries = producerMap.entrySet();
    +    public void closeAll() {
    +        Set<Map.Entry<String, MQProducer>> entries = getProducerInstance().producerMap.entrySet();
             for (Map.Entry<String, MQProducer> entry : entries) {
    -            producerMap.remove(entry.getKey());
    +            getProducerInstance().producerMap.remove(entry.getKey());
                 entry.getValue().shutdown();
             }
         }
     
    +    public static void setInstance(ProducerInstance instance1) {
    --- End diff --
    
    Yes ,it is dangerous for only test and this problem has been fixed with reflect.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq issue #141: [ROCKETMQ-254] fix logger appender unit test ...

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

    https://github.com/apache/incubator-rocketmq/pull/141
  
    
    [![Coverage Status](https://coveralls.io/builds/12619313/badge)](https://coveralls.io/builds/12619313)
    
    Coverage decreased (-0.5%) to 38.602% when pulling **42075612f2f103c2df54475e93c8ebfb5d6de133 on lindzh:logger_appender_test** into **d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---