String j2eeServerName = "TestGeronimoServer";
String j2eeApplicationName = "null";
String j2eeModuleName = "org/apache/geronimo/j2ee/deployment/test";
ObjectName connectionTrackerName = new ObjectName("geronimo.connector:service=ConnectionTracker");
ModuleBuilder moduleBuilder = new ConnectorModuleBuilder();
File rarFile = action.getRARFile();
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
ClassLoader cl = new URLClassLoader(new URL[]{rarFile.toURL()}, oldCl);
Thread.currentThread().setContextClassLoader(cl);
XmlObject plan = moduleBuilder.getDeploymentPlan(rarFile.toURL());
URI parentId = moduleBuilder.getParentId(plan);
URI configId = moduleBuilder.getConfigId(plan);
assertEquals(j2eeModuleName, configId.toString());
Module module = moduleBuilder.createModule(configId.toString(), plan);
File carFile = File.createTempFile("RARTest", ".car");
try {
EARContext earContext = new EARContext(new JarOutputStream(new FileOutputStream(carFile)),
configId,
ConfigurationModuleType.RAR,
parentId,
null,
j2eeDomainName,
j2eeServerName,
j2eeApplicationName,
null,
connectionTrackerName,
null,
null,
null);
action.install(moduleBuilder, earContext, module);
earContext.getClassLoader(null);
moduleBuilder.initContext(earContext, module, cl);
moduleBuilder.addGBeans(earContext, module, cl);
earContext.close();
File tempdir = new File(System.getProperty("java.io.tmpdir"));
File unpackedDir = new File(tempdir, "OpenEJBTest-Unpacked");
LocalConfigStore.unpack(unpackedDir, new FileInputStream(carFile));