1919import javax .jms .Session ;
2020import javax .jms .TextMessage ;
2121
22- import junit .framework .TestCase ;
23-
2422import org .apache .activemq .broker .BrokerService ;
2523import org .apache .activemq .broker .TransportConnector ;
2624import org .fusesource .stomp .jms .StompJmsConnectionFactory ;
25+ import org .junit .After ;
2726import org .junit .Assert ;
27+ import org .junit .Before ;
28+ import org .junit .Ignore ;
29+ import org .junit .Test ;
2830
2931/**
3032 * <p>
3133 * </p>
3234 *
3335 * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
3436 */
35- public class ActiveMQJmsStompTest extends TestCase {
37+ public class ActiveMQJmsStompTest {
3638 BrokerService broker ;
3739 int port ;
3840
39- @ Override
40- protected void setUp () throws Exception {
41- super .setUp ();
41+ @ Before
42+ public void setUp () throws Exception {
4243 broker = new BrokerService ();
4344 broker .setPersistent (false );
4445 TransportConnector connector = broker .addConnector ("stomp://0.0.0.0:0" );
@@ -47,11 +48,10 @@ protected void setUp() throws Exception {
4748 port = connector .getConnectUri ().getPort ();
4849 }
4950
50- @ Override
51- protected void tearDown () throws Exception {
51+ @ After
52+ public void tearDown () throws Exception {
5253 broker .stop ();
5354 broker .waitUntilStopped ();
54- super .tearDown ();
5555 }
5656
5757 protected ConnectionFactory createConnectionFactory () throws Exception {
@@ -60,6 +60,7 @@ protected ConnectionFactory createConnectionFactory() throws Exception {
6060 return result ;
6161 }
6262
63+ @ Test
6364 public void testDurableSubs () throws Exception {
6465 Connection connection1 = createConnectionFactory ().createConnection ();
6566 connection1 .setClientID ("client1" );
@@ -91,6 +92,8 @@ public void testDurableSubs() throws Exception {
9192 connection2 .close ();
9293 }
9394
95+ @ Test
96+ @ Ignore ("Test added as support for AMQ-4493 - chained request/replies over ActiveMQ. The test *will* fail as of 2013-08-21" )
9497 public void testChainedRequestReply () throws Exception {
9598 final String firstTopic = "mytopic" ;
9699 final String secondTopic = "secondtopic" ;
@@ -164,9 +167,10 @@ public void run() {
164167 connectionIntermediate .close ();
165168 connectionFinal .close ();
166169 }
170+
167171 private void assertTextMessageReceived (final String expected , final MessageConsumer sub ) throws JMSException {
168172 Message msg = sub .receive (1000 *5 );
169- assertNotNull ("A message was not received." , msg );
170- assertEquals (expected , ((TextMessage )msg ).getText ());
173+ Assert . assertNotNull ("A message was not received." , msg );
174+ Assert . assertEquals (expected , ((TextMessage )msg ).getText ());
171175 }
172176}
0 commit comments