final File file = new File(this.getMcBeanDescriptor().toURI());
// Deploy it
server.deploy(file);
StateReportingBean bean = null;
try
{
// Lookup the bean
final String context = MC_NAME_STATEREPORTING_BEAN;
bean = (StateReportingBean) ((MCBasedServer<?, ?>) server).getKernel().getController()
.getInstalledContext(context).getTarget();
TestCase.assertNotNull("Bean was not found installed in expected context: " + context, bean);
// Ensure started
TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED,
bean.getState());
}
finally
{
// Undeploy
server.undeploy(file);
// Ensure stopped
TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED,
bean.getState());
}
}