mirror of https://github.com/apache/activemq.git
This commit is contained in:
parent
ec2a3c750b
commit
7c2735d0f4
|
@ -2493,7 +2493,6 @@ public class BrokerService implements Service {
|
||||||
List<TransportConnector> al = new ArrayList<TransportConnector>();
|
List<TransportConnector> al = new ArrayList<TransportConnector>();
|
||||||
for (Iterator<TransportConnector> iter = getTransportConnectors().iterator(); iter.hasNext();) {
|
for (Iterator<TransportConnector> iter = getTransportConnectors().iterator(); iter.hasNext();) {
|
||||||
TransportConnector connector = iter.next();
|
TransportConnector connector = iter.next();
|
||||||
connector.setBrokerService(this);
|
|
||||||
al.add(startTransportConnector(connector));
|
al.add(startTransportConnector(connector));
|
||||||
}
|
}
|
||||||
if (al.size() > 0) {
|
if (al.size() > 0) {
|
||||||
|
@ -2570,7 +2569,8 @@ public class BrokerService implements Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TransportConnector startTransportConnector(TransportConnector connector) throws Exception {
|
public TransportConnector startTransportConnector(TransportConnector connector) throws Exception {
|
||||||
|
connector.setBrokerService(this);
|
||||||
connector.setTaskRunnerFactory(getTaskRunnerFactory());
|
connector.setTaskRunnerFactory(getTaskRunnerFactory());
|
||||||
MessageAuthorizationPolicy policy = getMessageAuthorizationPolicy();
|
MessageAuthorizationPolicy policy = getMessageAuthorizationPolicy();
|
||||||
if (policy != null) {
|
if (policy != null) {
|
||||||
|
|
|
@ -355,7 +355,7 @@ public class BrokerView implements BrokerViewMBean {
|
||||||
if (connector == null) {
|
if (connector == null) {
|
||||||
throw new NoSuchElementException("Not connector matched the given name: " + discoveryAddress);
|
throw new NoSuchElementException("Not connector matched the given name: " + discoveryAddress);
|
||||||
}
|
}
|
||||||
connector.start();
|
brokerService.startTransportConnector(connector);
|
||||||
return connector.getName();
|
return connector.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1362,6 +1362,36 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAddRemoveConnectorBrokerView() throws Exception {
|
||||||
|
|
||||||
|
ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
|
||||||
|
BrokerViewMBean brokerView = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
|
||||||
|
|
||||||
|
Map connectors = brokerView.getTransportConnectors();
|
||||||
|
LOG.info("Connectors: " + connectors);
|
||||||
|
assertEquals("one connector", 1, connectors.size());
|
||||||
|
|
||||||
|
ConnectorViewMBean connector = getProxyToConnectionView("tcp");
|
||||||
|
assertNotNull(connector);
|
||||||
|
|
||||||
|
String name = connectors.keySet().iterator().next().toString();
|
||||||
|
|
||||||
|
brokerView.removeConnector(name);
|
||||||
|
|
||||||
|
connectors = brokerView.getTransportConnectors();
|
||||||
|
assertEquals("empty", 0, connectors.size());
|
||||||
|
|
||||||
|
name = brokerView.addConnector("tcp://0.0.0.0:0");
|
||||||
|
|
||||||
|
connector = getProxyToConnectionView("tcp");
|
||||||
|
assertNotNull(connector);
|
||||||
|
|
||||||
|
connectors = brokerView.getTransportConnectors();
|
||||||
|
LOG.info("Connectors: " + connectors);
|
||||||
|
assertEquals("one connector", 1, connectors.size());
|
||||||
|
assertTrue("name is in map: " + connectors.keySet(), connectors.keySet().contains(name));
|
||||||
|
}
|
||||||
|
|
||||||
public void testConnectorView() throws Exception {
|
public void testConnectorView() throws Exception {
|
||||||
ConnectorViewMBean connector = getProxyToConnectionView("tcp");
|
ConnectorViewMBean connector = getProxyToConnectionView("tcp");
|
||||||
assertNotNull(connector);
|
assertNotNull(connector);
|
||||||
|
|
Loading…
Reference in New Issue