geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r439179 - in /geronimo/server/trunk/modules/geronimo-j2ee-builder: ./ src/java/ src/main/ src/main/java/ src/main/schema/ src/schema/ src/test-ear/ src/test-ear13/ src/test-plan/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org...
Date Fri, 01 Sep 2006 05:04:47 GMT
Author: jdillon
Date: Thu Aug 31 22:04:46 2006
New Revision: 439179

URL: http://svn.apache.org/viewvc?rev=439179&view=rev
Log:
(GERONIMO-2352 & GERONIMO-2331) Use m2 layout + use new deployables from testsupport
Split up EARConfigBuilderTest into sub-classes which extend from EARConfigBuilderTestSupport to pick up common tests
Pending hookup of unpacked and alt-dd tests

Added:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/
      - copied from r439085, geronimo/server/trunk/modules/geronimo-j2ee-builder/src/java/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/schema/
      - copied from r439085, geronimo/server/trunk/modules/geronimo-j2ee-builder/src/schema/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/
      - copied from r439085, geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/org/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/resources/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/resources/plans/
      - copied from r439085, geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test-plan/
Removed:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/java/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/schema/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test-ear/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test-ear13/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test-plan/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/org/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/test-setup.xml
Modified:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml?rev=439179&r1=439178&r2=439179&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml Thu Aug 31 22:04:46 2006
@@ -54,31 +54,64 @@
     </dependencies>
     
     <build>
-        <!--
-        FIXME: Convert module to m2 standard layout
-        -->
-        
-        <sourceDirectory>src/java</sourceDirectory>
-        <testSourceDirectory>src/test</testSourceDirectory>
-
-        <resources>
-            <resource>
-                <directory>src/resources</directory>
-            </resource>
-        </resources>
-
-        <testResources>
-            <testResource>
-                <directory>src/test-data</directory>
-            </testResource>
-
-            <testResource>
-                <directory>src/test-resources</directory>
-            </testResource>
-        </testResources>
-        
         <plugins>
             <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>dependency-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}</outputDirectory>
+                            
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.geronimo.testsupport</groupId>
+                                    <artifactId>test-ear-j2ee_1.3</artifactId>
+                                    <version>${pom.version}</version>
+                                    <type>ear</type>
+                                    <destFileName>test-ear-j2ee_1.3.ear</destFileName>
+                                </artifactItem>
+                                
+                                <artifactItem>
+                                    <groupId>org.apache.geronimo.testsupport</groupId>
+                                    <artifactId>test-ear-j2ee_1.3</artifactId>
+                                    <version>${pom.version}</version>
+                                    <type>ear</type>
+                                    <!--
+                                    FIXME: need to remove the geronimo-application.xml file from this ear.
+                                    -->
+                                    <destFileName>test-ear-j2ee_1.3-naked.ear</destFileName>
+                                </artifactItem>
+                                
+                                <artifactItem>
+                                    <groupId>org.apache.geronimo.testsupport</groupId>
+                                    <artifactId>test-ear-j2ee_1.4</artifactId>
+                                    <version>${pom.version}</version>
+                                    <type>ear</type>
+                                    <destFileName>test-ear-j2ee_1.4.ear</destFileName>
+                                </artifactItem>
+                                
+                                <artifactItem>
+                                    <groupId>org.apache.geronimo.testsupport</groupId>
+                                    <artifactId>test-ear-j2ee_1.4</artifactId>
+                                    <version>${pom.version}</version>
+                                    <type>ear</type>
+                                    <!--
+                                    FIXME: need to remove the geronimo-application.xml file from this ear.
+                                    -->
+                                    <destFileName>test-ear-j2ee_1.4-naked.ear</destFileName>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            
+            <plugin>
                 <artifactId>maven-antrun-plugin</artifactId>
                 <executions>
                     <!--
@@ -101,28 +134,6 @@
                             </tasks>
                         </configuration>
                     </execution>
