maven - Unit Test against ActiveMQ -
i use maven run unit test. every time have remember start activemq first because unit test need send jms message queue , consume assertion. wonder there maven plugin automatically launch activemq unit testing?
is short. possible launch activemq before running unit testing. googled , found tips. according way. should run mvn command launch activemq not auto way run unit test
thanks in advanced
a shorthand test amq flows java connect vm://localhost?broker.persistent=false.
that create , start new broker (if there no 1 running). need no boiler plate code create, configure , start/stop broker.
however, assumes have no major configuration changes default values want test. in case may want configure , start broker manually.
you can starting broker in @before method in junit test.
i.e.
brokerservice broker; @before public void setupamq(){ broker = new brokerservice(); transportconnector connector = new transportconnector(); connector.seturi(new uri("tcp://localhost:61616")); broker.addconnector(connector); // more config here! broker.start() } @after public void teardownamq(){ broker.stop(); }
Comments
Post a Comment