You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by djames <dp...@gmail.com> on 2013/03/03 20:58:52 UTC

TransportConnection.createVMBroker(): what to use now in junit?

I notices a method TransportConnection.createVMBroker(), which looked handy
for unit testing, but I note is is not in 0.18 onwards.

Do people now mock using mockito? Or start a java broker from the unit test?



--
View this message in context: http://qpid.2158936.n2.nabble.com/TransportConnection-createVMBroker-what-to-use-now-in-junit-tp7589392.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Re: TransportConnection.createVMBroker(): what to use now in junit?

Posted by Oleksandr Rudyy <or...@gmail.com>.
Hi,

VM transport has been removed from the broker.

In unit tests you can start broker like following:

String qpidHome = System.getProperty("user.dir");
String qpidWork = System.getProperty("java.io.tmpdir") + "/qpid/work";
String configPath = qpidHome + "/qpid-config.xml";
int port = getFreePort();
BrokerOptions options = new BrokerOptions();
options.setConfigFile(configPath);
options.addPort(port);

System.setProperty("QPID_HOME", qpidHome);
System.setProperty("QPID_WORK", qpidWork);
Broker broker = new Broker();
try
{
        broker.startup(options);

        doWork(port);
}
finally
{
        broker.shutdown();
}

You need to provide a minimal broker configuration file.
I attached the working example example how to start 0.20 broker from
java code. Please, have a look into it for details.

Kind Regards,
Alex

On 3 March 2013 19:58, djames <dp...@gmail.com> wrote:
> I notices a method TransportConnection.createVMBroker(), which looked handy
> for unit testing, but I note is is not in 0.18 onwards.
>
> Do people now mock using mockito? Or start a java broker from the unit test?
>
>
>
> --
> View this message in context: http://qpid.2158936.n2.nabble.com/TransportConnection-createVMBroker-what-to-use-now-in-junit-tp7589392.html
> Sent from the Apache Qpid developers mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>