public void testServiceDeployerComponentName() throws Exception
{
SecurityManager sm = suspendSecurity();
try
{
MBeanServer mbeanServer = createMBeanServer("jboss");
try
{
ServiceController serviceController = new ServiceController();
ObjectName objectName = new ObjectName("jboss.system:service=ServiceController");
mbeanServer.registerMBean(serviceController, objectName);
try
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
mbeanServer.registerMBean(new JmxCL(loader), new ObjectName("jboss:service=defaultClassLoader"));
BasicBootstrap bootstrap = new BasicBootstrap();
bootstrap.run();
Kernel kernel = bootstrap.getKernel();
AbstractController controller = (AbstractController)kernel.getController();
serviceController.setMBeanServer(mbeanServer);
serviceController.setKernel(kernel);
MainDeployerImpl mainDeployer = new MainDeployerImpl();
mainDeployer.setStructuralDeployers(new StructuralDeployers()
{
public DeploymentContext determineStructure(Deployment deployment) throws DeploymentException
{
return new AbstractDeploymentContext("SMD", "");
}
});
DeployersImpl deployersImpl = new DeployersImpl(controller);
deployersImpl.addDeployer(new ServiceDeployer(serviceController));
deployersImpl.addDeployer(new ServiceDeploymentDeployer());
deployersImpl.addDeployer(new CLDeployer());
deployersImpl.addDeployer(new SMDParsingDeployer());
mainDeployer.setDeployers(deployersImpl);
Deployment deployment = new AbstractDeployment("SMD");
mainDeployer.addDeployment(deployment);
mainDeployer.process();
mainDeployer.checkComplete(deployment);
fail("Should not be here");
}
catch (Exception e)
{
assertInstanceOf(e, IncompleteDeploymentException.class);
}
finally
{
mbeanServer.unregisterMBean(objectName);
}
}
finally
{
MBeanServerFactory.releaseMBeanServer(mbeanServer);