As Robbie says, all the Qpid Java Broker system tests start up a broker and configure it... There is a fair bit of baggage that comes along with the system tests though to enable running all the different profiles, etc... so extracting a "simple" example may be a little difficult. Most of the heavy lifting is done in QpidBrokerTestCase.java from which all the system tests inherit.
We've had a number of people ask questions about embedding the Broker for testing purposes, so I think it's probably something we should put some effort into making simpler. -- Rob On 17 March 2017 at 13:41, Adel Boutros <[email protected]> wrote: > Hello Robbie, > > Can you please provide a simple example? > > Regards, > Adel > ________________________________ > From: Robbie Gemmell <[email protected]> > Sent: Friday, March 17, 2017 12:57:59 PM > To: [email protected] > Subject: Re: [Qpid Broker - 6.0.4] Junit testable? > > On 16 March 2017 at 18:01, Adel Boutros <[email protected]> wrote: > > Hello, > > > > > > As we are currently deploying a messaging solution based on the Java > Broker, we have tried to start a broker from a Junit test and it is not > very straightforward as the configuration part is a bit difficult. Of > course here we are talking about Component Based Testing and Integration > Testing to allow clients to test their code before deploying it. > > > > > > Some of the pain points when using org.apache.qpid.server.Broker: > > > > * If port 0 is specified, I have no way to get the actual port > allocated > > * I need a json config file to configure queues, topics (There is no > Java Api for it directly) > > > > It might not be as easy as would be desired, but the brokers own test > suite creates queues at runtime (using its HTTP or AMQP management > support) and as far as I know also starts brokers on 'port 0' these > days. Perhaps something to look at. > > > Another team had tested HornetQ[1] which seems to be more adapted to > embedded testing. However as our production broker will be Qpid Java > Broker, we would like our tests to be as close as possible to production. > > > > So my questions are: > > > > * Is there currently a way to use an embedded Java Broker easily > configurable in a Junit test? > > * If not, what would be required to provide such easibility? > > > > [1]: http://docs.jboss.org/hornetq/2.2.5.Final/user-manual/en/ > html/embedding-hornetq.html > > > > Regards, > > Adel > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
