Title: [2461] branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment: Better tracking of output files.

Diff

Modified: branches/configid/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/OpenEJBModuleBuilder.java (2460 => 2461)

--- branches/configid/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/OpenEJBModuleBuilder.java	2006-02-18 07:49:48 UTC (rev 2460)
+++ branches/configid/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/OpenEJBModuleBuilder.java	2006-02-18 08:55:54 UTC (rev 2461)
@@ -71,6 +71,7 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.schema.NamespaceElementConverter;
@@ -290,7 +291,7 @@
         return openejbEjbJar;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module) throws DeploymentException {
+    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException {
         JarFile moduleFile = module.getModuleFile();
         try {
             // extract the ejbJar file into a standalone packed jar file and add the contents to the output

Modified: branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/DeploymentTestSuite.java (2460 => 2461)

--- branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/DeploymentTestSuite.java	2006-02-18 07:49:48 UTC (rev 2460)
+++ branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/DeploymentTestSuite.java	2006-02-18 08:55:54 UTC (rev 2461)
@@ -70,9 +70,11 @@
 import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
@@ -91,6 +93,7 @@
     private Kernel kernel;
     private DataSource dataSource;
     private ClassLoader applicationClassLoader;
+    private ConfigurationStore configurationStore = new KernelHelper.MockConfigStore(null);
 
     protected DeploymentTestSuite(Class testClass, File moduleFile) {
         super(new TestSuite(testClass));
@@ -183,7 +186,7 @@
             try {
                 jarFile =DeploymentUtil.createJarFile(moduleFile);
                 Object plan = earConfigBuilder.getDeploymentPlan(null, jarFile);
-                configurationData = earConfigBuilder.buildConfiguration(plan, jarFile, tempDir);
+                configurationData = earConfigBuilder.buildConfiguration(plan, jarFile, configurationStore);
             } finally {
                 if (jarFile != null) {
                     jarFile.close();
@@ -194,8 +197,10 @@
             GBeanData config = ExecutableConfigurationUtil.getConfigurationGBeanData(configurationData);
             config.setName(CONFIGURATION_OBJECT_NAME);
             config.setAttribute("baseURL", tempDir.toURL());
-            config.setAttribute("parentId", (Artifact[]) KernelHelper.DEFAULT_ENVIRONMENT.getImports().toArray(new Artifact[KernelHelper.DEFAULT_ENVIRONMENT.getImports().size()]));
+            config.setAttribute("environment", configurationData.getEnvironment());
+            config.setReferencePattern("ConfigurationStore", JMXUtil.getObjectName("foo:j2eeType=ConfigurationStore,name=mock"));
 
+
             ObjectName containerIndexObjectName = ObjectName.getInstance(DOMAIN_NAME + ":type=ContainerIndex");
             GBeanData containerIndexGBean = new GBeanData(containerIndexObjectName, ContainerIndex.GBEAN_INFO);
             Set ejbContainerNames = new HashSet();

Modified: branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/EarDeploymentTest.java (2460 => 2461)

--- branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/EarDeploymentTest.java	2006-02-18 07:49:48 UTC (rev 2460)
+++ branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/EarDeploymentTest.java	2006-02-18 08:55:54 UTC (rev 2461)
@@ -55,8 +55,7 @@
 /**
  * @version $Revision$ $Date$
  */
-public class
-        EarDeploymentTest extends AbstractDeploymentTest {
+public class EarDeploymentTest extends AbstractDeploymentTest {
 
     private static final DeploymentTestSuite SUITE =
             new DeploymentTestSuite(EarDeploymentTest.class, new File("target/test-ear.ear"));

Modified: branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/KernelHelper.java (2460 => 2461)

--- branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/KernelHelper.java	2006-02-18 07:49:48 UTC (rev 2460)
+++ branches/configid/openejb2/modules/openejb-builder/src/test/org/openejb/deployment/KernelHelper.java	2006-02-18 08:55:54 UTC (rev 2461)
@@ -45,6 +45,7 @@
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
 
 /**
  * @version $Rev$ $Date$
@@ -89,6 +90,7 @@
 
     public static class MockConfigStore implements ConfigurationStore {
         private final Kernel kernel;
+        private static final Map locations = new HashMap();
 
         public MockConfigStore(Kernel kernel) {
             this.kernel = kernel;
@@ -98,7 +100,7 @@
             return null;
         }
 
-        public void install(ConfigurationData configurationData, File source) throws IOException, InvalidConfigException {
+        public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
         }
 
         public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
@@ -134,12 +136,22 @@
             return null;
         }
 
-        public File createNewConfigurationDir() {
-            return null;
+        public File createNewConfigurationDir(Artifact configId) {
+            try {
+                File file = DeploymentUtil.createTempDir();
+                locations.put(configId, file);
+                return file;
+            } catch (IOException e) {
+                return null;
+            }
         }
 
         public URL resolve(Artifact configId, URI uri) throws NoSuchConfigException, MalformedURLException {
-            return null;
+            File file = (File) locations.get(configId);
+            if (file == null) {
+                throw new NoSuchConfigException("nothing for configid " + configId);
+            }
+            return new URL(file.toURL(), uri.toString());
         }
 
         public final static GBeanInfo GBEAN_INFO;

Reply via email to