-                    
-                    <!--
-                    FIXME: WTF is this for?  Document or remove
-                    -->
-                    <execution>
-                        <id>process-test-resources</id>
-                        <phase>process-test-resources</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <configuration>
-                            <tasks>
-                                <echo message="classpath=${project.compileClasspathElements}"
-                                      file="classpath.properties"/>
-                                <ant antfile="${basedir}/src/test/test-setup.xml">
-                                    <property name="maven.compile.source" value="1.4"/>
-                                    <property name="maven.compile.target" value="1.4"/>
-                                </ant>
-                                <delete file="classpath.properties" failonerror="false"/>
-                            </tasks>
-                        </configuration>
-                    </execution>
                 </executions>
             </plugin>
             
@@ -130,13 +141,6 @@
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>xmlbeans-maven-plugin</artifactId>
                 <configuration>
-                    <!--
-                    FIXME: Remove when using m2 layout
-                    -->
-                    <schemaDirectory>${pom.basedir}/src/schema</schemaDirectory>
-                    <xmlConfigs>
-                        <xmlConfig implementation="java.io.File">${pom.basedir}/src/schema/xmlconfig.xml</xmlConfig>
-                    </xmlConfigs>
                     <sourceSchemas>geronimo-application-1.2.xsd</sourceSchemas>
                 </configuration>
             </plugin>

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java?rev=439179&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java Thu Aug 31 22:04:46 2006
@@ -0,0 +1,85 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+
+import org.apache.geronimo.testsupport.TestSupport;
+
+/**
+ * EAR config builder tests for naked J2EE 1.3.
+ *
+ * @version $Rev:386276 $ $Date$
+ */
+public class EARConfigBuilder13NakedTest
+    extends EARConfigBuilderTestSupport
+{
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        earFile = DeploymentUtil.createJarFile(resolveFile("target/test-ear-j2ee_1.3-naked.ear"));
+        ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar", null, null, null);
+        webConfigBuilder.contextRoot = contextRoot;
+        webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+        connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+    }
+
+    protected void tearDown() throws Exception {
+        DeploymentUtil.close(earFile);
+        close(ejbConfigBuilder.ejbModule);
+        close(webConfigBuilder.webModule);
+        close(connectorConfigBuilder.connectorModule);
+        
+        super.tearDown();
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java?rev=439179&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java Thu Aug 31 22:04:46 2006
@@ -0,0 +1,85 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+
+import org.apache.geronimo.testsupport.TestSupport;
+
+/**
+ * EAR config builder tests for J2EE 1.3.
+ *
+ * @version $Rev:386276 $ $Date$
+ */
+public class EARConfigBuilder13Test
+    extends EARConfigBuilderTestSupport
+{
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        earFile = DeploymentUtil.createJarFile(resolveFile("target/test-ear-j2ee_1.3.ear"));
+        ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar", null, null, null);
+        webConfigBuilder.contextRoot = contextRoot;
+        webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+        connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+    }
+
+    protected void tearDown() throws Exception {
+        DeploymentUtil.close(earFile);
+        close(ejbConfigBuilder.ejbModule);
+        close(webConfigBuilder.webModule);
+        close(connectorConfigBuilder.connectorModule);
+        
+        super.tearDown();
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java?rev=439179&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java Thu Aug 31 22:04:46 2006
@@ -0,0 +1,85 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+
+import org.apache.geronimo.testsupport.TestSupport;
+
+/**
+ * EAR config builder tests for naked J2EE 1.4.
+ *
+ * @version $Rev:386276 $ $Date$
+ */
+public class EARConfigBuilder14NakedTest
+    extends EARConfigBuilderTestSupport
+{
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        earFile = DeploymentUtil.createJarFile(resolveFile("target/test-ear-j2ee_1.4-naked.ear"));
+        ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar", null, null, null);
+        webConfigBuilder.contextRoot = contextRoot;
+        webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+        connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+    }
+
+    protected void tearDown() throws Exception {
+        DeploymentUtil.close(earFile);
+        close(ejbConfigBuilder.ejbModule);
+        close(webConfigBuilder.webModule);
+        close(connectorConfigBuilder.connectorModule);
+        
+        super.tearDown();
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java?rev=439179&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java Thu Aug 31 22:04:46 2006
@@ -0,0 +1,85 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+
+import org.apache.geronimo.testsupport.TestSupport;
+
+/**
+ * EAR config builder tests for J2EE 1.4.
+ *
+ * @version $Rev:386276 $ $Date$
+ */
+public class EARConfigBuilder14Test
+    extends EARConfigBuilderTestSupport
+{
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        earFile = DeploymentUtil.createJarFile(resolveFile("target/test-ear-j2ee_1.4.ear"));
+        ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "ejb.jar", null, null, null);
+        webConfigBuilder.contextRoot = contextRoot;
+        webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "war.war", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+        connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "rar.rar", null, null, null);
+    }
+
+    protected void tearDown() throws Exception {
+        DeploymentUtil.close(earFile);
+        close(ejbConfigBuilder.ejbModule);
+        close(webConfigBuilder.webModule);
+        close(connectorConfigBuilder.connectorModule);
+        
+        super.tearDown();
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java?rev=439179&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java Thu Aug 31 22:04:46 2006
@@ -0,0 +1,550 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+
+import org.apache.geronimo.testsupport.TestSupport;
+
+/**
+ * Provides support for EAR config builder tests.
+ *
+ * @version $Rev:386276 $ $Date$
+ */
+public abstract class EARConfigBuilderTestSupport
+    extends TestSupport
+{
+    protected static String WEB_NAMESPACE = "foo";
+    
+    protected static JarFile earFile;
+    
+    protected static MockConfigStore configStore = new MockConfigStore();
+    
+    protected static ArtifactManager artifactManager = new DefaultArtifactManager();
+    
+    protected static ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.EMPTY_SET, null);
+    
+    protected static MockEJBConfigBuilder ejbConfigBuilder = new MockEJBConfigBuilder();
+    
+    protected static MockWARConfigBuilder webConfigBuilder = new MockWARConfigBuilder();
+    
+    protected static MockConnectorConfigBuilder connectorConfigBuilder = new MockConnectorConfigBuilder();
+    
+    protected static ResourceReferenceBuilder resourceReferenceBuilder = connectorConfigBuilder;
+    
+    protected static ModuleBuilder appClientConfigBuilder = null;
+    
+    protected final static ModuleIDBuilder idBuilder = new ModuleIDBuilder();
+    
+    protected static ServiceReferenceBuilder serviceReferenceBuilder = new ServiceReferenceBuilder() {
+        //it could return a Service or a Reference, we don't care
+        public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) {
+            return null;
+        }
+    };
+
+    protected static final NamespaceDrivenBuilder securityBuilder = null;
+    
+    protected static final NamespaceDrivenBuilder serviceBuilder = null;
+
+    protected static final Naming naming = new Jsr77Naming();
+
+    protected static final AbstractName rootConfig = naming.createRootName(new Artifact("test", "stuff", "", "car"), "test", "test") ;
+    
+    protected static final AbstractName transactionManagerObjectName = naming.createChildName(rootConfig, "TransactionManager", "TransactionManager");
+    
+    protected static final AbstractName connectionTrackerObjectName = naming.createChildName(rootConfig, "ConnectionTracker", "ConnectionTracker");
+    
+    protected static final AbstractName transactionalTimerObjectName = naming.createChildName(rootConfig, "TransactionalThreaPooledTimer", "ThreadPooledTimer");
+    
+    protected static final AbstractName nonTransactionalTimerObjectName = naming.createChildName(rootConfig, "NonTransactionalThreaPooledTimer", "ThreadPooledTimer");
+    
+    protected static final AbstractName serverName = naming.createChildName(rootConfig, "J2EEServer", "Server");
+    
+    protected static final AbstractName earName = naming.createRootName(new Artifact("org.apache.geronimo.test.test-ear", "ear", "", "ear"), "test", NameFactory.J2EE_APPLICATION);
+    
+    protected static final AbstractName ejbModuleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE);
+    
+    protected static final AbstractName webModuleName = naming.createChildName(earName, "war", NameFactory.WEB_MODULE);
+    
+    protected static final AbstractName raModuleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
+
+    protected Environment defaultParentId;
+    
+    protected static String contextRoot = "test";
+    
+    protected static final Map portMap = null;
+    
+    protected final AbstractNameQuery transactionManagerAbstractNameQuery = new AbstractNameQuery(transactionManagerObjectName, null);
+    
+    protected final AbstractNameQuery connectionTrackerAbstractNameQuery = new AbstractNameQuery(connectionTrackerObjectName, null);
+    
+    protected final AbstractNameQuery transactionalTimerAbstractNameQuery = new AbstractNameQuery(transactionalTimerObjectName, null);
+    
+    protected final AbstractNameQuery nonTransactionalTimerAbstractNameQuery = new AbstractNameQuery(nonTransactionalTimerObjectName, null);
+    
+    protected final AbstractNameQuery corbaGBeanAbstractNameQuery = new AbstractNameQuery(serverName, null);
+
+    /*
+    
+    TODO: Hook up these tests...
+    
+    TestSetup setupUnpacked = new TestSetup(inner) {
+        protected void setUp() throws Exception {
+            earFile = DeploymentUtil.createJarFile(new File(basedir, "target/test-unpacked-ear/full/"));
+            ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar/", null, null, null);
+            webConfigBuilder.contextRoot = contextRoot;
+            webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war/", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+            connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+        }
+
+        protected void tearDown() {
+            DeploymentUtil.close(earFile);
+            close(ejbConfigBuilder.ejbModule);
+            close(webConfigBuilder.webModule);
+            close(connectorConfigBuilder.connectorModule);
+        }
+    };
+    
+    TestSetup setupUnpackedNaked = new TestSetup(inner) {
+        protected void setUp() throws Exception {
+            earFile = DeploymentUtil.createJarFile(new File(basedir, "target/test-unpacked-ear/naked/"));
+            ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar/", null, null, null);
+            webConfigBuilder.contextRoot = contextRoot;
+            webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+            connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+        }
+
+        protected void tearDown() {
+            DeploymentUtil.close(earFile);
+            close(ejbConfigBuilder.ejbModule);
+            close(webConfigBuilder.webModule);
+            close(connectorConfigBuilder.connectorModule);
+        }
+    };
+    
+    TestSetup setupUnpackedAltDD = new TestSetup(inner) {
+        protected void setUp() throws Exception {
+            earFile = DeploymentUtil.createJarFile(new File(basedir, "target/test-unpacked-ear/alt-dd/"));
+            ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar/", null, null, null);
+            webConfigBuilder.contextRoot = contextRoot;
+            webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war/", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+            connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+        }
+
+        protected void tearDown() {
+            DeploymentUtil.close(earFile);
+            close(ejbConfigBuilder.ejbModule);
+            close(webConfigBuilder.webModule);
+            close(connectorConfigBuilder.connectorModule);
+        }
+    };
+    
+    TestSetup setupPackedAltDD = new TestSetup(inner) {
+        protected void setUp() throws Exception {
+            earFile = DeploymentUtil.createJarFile(new File(basedir, "target/test-unpacked-ear/alt-dd.ear"));
+            ejbConfigBuilder.ejbModule = new EJBModule(false, ejbModuleName, null, null, "test-ejb-jar.jar/", null, null, null);
+            webConfigBuilder.contextRoot = contextRoot;
+            webConfigBuilder.webModule = new WebModule(false, webModuleName, null, null, "test-war.war/", null, null, null, contextRoot, portMap, WEB_NAMESPACE);
+            connectorConfigBuilder.connectorModule = new ConnectorModule(false, raModuleName, null, null, "test-rar.rar", null, null, null);
+        }
+
+        protected void tearDown() {
+            DeploymentUtil.close(earFile);
+            close(ejbConfigBuilder.ejbModule);
+            close(webConfigBuilder.webModule);
+            close(connectorConfigBuilder.connectorModule);
+        }
+    };
+    */
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        defaultParentId = new Environment();
+        defaultParentId.addDependency(new Artifact("org.apache.geronimo.tests", "test", "1", "car"), ImportType.ALL);
+    }
+
+    public void testBuildConfiguration() throws Exception {
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                    transactionManagerAbstractNameQuery,
+                    connectionTrackerAbstractNameQuery,
+                    transactionalTimerAbstractNameQuery,
+                    nonTransactionalTimerAbstractNameQuery,
+                    corbaGBeanAbstractNameQuery,
+                    null,
+                    null,
+                    ejbConfigBuilder,
+                    ejbConfigBuilder,
+                    webConfigBuilder,
+                    connectorConfigBuilder,
+                    resourceReferenceBuilder,
+                    appClientConfigBuilder,
+                    serviceReferenceBuilder,
+                    securityBuilder,
+                    serviceBuilder,
+                    naming);
+
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testBadEJBJARConfiguration() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                ejbConfigBuilder,
+                ejbConfigBuilder,
+                webConfigBuilder,
+                connectorConfigBuilder,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(resolveFile("src/test/resources/plans/test-bad-ejb-jar.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            if (e.getCause() instanceof IOException) {
+                fail("Should not be complaining about bad vendor DD for invalid module entry");
+            }
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testBadWARConfiguration() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                ejbConfigBuilder,
+                ejbConfigBuilder,
+                webConfigBuilder,
+                connectorConfigBuilder,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(resolveFile("src/test/resources/plans/test-bad-war.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            if (e.getCause() instanceof IOException) {
+                fail("Should not be complaining about bad vendor DD for invalid module entry");
+            }
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testBadRARConfiguration() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                ejbConfigBuilder,
+                ejbConfigBuilder,
+                webConfigBuilder,
+                connectorConfigBuilder,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(resolveFile("src/test/resources/plans/test-bad-rar.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            if (e.getCause() instanceof IOException) {
+                fail("Should not be complaining about bad vendor DD for invalid module entry");
+            }
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testBadCARConfiguration() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                ejbConfigBuilder,
+                ejbConfigBuilder,
+                webConfigBuilder,
+                connectorConfigBuilder,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(resolveFile("src/test/resources/plans/test-bad-car.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            if (e.getCause() instanceof IOException) {
+                fail("Should not be complaining about bad vendor DD for invalid module entry");
+            }
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testNoEJBDeployer() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                null,
+                null,
+                webConfigBuilder,
+                connectorConfigBuilder,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            // expected
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testNoWARDeployer() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                ejbConfigBuilder,
+                ejbConfigBuilder,
+                null,
+                connectorConfigBuilder,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            // expected
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    public void testNoConnectorDeployer() throws Exception {
+        EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
+                transactionManagerAbstractNameQuery,
+                connectionTrackerAbstractNameQuery,
+                transactionalTimerAbstractNameQuery,
+                nonTransactionalTimerAbstractNameQuery,
+                corbaGBeanAbstractNameQuery,
+                null,
+                null,
+                ejbConfigBuilder,
+                null,
+                webConfigBuilder,
+                null,
+                resourceReferenceBuilder,
+                appClientConfigBuilder,
+                serviceReferenceBuilder,
+                securityBuilder,
+                serviceBuilder,
+                naming);
+
+        ConfigurationData configurationData = null;
+        DeploymentContext context = null;
+        try {
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            configurationData = getConfigurationData(context);
+            fail("Should have thrown a DeploymentException");
+        } catch (DeploymentException e) {
+            // expected
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+            if (configurationData != null) {
+                DeploymentUtil.recursiveDelete(configurationData.getConfigurationDir());
+            }
+        }
+    }
+
+    protected ConfigurationData getConfigurationData(DeploymentContext context) throws Exception {
+        // add the a j2ee server so the application context reference can be resolved
+        context.addGBean("geronimo", J2EEServerImpl.GBEAN_INFO);
+
+        return context.getConfigurationData();
+    }
+
+    protected static void close(Module module) {
+        if (module != null) {
+            module.close();
+        }
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java?rev=439179&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java Thu Aug 31 22:04:46 2006
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class MockConfigStore
+    extends NullConfigurationStore
+{
+    protected static final Naming naming = new Jsr77Naming();
+    
+    protected final Map locations = new HashMap();
+
+    public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+        ConfigurationData configurationData = new ConfigurationData(configId, naming);
+        configurationData.setConfigurationStore(this);
+        return configurationData;
+    }
+
+    public boolean containsConfiguration(Artifact configID) {
+        return true;
+    }
+
+    public File createNewConfigurationDir(Artifact configId) {
+        try {
+            File file = DeploymentUtil.createTempDir();
+            locations.put(configId, file);
+            return file;
+        } catch (IOException e) {
+            return null;
+        }
+    }
+
+    public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
+        File file = (File) locations.get(configId);
+        if (file == null) {
+            throw new NoSuchConfigException(configId);
+        }
+        Set matches = IOUtil.search(file, pattern);
+        return matches;
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message