}
public void testExternalWebContainer() throws Exception
{
// Start Jetty, externally
JettyWebContainer jetty = new JettyWebContainer();
try
{
JMXServiceURL url = new JMXServiceURL("soap", null, 8080, "/external");
jetty.start(url, null);
jetty.deploy(AxisServlet.class.getName(), url, null);
// A SOAPConnector
JMXConnectorServer cntorServer = null;
JMXConnector cntor = null;
try
{
Map environment = new HashMap();
environment.put(HTTPConnectorServer.USE_EXTERNAL_WEB_CONTAINER, Boolean.TRUE);
cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, newMBeanServer());
cntorServer.start();
// Check that it works
cntor = JMXConnectorFactory.connect(cntorServer.getAddress());
MBeanServerConnection cntion = cntor.getMBeanServerConnection();
Set names = cntion.queryNames(null, null);
assertNotNull(names);
assertFalse(names.isEmpty());
}
finally
{
if (cntor != null) cntor.close();
if (cntorServer != null) cntorServer.stop();
}
}
finally
{
jetty.stop();
}
}