[ 
https://issues.apache.org/jira/browse/ROCKETMQ-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15853783#comment-15853783
 ] 

Roman Shtykh commented on ROCKETMQ-77:
--------------------------------------

Hi [~Yukon],
Sure I can handle it ;)

Sure, mocking is a good approach, but I am not sure it is feasible in this case 
-- usually you mock objects, but here you need a running nameserver to respond 
{{RemotingClient}} requests, so, at the first glance, it doesn't look much 
different to me whether you start a nameserver controller or its mocked 
version. Can you please explain your viewpoint?

As an example, Apache Curator has a testing zookeeper server (see 
{{org.apache.curator.test.TestingServer}}), so you can use it whenever you have 
components that require a connection to it in your tests.
We have {{IntegrationTestBase}} handy.

> [TEST] org.apache.rocketmq.tools.* have NPEs
> --------------------------------------------
>
>                 Key: ROCKETMQ-77
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-77
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-tools
>            Reporter: Roman Shtykh
>            Assignee: Roman Shtykh
>             Fix For: 4.1.0-incubating
>
>
> Run {{mvn test}} and see {{org.apache.rocketmq.tools.*}} having NPEs, because 
> no nameserver is started.
> This can be fixed by, for instance, having {{IntegrationTestBase}} staring a 
> nameserver when tests are being run.
> In general, I would throw an exception whenever obtaining a nameserver is 
> failed, rather than returning {{null}}, because a connection to the 
> nameserver is a must to do any useful work in RocketMQ.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to