qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleksandr Rudyy <oru...@gmail.com>
Subject Re: TransportConnection.createVMBroker(): what to use now in junit?
Date Tue, 05 Mar 2013 09:57:53 GMT
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 <dpgjames@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
>


Mime
View raw message