File path = new File(BASEDIR, "src/test/resources/deployables/war4");
UnpackedJarFile jarFile = new UnpackedJarFile(path);
Module module = builder.createModule(null, jarFile, kernel.getNaming(), new ModuleIDBuilder());
Repository repository = null;
AbstractName moduleName = module.getModuleName();
EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
module.setEarContext(earContext);
module.setRootEarContext(earContext);
builder.initContext(earContext, module, cl);
builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
ConfigurationData configurationData = earContext.getConfigurationData();
earContext.close();
module.close();
Artifact configurationId = configurationData.getId();
configurationManager.loadConfiguration(configurationData);
Configuration configuration = configurationManager.getConfiguration(configurationId);
configurationManager.startConfiguration(configurationId);
assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(moduleName));
Set names = configuration.findGBeans(new AbstractNameQuery(moduleName.getArtifact(), Collections.EMPTY_MAP));
log.debug("names: " + names);
for (Iterator iterator = names.iterator(); iterator.hasNext();) {
AbstractName objectName = (AbstractName) iterator.next();
assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(objectName));
}
configurationManager.stopConfiguration(configurationId);
configurationManager.unloadConfiguration(configurationId);