1 18 package org.apache.activemq.xbean; 19 20 import java.net.URI ; 21 import java.util.List ; 22 23 import junit.framework.TestCase; 24 25 import org.apache.activemq.broker.BrokerFactory; 26 import org.apache.activemq.broker.BrokerService; 27 import org.apache.activemq.broker.TransportConnector; 28 import org.apache.activemq.command.ActiveMQQueue; 29 import org.apache.activemq.command.ActiveMQTopic; 30 import org.apache.activemq.network.NetworkConnector; 31 32 36 public class ConnectorXBeanConfigTest extends TestCase { 37 38 protected BrokerService brokerService; 39 40 public void testConnectorConfiguredCorrectly() throws Exception { 41 42 TransportConnector connector = (TransportConnector) brokerService.getTransportConnectors().get(0); 43 44 assertEquals( new URI ("tcp://localhost:61636"), connector.getUri() ); 45 assertTrue( connector.getTaskRunnerFactory() == brokerService.getTaskRunnerFactory() ); 46 47 48 NetworkConnector netConnector = (NetworkConnector) brokerService.getNetworkConnectors().get(0); 49 List excludedDestinations = netConnector.getExcludedDestinations(); 50 assertEquals(new ActiveMQQueue("exclude.test.foo"), excludedDestinations.get(0)); 51 assertEquals(new ActiveMQTopic("exclude.test.bar"), excludedDestinations.get(1)); 52 53 List dynamicallyIncludedDestinations = netConnector.getDynamicallyIncludedDestinations(); 54 assertEquals(new ActiveMQQueue("include.test.foo"), dynamicallyIncludedDestinations.get(0)); 55 assertEquals(new ActiveMQTopic("include.test.bar"), dynamicallyIncludedDestinations.get(1)); 56 57 } 58 59 protected void setUp() throws Exception { 60 brokerService = createBroker(); 61 brokerService.start(); 62 } 63 64 protected void tearDown() throws Exception { 65 if (brokerService != null) { 66 brokerService.stop(); 67 } 68 } 69 70 protected BrokerService createBroker() throws Exception { 71 String uri = "org/apache/activemq/xbean/connector-test.xml"; 72 return BrokerFactory.createBroker(new URI ("xbean:"+uri)); 73 } 74 75 } 76 | Popular Tags |