executeTestBuildModule(action, true);
}
private void executeTestBuildModule(InstallAction action, boolean is15) throws Exception {
J2eeContext j2eeContext = new J2eeContextImpl("test", "bar", "null", "JCAResource", "org/apache/geronimo/j2ee/deployment/test", null, null);
String resourceAdapterName = "testRA";
//N.B. short version of getComponentName
ObjectName connectionTrackerName = NameFactory.getComponentName(null, null, null, null, "ConnectionTracker", ConnectionTrackingCoordinatorGBean.GBEAN_INFO.getJ2eeType(), j2eeContext);
//new ObjectName("test:J2EEServer=bar,J2EEModule=org/apache/geronimo/j2ee/deployment/test,service=ConnectionTracker");
Kernel kernel = KernelFactory.newInstance().createKernel("foo");
try {
kernel.boot();
GBeanData store = new GBeanData(JMXUtil.getObjectName("foo:j2eeType=ConfigurationStore,name=mock"), MockConfigStore.GBEAN_INFO);
kernel.loadGBean(store, this.getClass().getClassLoader());
kernel.startGBean(store.getName());
GBeanData configurationManagerData = new GBeanData(configurationManagerName, ConfigurationManagerImpl.GBEAN_INFO);
configurationManagerData.setReferencePatterns("Stores", Collections.singleton(store.getName()));
kernel.loadGBean(configurationManagerData, getClass().getClassLoader());
kernel.startGBean(configurationManagerName);
ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultParentId, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, repository, kernel);
File rarFile = action.getRARFile();
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
ClassLoader cl = new URLClassLoader(new URL[]{rarFile.toURL()}, oldCl);
Thread.currentThread().setContextClassLoader(cl);
JarFile rarJarFile = DeploymentUtil.createJarFile(rarFile);
Module module = moduleBuilder.createModule(action.getVendorDD(), rarJarFile, j2eeContext.getJ2eeModuleName(), action.getSpecDD(), null, null);
if (module == null) {
throw new DeploymentException("Was not a connector module");
}
assertEquals(j2eeContext.getJ2eeModuleName(), module.getConfigId().toString());
File tempDir = null;
try {
tempDir = DeploymentUtil.createTempDir();
EARContext earContext = new EARContext(tempDir,
module.getConfigId(),
module.getType(),
module.getParentId(),
kernel,
j2eeContext.getJ2eeApplicationName(),
null,
connectionTrackerName,
null,
null,
null, new RefContext(ejbReferenceBuilder,