1   /*
2    * $Id: MultipleJmsConnectorsTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.test.integration.providers.jms;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.tck.AbstractMuleTestCase;
15  
16  import org.apache.activemq.ActiveMQConnectionFactory;
17  
18  public class MultipleJmsConnectorsTestCase extends AbstractMuleTestCase
19  {
20      public void testMultipleJmsClientConnections() throws Exception
21      {
22          ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
23              "vm://localhost?broker.persistent=false&broker.useJmx=false");
24  
25          MuleClient client = new MuleClient();
26          client.setProperty("jms.connectionFactory", factory);
27          client.setProperty("jms.specification", "1.1");
28          client.getManager().start();
29          client.dispatch("jms://admin:admin@admin.queue?createConnector=ALWAYS", "testing", null);
30          client.dispatch("jms://ross:ross@ross.queue?createConnector=ALWAYS", "testing", null);
31  
32          // wait a bit to let the messages go on their way
33          Thread.sleep(3000);
34  
35          assertEquals(2, client.getManager().getConnectors().size());
36      }
37  }