JarFile rarFile = null;
try {
rarFile = DeploymentUtil.createJarFile(new File(BASEDIR, "target/test-ear-noger.ear"));
GBeanBuilder serviceBuilder = new GBeanBuilder(null, null);
// EARConfigBuilder configBuilder = new EARConfigBuilder(defaultEnvironment, transactionContextManagerName, connectionTrackerName, null, null, null, new AbstractNameQuery(serverName, J2EEServerImpl.GBEAN_INFO.getInterfaces()), null, null, ejbReferenceBuilder, null,
EARConfigBuilder configBuilder = new EARConfigBuilder(defaultEnvironment,
transactionManagerName,
connectionTrackerName,
null,
new AbstractNameQuery(serverName, J2EEServerImpl.GBEAN_INFO.getInterfaces()),
Collections.singleton(repository),
null,
null,
new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, defaultWorkManagerName, Collections.singleton(serviceBuilder)),
activationSpecInfoLocator,
null,
serviceBuilder,
null,
kernel.getNaming(),
null);
configBuilder.doStart();
ConfigurationData configData = null;
DeploymentContext context = null;
ArtifactManager artifactManager = new DefaultArtifactManager();
ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.singleton(repository), null);
try {
File planFile = new File(BASEDIR, "src/test/resources/data/external-application-plan.xml");
ModuleIDBuilder idBuilder = new ModuleIDBuilder();
Object plan = configBuilder.getDeploymentPlan(planFile, rarFile, idBuilder);
context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, rarFile, idBuilder), plan, rarFile, Collections.singleton(configurationStore), artifactResolver, configurationStore);
// add the a j2ee server so the application context reference can be resolved
context.addGBean("geronimo", J2EEServerImpl.GBEAN_INFO);
configData = context.getConfigurationData();
} finally {
if (context != null) {
context.close();
}
if (configData != null) {
DeploymentUtil.recursiveDelete(configData.getConfigurationDir());
}
}
configBuilder.doStop();
} finally {
DeploymentUtil.close(rarFile);
}
}