geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r164651 [2/3] - in /geronimo/trunk/modules/tomcat-builder: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/geronimo/ src/java/org/apache/geronimo/tomcat/ src/java/org/apache/geronimo/tomcat/deployment/ src/schema/ src/test-resources/ src/test-resources/data/ src/test-resources/deployables/ src/test-resources/deployables/cltest/ src/test-resources/deployables/cltest/javax/ src/test-resources/deployables/cltest/javax/foo/ src/test-resources/deployables/cltest/javax/servlet/ src/test-resources/deployables/cltest/mx4j/ src/test-resources/deployables/war1/ src/test-resources/deployables/war1/WEB-INF/ src/test-resources/deployables/war3/ src/test-resources/deployables/war3/WEB-INF/ src/test-resources/deployables/war3/auth/ src/test-resources/deployables/war3/protected/ src/test-resources/deployables/war4/ src/test-resources/deployables/war4/WEB-INF/ src/test-resources/deployables/war4/WEB-INF/classes/ src/test-resources/deployables/war4/WEB-INF/classes/org/ src/test-resources/deployables/war4/WEB-INF/classes/org/apache/ src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/ src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/ src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/ src/test-resources/plans/ src/test-resources/services/ src/test/ src/test/org/ src/test/org/apache/ src/test/org/apache/geronimo/ src/test/org/apache/geronimo/tomcat/ src/test/org/apache/geronimo/tomcat/app/ src/test/org/apache/geronimo/tomcat/deployment/ src/var/
Date Mon, 25 Apr 2005 21:09:29 GMT
Added: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigBean.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigBean.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigBean.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,101 @@
+/**
+ *
+ * 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.tomcat.deployment;
+
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
+import org.apache.geronimo.naming.deployment.ENCHelper;
+import org.apache.geronimo.xbeans.geronimo.tomcat.TomcatWebAppType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * @version $Rev: 56771 $ $Date: 2004-11-06 12:58:54 -0700 (Sat, 06 Nov 2004) $
+ */
+public class WebAppDConfigBean extends DConfigBeanSupport {
+    private final ENCHelper encHelper;
+
+    WebAppDConfigBean(DDBean ddBean, TomcatWebAppType webApp) {
+        super(ddBean, webApp);
+
+        ENCHelper.XmlEnvRefs envRefs = new ENCHelper.XmlEnvRefs(webApp.getEjbRefArray(), webApp.getEjbLocalRefArray(), webApp.getResourceRefArray(), webApp.getResourceEnvRefArray()); 
+
+        //which version are we dealing with?
+        String version = ddBean.getRoot().getAttributeValue("version");
+        if ("2.4".equals(version)) {
+            encHelper = new ENCHelper(ddBean, envRefs, getXPathsForJ2ee_1_4(ENCHelper.ENC_XPATHS), getXPathsForJ2ee_1_4(ENCHelper.NAME_XPATHS));
+        } else {
+            encHelper = new ENCHelper(ddBean, envRefs, getXPathsWithPrefix(null, ENCHelper.ENC_XPATHS), getXPathsWithPrefix(null, ENCHelper.NAME_XPATHS));
+        }
+
+    }
+
+    TomcatWebAppType getWebApp() {
+        return (TomcatWebAppType) getXmlObject();
+    }
+
+    public String getContextRoot() {
+        return getWebApp().getContextRoot();
+    }
+
+    public void setContextRoot(String contextRoot) {
+        pcs.firePropertyChange("contextRoot", getContextRoot(), contextRoot);
+        getWebApp().setContextRoot(contextRoot);
+    }
+
+    /**
+     * getContextPriorityClassLoader.
+     *
+     * @return True if this context should give web application class in preference over the containers
+     *         classes, as per the servlet specification recommendations.
+     */
+    public boolean getContextPriorityClassLoader() {
+        return getWebApp().getContextPriorityClassloader();
+    }
+
+    /**
+     * setContextPriorityClassLoader.
+     *
+     * @param contextPriority True if this context should give web application class in preference over the containers
+     * classes, as per the servlet specification recommendations.
+     */
+    public void setContextPriorityClassLoader(boolean contextPriority) {
+        pcs.firePropertyChange("contextPriorityClassLoader", getContextPriorityClassLoader(), contextPriority);
+        getWebApp().setContextPriorityClassloader(contextPriority);
+    }
+
+    public DConfigBean getDConfigBean(DDBean ddBean) throws ConfigurationException {
+        return encHelper.getDConfigBean(ddBean);
+    }
+
+    public void removeDConfigBean(DConfigBean dcBean) throws BeanNotFoundException {
+        encHelper.removeDConfigBean(dcBean);
+    }
+
+    public String[] getXpaths() {
+        return getXPathsForJ2ee_1_4(ENCHelper.ENC_XPATHS);
+    }
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return WebAppDConfigRoot.SCHEMA_TYPE_LOADER;
+    }
+
+}

Added: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigRoot.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigRoot.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigRoot.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/WebAppDConfigRoot.java Mon Apr 25 14:09:26 2005
@@ -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.tomcat.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanRootSupport;
+import org.apache.geronimo.xbeans.geronimo.tomcat.TomcatWebAppDocument;
+import org.apache.geronimo.xbeans.geronimo.tomcat.TomcatWebAppType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+
+/**
+ * @version $Rev: 56771 $ $Date: 2004-11-06 12:58:54 -0700 (Sat, 06 Nov 2004) $
+ */
+public class WebAppDConfigRoot extends DConfigBeanRootSupport {
+    static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
+        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.String.class.getClassLoader()),
+        XmlBeans.typeLoaderForClassLoader(TomcatWebAppDocument.class.getClassLoader())
+    });
+
+    private static String[] XPATHS = {
+        "web-app"
+    };
+
+    private WebAppDConfigBean webAppBean;
+
+    public WebAppDConfigRoot(DDBeanRoot ddBean) {
+        super(ddBean, TomcatWebAppDocument.Factory.newInstance());
+        TomcatWebAppType webApp = getWebAppDocument().addNewWebApp();
+        replaceWebAppDConfigBean(webApp);
+    }
+
+    private void replaceWebAppDConfigBean(TomcatWebAppType webApp) {
+        DDBean ddBean = getDDBean();
+        webAppBean = new WebAppDConfigBean(ddBean.getChildBean(XPATHS[0])[0], webApp);
+    }
+
+    TomcatWebAppDocument getWebAppDocument() {
+        return (TomcatWebAppDocument) getXmlObject();
+    }
+
+    public String[] getXpaths() {
+        return XPATHS;
+    }
+
+    public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+        if (XPATHS[0].equals(bean.getXpath())) {
+            return webAppBean;
+        }
+        return null;
+    }
+
+    public void fromXML(InputStream inputStream) throws XmlException, IOException {
+        super.fromXML(inputStream);
+        replaceWebAppDConfigBean(getWebAppDocument().getWebApp());
+    }
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return SCHEMA_TYPE_LOADER;
+    }
+
+
+}

Added: geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat.xsd?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat.xsd (added)
+++ geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat.xsd Mon Apr 25 14:09:26 2005
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 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.
+-->
+
+<xs:schema
+    xmlns:tomcat="http://geronimo.apache.org/xml/ns/web/tomcat"
+    targetNamespace="http://geronimo.apache.org/xml/ns/web/tomcat"
+    xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
+    xmlns:security="http://geronimo.apache.org/xml/ns/security"
+    xmlns:sys="http://geronimo.apache.org/xml/ns/deployment"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    version="1.0">
+
+    <xs:import namespace="http://geronimo.apache.org/xml/ns/naming" schemaLocation="../../../naming-builder/src/schema/geronimo-naming.xsd"/>
+    <xs:import namespace="http://geronimo.apache.org/xml/ns/security" schemaLocation="../../../security-builder/src/schema/geronimo-security.xsd"/>
+    <xs:import namespace="http://geronimo.apache.org/xml/ns/deployment" schemaLocation="../../../service-builder/src/schema/geronimo-config.xsd"/>
+
+
+    <xs:element name="web-app" type="tomcat:web-appType"/>
+
+    <xs:complexType name="web-appType">
+        <xs:sequence>
+            <xs:element ref="sys:dependency" minOccurs="0" maxOccurs="unbounded"/>
+
+            <xs:element name="context-root" type="xs:string" minOccurs="0"/>
+            <xs:element name="context-priority-classloader" type="xs:boolean"/>
+            <xs:element name="virtual-server" type="xs:string" minOccurs="0"/>
+
+            <xs:sequence minOccurs="0">
+                <xs:element name="security-realm-name" type="xs:string"/>
+                <xs:element ref="security:security" minOccurs="0"/>
+            </xs:sequence>
+
+            <!--xs:group ref="naming:jndiEnvironmentRefsGroup"/-->
+
+            <xs:element ref="naming:ejb-ref" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element ref="naming:ejb-local-ref" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element ref="naming:service-ref" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element ref="naming:resource-ref" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element ref="naming:resource-env-ref" minOccurs="0" maxOccurs="unbounded"/>
+
+            <xs:element ref="sys:gbean" minOccurs="0" maxOccurs="unbounded"/>
+
+        </xs:sequence>
+        <xs:attribute name="configId" type="xs:string" use="required"/>
+        <xs:attribute name="parentId" type="xs:string" use="optional"/>
+    </xs:complexType>
+
+</xs:schema>

Added: geronimo/trunk/modules/tomcat-builder/src/schema/xmlconfig.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/schema/xmlconfig.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/schema/xmlconfig.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/schema/xmlconfig.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 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.
+-->
+<!-- @version $Rev: 57116 $ $Date: 2004-11-09 18:34:38 -0700 (Tue, 09 Nov 2004) $ -->
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
+
+    <xb:namespace uri="http://geronimo.apache.org/xml/ns/web/tomcat">
+        <xb:package>org.apache.geronimo.xbeans.geronimo.tomcat</xb:package>
+        <xb:prefix>Tomcat</xb:prefix>
+    </xb:namespace>
+
+    <!--this should be unnecessary.  Probably needs xmlbeans plugin to reuse the naming classes rather than generating duplicates-->
+<!--    <xb:namespace uri="http://geronimo.apache.org/xml/ns/naming">-->
+<!--        <xb:package>org.apache.geronimo.xbeans.geronimo.naming</xb:package>-->
+<!--        <xb:prefix>Ger</xb:prefix>-->
+<!--    </xb:namespace>-->
+
+</xb:config>

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/data/groups.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/data/groups.properties?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/data/groups.properties (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/data/groups.properties Mon Apr 25 14:09:26 2005
@@ -0,0 +1,22 @@
+##
+##
+##   Copyright 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.
+##
+
+manager=izumi
+it=alan
+pet=george,gracie,metro
+dog=george,gracie
+cat=metro
\ No newline at end of file

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/data/login.config
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/data/login.config?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/data/login.config (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/data/login.config Mon Apr 25 14:09:26 2005
@@ -0,0 +1,9 @@
+
+jaasTest {
+    org.apache.geronimo.security.jaas.LocalLoginModule required
+    debug=true
+    realm="demo-properties-realm"
+    kernel="geronimo.kernel";
+};
+
+

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/data/users.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/data/users.properties?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/data/users.properties (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/data/users.properties Mon Apr 25 14:09:26 2005
@@ -0,0 +1,22 @@
+##
+##
+##   Copyright 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.
+##
+
+izumi=violin
+alan=starcraft
+george=bone
+gracie=biscuit
+metro=mouse
\ No newline at end of file

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/javax/foo/Foo.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/javax/foo/Foo.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/javax/foo/Foo.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/javax/servlet/Servlet.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/javax/servlet/Servlet.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/javax/servlet/Servlet.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/mx4j/MBeanDescription.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/mx4j/MBeanDescription.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/cltest/mx4j/MBeanDescription.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/geronimo-tomcat.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/geronimo-tomcat.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/geronimo-tomcat.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/geronimo-tomcat.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 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.
+-->
+
+<tomcat:web-app
+    xmlns:tomcat="http://geronimo.apache.org/xml/ns/web/tomcat"
+    configId="org/apache/geronimo/tomcat/Test"
+    >
+    <tomcat:context-root>/test</tomcat:context-root>
+    <tomcat:context-priority-classloader>false</tomcat:context-priority-classloader>
+    <!--
+        <tomcat:security>
+            <sec:default-principal realm-name="foo">
+                <sec:principal class="org.apache.geronimo.security.DefaultPrincipal"
+                    name="bar"/>
+            </sec:default-principal>
+        </tomcat:security>
+    -->
+</tomcat:web-app>

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/web.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/web.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/WEB-INF/web.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 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.
+-->
+  
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+    <description>Test Web Deployment</description>
+    <resource-env-ref>
+        <resource-env-ref-name>fake-resource-env-ref</resource-env-ref-name>
+        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
+    </resource-env-ref>
+    <resource-ref>
+        <res-ref-name>fake-resource-ref</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
+    <ejb-ref>
+        <ejb-ref-name>fake-ejb-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <home>some.package.FakeHome</home>
+        <remote>some.package.Fake</remote>
+    </ejb-ref>
+    <ejb-ref>
+        <ejb-ref-name>another-ejb-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <home>some.package.FakeHome</home>
+        <remote>some.package.Fake</remote>
+    </ejb-ref>
+    <ejb-local-ref>
+        <ejb-ref-name>fake-ejb-local-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <local-home>some.package.FakeLocalHome</local-home>
+        <local>some.package.FakeLocal</local>
+    </ejb-local-ref>
+    <ejb-local-ref>
+        <ejb-ref-name>another-ejb-local-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <local-home>some.package.FakeLocalHome</local-home>
+        <local>some.package.FakeLocal</local>
+    </ejb-local-ref>
+<!--    <service-ref>-->
+<!--        <service-ref-name>fake-service-ref</service-ref-name>-->
+<!--        <service-interface>some.package.FakeService</service-interface>-->
+<!--    </service-ref>-->
+</web-app>
\ No newline at end of file

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/hello.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/hello.txt?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/hello.txt (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war1/hello.txt Mon Apr 25 14:09:26 2005
@@ -0,0 +1 @@
+Hello World

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war2.war
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war2.war?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war2.war
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/geronimo-tomcat.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/geronimo-tomcat.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/geronimo-tomcat.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/geronimo-tomcat.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 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.
+-->
+
+<web-app
+    xmlns="http://geronimo.apache.org/xml/ns/web/jetty"
+    xmlns:sec="http://geronimo.apache.org/xml/ns/security"
+    configId="org/apache/geronimo/test">
+
+    <context-root>/test</context-root>
+    <context-priority-classloader>false</context-priority-classloader>
+    <login-domain-name>demo-properties-realm</login-domain-name>
+    <sec:security>
+        <sec:auto-map-roles security-realm="demo-properties-realm"/>
+        <sec:default-principal realm-name="demo-properties-realm">
+            <sec:principal class="org.apache.geronimo.security.realm.providers.PropertiesFileUserPrincipal" name="izumi"/>
+        </sec:default-principal>
+    </sec:security>
+</web-app>

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/web.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/web.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/WEB-INF/web.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 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.
+-->
+  
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+    <description>Test Web Deployment</description>
+    <resource-env-ref>
+        <resource-env-ref-name>fake-resource-env-ref</resource-env-ref-name>
+        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
+    </resource-env-ref>
+    <resource-ref>
+        <res-ref-name>fake-resource-ref</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
+
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Admin Role</web-resource-name>
+            <url-pattern>/protected/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>content-administrator</role-name>
+        </auth-constraint>
+    </security-constraint>
+
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>NO ACCESS</web-resource-name>
+            <url-pattern>/auth/logon.html</url-pattern>
+        </web-resource-collection>
+        <auth-constraint/>
+    </security-constraint>
+
+    <login-config>
+        <auth-method>FORM</auth-method>
+        <realm-name>Test JAAS Realm</realm-name>
+        <form-login-config>
+            <form-login-page>/auth/logon.html?param=test</form-login-page>
+            <form-error-page>/auth/logonError.html?param=test</form-error-page>
+        </form-login-config>
+    </login-config>
+
+    <security-role>
+        <role-name>content-administrator</role-name>
+    </security-role>
+
+    <ejb-ref>
+        <ejb-ref-name>fake-ejb-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <home>some.package.FakeHome</home>
+        <remote>some.package.Fake</remote>
+    </ejb-ref>
+    <ejb-ref>
+        <ejb-ref-name>another-ejb-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <home>some.package.FakeHome</home>
+        <remote>some.package.Fake</remote>
+    </ejb-ref>
+    <ejb-local-ref>
+        <ejb-ref-name>fake-ejb-local-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <local-home>some.package.FakeLocalHome</local-home>
+        <local>some.package.FakeLocal</local>
+    </ejb-local-ref>
+    <ejb-local-ref>
+        <ejb-ref-name>another-ejb-local-ref</ejb-ref-name>
+        <ejb-ref-type>Entity</ejb-ref-type>
+        <local-home>some.package.FakeLocalHome</local-home>
+        <local>some.package.FakeLocal</local>
+    </ejb-local-ref>
+
+</web-app>
\ No newline at end of file

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logon.html
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logon.html?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logon.html (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logon.html Mon Apr 25 14:09:26 2005
@@ -0,0 +1,20 @@
+<HTML>
+<H1>FORM Authentication demo</H1>
+<form method="POST" action="j_security_check">
+<table border="0" cellspacing="2" cellpadding="1">
+<tr>
+  <td>Username:</td>
+  <td><input size="12" value="" name="j_username" maxlength="25" type="text"></td>
+</tr>
+<tr>
+  <td>Password:</td>
+  <td><input size="12" value="" name="j_password" maxlength="25" type="password"></td>
+</tr>
+<tr>
+  <td colspan="2" align="center">
+    <input name="submit" type="submit" value="Login">
+  </td>
+</tr>
+</table>
+</form>
+</HTML>

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logonError.html
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logonError.html?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logonError.html (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/auth/logonError.html Mon Apr 25 14:09:26 2005
@@ -0,0 +1,5 @@
+<HTML>
+<H1>Authentication ERROR</H1>
+Username, password or role incorrect.
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
+</HTML>
\ No newline at end of file

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/protected/hello.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/protected/hello.txt?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/protected/hello.txt (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war3/protected/hello.txt Mon Apr 25 14:09:26 2005
@@ -0,0 +1 @@
+Hello World

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Filter1.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Filter1.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Filter1.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Filter2.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Filter2.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Filter2.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Servlet1.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Servlet1.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Servlet1.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Servlet2.class
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Servlet2.class?rev=164651&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/classes/org/apache/geronimo/tomcat/app/Servlet2.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/web.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/web.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/web.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+    <display-name>war4</display-name>
+    <filter>
+        <filter-name>Filter1</filter-name>
+        <filter-class>org.apache.geronimo.tomcat.app.Filter1</filter-class>
+        <init-param>
+            <param-name>attribute1</param-name>
+            <param-value>value1</param-value>
+        </init-param>
+    </filter>
+    <filter>
+        <filter-name>Filter2</filter-name>
+        <filter-class>org.apache.geronimo.tomcat.app.Filter2</filter-class>
+        <init-param>
+            <param-name>attribute1</param-name>
+            <param-value>value2</param-value>
+        </init-param>
+    </filter>
+    <filter-mapping>
+        <filter-name>Filter1</filter-name>
+        <servlet-name>Servlet1</servlet-name>
+    </filter-mapping>
+    <filter-mapping>
+        <filter-name>Filter2</filter-name>
+        <servlet-name>Servlet1</servlet-name>
+    </filter-mapping>
+    <servlet>
+        <servlet-name>Servlet1</servlet-name>
+        <servlet-class>org.apache.geronimo.tomcat.app.Servlet1</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>Servlet2</servlet-name>
+        <servlet-class>org.apache.geronimo.tomcat.app.Servlet2</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Servlet1</servlet-name>
+        <url-pattern>/path1</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Servlet2</servlet-name>
+        <url-pattern>/path2</url-pattern>
+    </servlet-mapping>
+    <session-config>
+        <session-timeout>60</session-timeout>
+    </session-config>
+    <jsp-config>
+        <taglib>
+            <taglib-uri>http://geronimo.apache.org/jsp/tagliburi1</taglib-uri>
+            <taglib-location>/WEB-INF/taglib1.tld</taglib-location>
+        </taglib>
+        <taglib>
+            <taglib-uri>http://geronimo.apache.org/jsp/tagliburi2</taglib-uri>
+            <taglib-location>/WEB-INF/taglib2.tld</taglib-location>
+        </taglib>
+    </jsp-config>
+</web-app>

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/plans/plan1.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/plans/plan1.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/plans/plan1.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/plans/plan1.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://geronimo.apache.org/xml/ns/web/tomcat"
+    configId="goodservlet"
+    parentId="org/apache/geronimo/DefaultDatabase">
+    <context-priority-classloader>false</context-priority-classloader>
+    <security-realm-name>public-properties-realm</security-realm-name>
+    <security default-role="UNASSIGNED" doas-current-caller="true">
+        <default-principal realm-name="public-properties-realm">
+            <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="guest"/>
+        </default-principal>
+
+        <role-mappings>
+            <role role-name="UNASSIGNED">
+                <realm realm-name="public-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="guest" designated-run-as="true"/>
+                </realm>
+            </role>
+
+            <role role-name="LOW">
+                <realm realm-name="public-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="acct" designated-run-as="true"/>
+                </realm>
+                <distinguished-name name="CN=Duke, OU=Java Software, O=Sun Microsystems\, Inc., L=Palo Alto, ST=CA, C=US"/>
+            </role>
+
+            <role role-name="MEDIUM">
+                <realm realm-name="public-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="it"/>
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="george" designated-run-as="true"/>
+                </realm>
+            </role>
+
+            <role role-name="HIGH">
+                <realm realm-name="public-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="mgmt" designated-run-as="true"/>
+                </realm>
+                <realm realm-name="black-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="dain"/>
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="david"/>
+                </realm>
+            </role>
+        </role-mappings>
+    </security>
+    <resource-ref>
+        <ref-name>jdbc/DB1</ref-name>
+        <target-name>DefaultDatabase</target-name>
+    </resource-ref>
+</web-app>

Added: geronimo/trunk/modules/tomcat-builder/src/test-resources/services/local.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/services/local.xml?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/services/local.xml (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/services/local.xml Mon Apr 25 14:09:26 2005
@@ -0,0 +1,11 @@
+<gbeans>
+    <gbean class="org.apache.geronimo.jetty.JettyContainerImpl" objectName="geronimo.web:type=WebContainer,container=Jetty">
+    </gbean>
+
+    <gbean class="org.apache.geronimo.jetty.connector.HTTPConnector" objectName="geronimo.web:type=WebConnector,container=Jetty,port=8080">
+        <default attribute="Port">5678</default>
+        <endpoint name="JettyContainer">
+            <pattern><gbean-name>geronimo.web:type=WebContainer,container=Jetty</gbean-name></pattern>
+        </endpoint>
+    </gbean>
+</gbeans>
\ No newline at end of file

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter1.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter1.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter1.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter1.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,45 @@
+/**
+ *
+ * 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.tomcat.app;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.FilterChain;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class Filter1 implements Filter {
+
+    private FilterConfig filterConfig;
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+        this.filterConfig = filterConfig;
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        chain.doFilter(request, response);
+    }
+
+    public void destroy() {
+
+    }
+}

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter2.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter2.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter2.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Filter2.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,45 @@
+/**
+ *
+ * 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.tomcat.app;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.FilterChain;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class Filter2 implements Filter {
+
+    private FilterConfig filterConfig;
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+        this.filterConfig = filterConfig;
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        chain.doFilter(request, response);
+    }
+
+    public void destroy() {
+
+    }
+}

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet1.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet1.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet1.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet1.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,52 @@
+/**
+ *
+ * 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.tomcat.app;
+
+import java.io.IOException;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class Servlet1 implements Servlet {
+
+    private ServletConfig servletConfig;
+
+    public void init(ServletConfig config) throws ServletException {
+        servletConfig = config;
+    }
+
+    public ServletConfig getServletConfig() {
+        return servletConfig;
+    }
+
+    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+
+    }
+
+    public String getServletInfo() {
+        return null;
+    }
+
+    public void destroy() {
+
+    }
+}

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet2.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet2.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet2.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/app/Servlet2.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,52 @@
+/**
+ *
+ * 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.tomcat.app;
+
+import java.io.IOException;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class Servlet2 implements Servlet {
+    
+    private ServletConfig servletConfig;
+    
+    public void init(ServletConfig config) throws ServletException {
+        servletConfig = config;
+    }
+
+    public ServletConfig getServletConfig() {
+        return servletConfig;
+    }
+
+    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+
+    }
+
+    public String getServletInfo() {
+        return null;
+    }
+
+    public void destroy() {
+
+    }
+}

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,47 @@
+package org.apache.geronimo.tomcat.deployment;
+
+import java.io.File;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
+import org.apache.geronimo.xbeans.geronimo.tomcat.TomcatWebAppDocument;
+import org.apache.geronimo.xbeans.geronimo.tomcat.TomcatWebAppType;
+import org.apache.geronimo.j2ee.deployment.POJOWebServiceBuilder;
+
+/**
+ */
+public class PlanParsingTest extends TestCase {
+    ObjectName tomcatContainerObjectName = JMXUtil.getObjectName("test:type=TomcatContainer");
+    ObjectName pojoWebServiceTemplate = null;
+    POJOWebServiceBuilder pojoWebServiceBuilder = null;
+    private TomcatModuleBuilder builder = new TomcatModuleBuilder(null, tomcatContainerObjectName, null, null);
+    private File basedir = new File(System.getProperty("basedir", "."));
+
+    public void testResourceRef() throws Exception {
+        File resourcePlan = new File(basedir, "src/test-resources/plans/plan1.xml");
+        assertTrue(resourcePlan.exists());
+        TomcatWebAppType jettyWebApp = builder.getTomcatWebApp(resourcePlan, null, true, null, null);
+        assertEquals(1, jettyWebApp.getResourceRefArray().length);
+    }
+
+    public void testConstructPlan() throws Exception {
+        TomcatWebAppDocument tomcatWebAppDoc = TomcatWebAppDocument.Factory.newInstance();
+        TomcatWebAppType tomcatWebAppType = tomcatWebAppDoc.addNewWebApp();
+        tomcatWebAppType.setConfigId("configId");
+        tomcatWebAppType.setParentId("parentId");
+        tomcatWebAppType.setContextPriorityClassloader(false);
+        GerResourceRefType ref = tomcatWebAppType.addNewResourceRef();
+        ref.setRefName("ref");
+        ref.setTargetName("target");
+
+        SchemaConversionUtils.validateDD(tomcatWebAppType);
+        System.out.println(tomcatWebAppType.toString());
+    }
+
+    public void testParseSpecDD() {
+
+    }
+}

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,588 @@
+/**
+ *
+ * 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.tomcat.deployment;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.net.URL;
+import java.nio.channels.FileChannel;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Reference;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.util.UnpackedJarFile;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.EJBReferenceBuilder;
+import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.POJOWebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.RefContext;
+import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder;
+import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.registry.BasicGBeanRegistry;
+import org.apache.geronimo.security.SecurityServiceImpl;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.tomcat.ConnectorGBean;
+import org.apache.geronimo.tomcat.EngineGBean;
+import org.apache.geronimo.tomcat.HostGBean;
+import org.apache.geronimo.tomcat.RealmGBean;
+import org.apache.geronimo.tomcat.TomcatContainer;
+import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+
+/**
+ * @version $Rev: 159325 $ $Date: 2005-03-28 15:53:03 -0700 (Mon, 28 Mar 2005) $
+ */
+public class TomcatModuleBuilderTest extends TestCase {
+
+    protected Kernel kernel;
+
+    private GBeanData container;
+
+    private ObjectName containerName;
+
+    private ObjectName connectorName;
+
+    private GBeanData connector;
+
+    private ObjectName engineName;
+
+    private GBeanData engine;
+
+    private ObjectName hostName;
+
+    private GBeanData host;
+
+    private ObjectName realmName;
+
+    private GBeanData realm;
+
+    private GBeanData securityServiceGBean;
+
+    private ObjectName securityServiceName;
+
+    private ObjectName serverInfoName;
+
+    private GBeanData serverInfoGBean;
+
+    private ObjectName tmName;
+
+    private ObjectName ctcName;
+
+    private GBeanData tm;
+
+    private GBeanData ctc;
+
+    private ObjectName tcmName;
+
+    private GBeanData tcm;
+
+    private ClassLoader cl;
+
+    private J2eeContext moduleContext = new J2eeContextImpl("tomcat.test",
+            "test", "null", NameFactory.WEB_MODULE, "Test", null, null);
+
+    private TomcatModuleBuilder builder;
+
+    private File basedir = new File(System.getProperty("basedir", "."));
+
+    private URI parentId = URI.create("org/apache/geronimo/Foo");
+
+    public void testDeployWar4() throws Exception {
+        File outputPath = new File(basedir,
+                "target/test-resources/deployables/war4");
+        recursiveDelete(outputPath);
+        outputPath.mkdirs();
+        File path = new File(basedir, "src/test-resources/deployables/war4");
+        File dest = new File(basedir, "target/test-resources/deployables/war4/war");
+        recursiveCopy(path, dest);
+        UnpackedJarFile jarFile = new UnpackedJarFile(path);
+        Module module = builder.createModule(null, jarFile);
+        URI id = new URI("war4");
+        EARContext earContext = createEARContext(outputPath, id);
+        ObjectName serverName = earContext.getServerObjectName();
+        GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
+        start(server);
+        builder.initContext(earContext, module, cl);
+        builder.addGBeans(earContext, module, cl);
+        earContext.close();
+        module.close();
+        GBeanData configData = earContext.getConfigurationGBeanData();
+        configData.setAttribute("baseURL", path.toURL());
+        kernel.loadGBean(configData, cl);
+
+        kernel.startRecursiveGBean(configData.getName());
+        if (((Integer) kernel.getAttribute(configData.getName(), "state"))
+                .intValue() != State.RUNNING_INDEX) {
+            fail("gbean not started: " + configData.getName());
+        }
+        assertEquals(
+                new Integer(State.RUNNING_INDEX),
+                kernel
+                        .getAttribute(
+                                ObjectName
+                                        .getInstance("test:J2EEApplication=null,J2EEServer=bar,j2eeType=WebModule,name=war4"),
+                                "state"));
+        Set names = kernel
+                .listGBeans(ObjectName
+                        .getInstance("test:J2EEApplication=null,J2EEServer=bar,WebModule=war4,*"));
+        System.out.println("Object names: " + names);
+        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
+            ObjectName objectName = (ObjectName) iterator.next();
+            assertEquals(new Integer(State.RUNNING_INDEX), kernel.getAttribute(
+                    objectName, "state"));
+        }
+
+        //If we got here with no errors, then Tomcat deployed the war and loaded the classes
+        
+        kernel.stopGBean(configData.getName());
+        kernel.unloadGBean(configData.getName());
+
+        kernel.loadGBean(configData, cl);
+        kernel.startRecursiveGBean(configData.getName());
+        kernel.stopGBean(configData.getName());
+        kernel.unloadGBean(configData.getName());
+    }
+
+    private EARContext createEARContext(File outputPath, URI id)
+            throws MalformedObjectNameException, DeploymentException {
+        EARContext earContext = new EARContext(outputPath, id,
+                ConfigurationModuleType.WAR, parentId, kernel, moduleContext
+                        .getJ2eeApplicationName(), tcmName, ctcName, null,
+                null, null, new RefContext(new EJBReferenceBuilder() {
+
+                    public Reference createEJBLocalReference(String objectName,
+                            boolean isSession, String localHome, String local)
+                            throws DeploymentException {
+                        return null;
+                    }
+
+                    public Reference createEJBRemoteReference(
+                            String objectName, boolean isSession, String home,
+                            String remote) throws DeploymentException {
+                        return null;
+                    }
+
+                    public Reference createCORBAReference(URI corbaURL,
+                            String objectName, ObjectName containerName,
+                            String home) throws DeploymentException {
+                        return null;
+                    }
+
+                    public Object createHandleDelegateReference() {
+                        return null;
+                    }
+                }, new ResourceReferenceBuilder() {
+
+                    public Reference createResourceRef(String containerId,
+                            Class iface) throws DeploymentException {
+                        return null;
+                    }
+
+                    public Reference createAdminObjectRef(String containerId,
+                            Class iface) throws DeploymentException {
+                        return null;
+                    }
+
+                    public ObjectName locateResourceName(ObjectName query)
+                            throws DeploymentException {
+                        return null;
+                    }
+
+                    public GBeanData locateActivationSpecInfo(
+                            ObjectName resourceAdapterName,
+                            String messageListenerInterface)
+                            throws DeploymentException {
+                        return null;
+                    }
+
+                    public GBeanData locateResourceAdapterGBeanData(
+                            ObjectName resourceAdapterModuleName)
+                            throws DeploymentException {
+                        return null;
+                    }
+
+                    public GBeanData locateAdminObjectInfo(
+                            ObjectName resourceAdapterModuleName,
+                            String adminObjectInterfaceName)
+                            throws DeploymentException {
+                        return null;
+                    }
+
+                    public GBeanData locateConnectionFactoryInfo(
+                            ObjectName resourceAdapterModuleName,
+                            String connectionFactoryInterfaceName)
+                            throws DeploymentException {
+                        return null;
+                    }
+                }, 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, Map portLocationMap,
+                            Map credentialsNameMap,
+                            DeploymentContext deploymentContext, Module module,
+                            ClassLoader classLoader) throws DeploymentException {
+                        return null;
+                    }
+                }, kernel));
+        return earContext;
+    }
+
+    private void recursiveDelete(File path) {
+        // does not delete top level dir passed in
+        File[] listing = path.listFiles();
+        for (int i = 0; i < ((listing == null) ? 0 : listing.length); i++) {
+            File file = listing[i];
+            if (file.isDirectory()) {
+                recursiveDelete(file);
+            }
+            file.delete();
+        }
+    }
+
+    public void recursiveCopy(File src, File dest) throws IOException {
+
+        if (!src.exists()) {
+            return;
+        }
+
+        if (src.isDirectory()) {
+            // Create destination directory
+            dest.mkdirs();
+
+            // Go trough the contents of the directory
+            String list[] = src.list();
+            for (int i = 0; i < list.length; i++) {
+                recursiveCopy(new File(src, list[i]), new File(dest, list[i]));
+            }
+
+        } else {
+            copyFile(src, dest, -1);
+        }
+    }
+
+    public boolean copyFile(File src, File dest, long extent)
+            throws FileNotFoundException, IOException {
+        boolean result = false;
+        if (dest.exists()) {
+            dest.delete();
+        }
+        FileInputStream fis = null;
+        FileOutputStream fos = null;
+        FileChannel fcin = null;
+        FileChannel fcout = null;
+        try {
+            // Get channels
+            fis = new FileInputStream(src);
+            fos = new FileOutputStream(dest);
+            fcin = fis.getChannel();
+            fcout = fos.getChannel();
+            if (extent < 0) {
+                extent = fcin.size();
+            }
+
+            // do the file copy
+            long trans = fcin.transferTo(0, extent, fcout);
+            if (trans < extent) {
+                result = false;
+            }
+            result = true;
+        } catch (IOException e) {
+            // Add more info to the exception. Preserve old stacktrace.
+            IOException newE = new IOException("Copying "
+                    + src.getAbsolutePath() + " to " + dest.getAbsolutePath()
+                    + " with extent " + extent + " got IOE: " + e.getMessage());
+            newE.setStackTrace(e.getStackTrace());
+            throw newE;
+        } finally {
+            // finish up
+            if (fcin != null) {
+                fcin.close();
+            }
+            if (fcout != null) {
+                fcout.close();
+            }
+            if (fis != null) {
+                fis.close();
+            }
+            if (fos != null) {
+                fos.close();
+            }
+        }
+        return result;
+    }
+
+    protected void setUp() throws Exception {
+        cl = this.getClass().getClassLoader();
+        containerName = NameFactory.getWebComponentName(null, null, null, null,
+                "tomcatContainer", "WebResource", moduleContext);
+        connectorName = NameFactory.getWebComponentName(null, null, null, null,
+                "tomcatConnector", "WebResource", moduleContext);
+        realmName = NameFactory.getWebComponentName(null, null, null, null,
+                "tomcatRealm", "WebResource", moduleContext);
+        engineName = NameFactory.getWebComponentName(null, null, null, null,
+                "tomcatEngine", "WebResource", moduleContext);
+        hostName = NameFactory.getWebComponentName(null, null, null, null,
+                "tomcatHost", "WebResource", moduleContext);
+
+        tmName = NameFactory.getComponentName(null, null, null, null, null,
+                "TransactionManager", NameFactory.JTA_RESOURCE, moduleContext);
+        tcmName = NameFactory.getComponentName(null, null, null, null, null,
+                "TransactionContextManager", NameFactory.JTA_RESOURCE,
+                moduleContext);
+        ctcName = new ObjectName(
+                "geronimo.server:role=ConnectionTrackingCoordinator");
+
+        kernel = new Kernel("foo", new BasicGBeanRegistry());
+        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 baseConfig = (GBeanData) kernel.invoke(store.getName(),
+                "getConfiguration", new Object[] { parentId },
+                new String[] { URI.class.getName() });
+        kernel.loadGBean(baseConfig, this.getClass().getClassLoader());
+        kernel.startGBean(baseConfig.getName());
+
+        serverInfoName = new ObjectName("geronimo.system:name=ServerInfo");
+        serverInfoGBean = new GBeanData(serverInfoName, ServerInfo.GBEAN_INFO);
+        serverInfoGBean.setAttribute("baseDirectory", ".");
+        start(serverInfoGBean);
+
+        // install the policy configuration factory
+        securityServiceName = new ObjectName("foo:j2eeType=SecurityService");
+        securityServiceGBean = new GBeanData(securityServiceName,
+                SecurityServiceImpl.GBEAN_INFO);
+        securityServiceGBean.setReferencePattern("ServerInfo", serverInfoName);
+        securityServiceGBean
+                .setAttribute("policyConfigurationFactory",
+                        "org.apache.geronimo.security.jacc.GeronimoPolicyConfigurationFactory");
+        securityServiceGBean.setAttribute("policyProvider",
+                "org.apache.geronimo.security.jacc.GeronimoPolicy");
+        start(securityServiceGBean);
+
+        builder = new TomcatModuleBuilder(new URI("null"), containerName, null,
+                kernel);
+
+        // Default Realm
+        Map initParams = new HashMap();
+
+        initParams.put("userClassNames",
+                        "org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
+        initParams.put("roleClassNames",
+                        "org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
+        realm = new GBeanData(realmName, RealmGBean.GBEAN_INFO);
+        realm.setAttribute("className",
+                "org.apache.geronimo.tomcat.realm.TomcatJAASRealm");
+        realm.setAttribute("initParams", initParams);
+        start(realm);
+
+        // Default Engine
+        initParams.clear();
+        initParams.put("name", "Geronimo");
+        initParams.put("defaultHost", "localhost");
+        engine = new GBeanData(engineName, EngineGBean.GBEAN_INFO);
+        engine.setAttribute("className", "org.apache.geronimo.tomcat.TomcatEngine");
+        engine.setAttribute("initParams", initParams);
+        engine.setReferencePattern("realmGBean", realmName);
+        start(engine);
+
+        // Default Host
+        initParams.clear();
+        initParams.put("workDir", "work");
+        initParams.put("name", "localhost");
+        initParams.put("appBase", "");
+        host = new GBeanData(hostName, HostGBean.GBEAN_INFO);
+        host.setAttribute("className", "org.apache.catalina.core.StandardHost");
+        host.setAttribute("initParams", initParams);
+        host.setReferencePattern("engineGBean", engineName);
+        start(host);
+
+        container = new GBeanData(containerName, TomcatContainer.GBEAN_INFO);
+        container.setAttribute("catalinaHome", "target/var/catalina");
+        container.setReferencePattern("engineGBean", engineName);
+        container.setReferencePattern("ServerInfo", serverInfoName);
+
+        initParams.clear();
+        initParams.put("port", "8080");
+        connector = new GBeanData(connectorName, ConnectorGBean.GBEAN_INFO);
+        connector.setAttribute("initParams", initParams);
+        connector.setReferencePattern("TomcatContainer", containerName);
+
+        start(container);
+        start(connector);
+
+        tm = new GBeanData(tmName, TransactionManagerImpl.GBEAN_INFO);
+        Set patterns = new HashSet();
+        patterns
+                .add(ObjectName
+                        .getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
+        tm.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
+        tm.setReferencePatterns("ResourceManagers", patterns);
+        start(tm);
+        tcm = new GBeanData(tcmName, TransactionContextManager.GBEAN_INFO);
+        tcm.setReferencePattern("TransactionManager", tmName);
+        start(tcm);
+        ctc = new GBeanData(ctcName, ConnectionTrackingCoordinator.GBEAN_INFO);
+        start(ctc);
+
+    }
+
+    protected void tearDown() throws Exception {
+        stop(ctcName);
+        stop(tmName);
+        stop(serverInfoName);
+        stop(securityServiceName);
+        stop(connectorName);
+        stop(containerName);
+        kernel.shutdown();
+    }
+
+    private void start(GBeanData gbeanData) throws Exception {
+        kernel.loadGBean(gbeanData, cl);
+        kernel.startGBean(gbeanData.getName());
+        if (((Integer) kernel.getAttribute(gbeanData.getName(), "state"))
+                .intValue() != State.RUNNING_INDEX) {
+            fail("gbean not started: " + gbeanData.getName());
+        }
+    }
+
+    private void stop(ObjectName name) throws Exception {
+        kernel.stopGBean(name);
+        kernel.unloadGBean(name);
+    }
+
+    public static class MockConfigStore implements ConfigurationStore {
+        public URI install(URL source) throws IOException,
+                InvalidConfigException {
+            return null;
+        }
+
+        public URI install(File source) throws IOException,
+                InvalidConfigException {
+            return null;
+        }
+
+        public void uninstall(URI configID) throws NoSuchConfigException,
+                IOException {
+
+        }
+
+        public boolean containsConfiguration(URI configID) {
+            return true;
+        }
+
+        public GBeanData getConfiguration(URI id) throws NoSuchConfigException,
+                IOException, InvalidConfigException {
+            GBeanData configData = null;
+            try {
+                configData = new GBeanData(Configuration
+                        .getConfigurationObjectName(id),
+                        Configuration.GBEAN_INFO);
+            } catch (MalformedObjectNameException e) {
+                throw new InvalidConfigException(e);
+            }
+            configData.setAttribute("ID", id);
+            configData.setAttribute("domain", "test");
+            configData.setAttribute("server", "bar");
+            configData.setAttribute("gBeanState", NO_OBJECTS_OS);
+            return configData;
+        }
+
+        public void updateConfiguration(Configuration configuration)
+                throws NoSuchConfigException, Exception {
+
+        }
+
+        public URL getBaseURL(URI id) throws NoSuchConfigException {
+            return null;
+        }
+
+        public String getObjectName() {
+            return null;
+        }
+
+        public List listConfiguations() {
+            return null;
+        }
+
+        public File createNewConfigurationDir() {
+            return null;
+        }
+
+        public final static GBeanInfo GBEAN_INFO;
+
+        private static final byte[] NO_OBJECTS_OS;
+
+        static {
+            GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(
+                    MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
+            infoBuilder.addInterface(ConfigurationStore.class);
+            GBEAN_INFO = infoBuilder.getBeanInfo();
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            try {
+                ObjectOutputStream oos = new ObjectOutputStream(baos);
+                oos.flush();
+                NO_OBJECTS_OS = baos.toByteArray();
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    };
+
+}

Added: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/WebAppDConfigTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/WebAppDConfigTest.java?rev=164651&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/WebAppDConfigTest.java (added)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/WebAppDConfigTest.java Mon Apr 25 14:09:26 2005
@@ -0,0 +1,114 @@
+/**
+ *
+ * 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.tomcat.deployment;
+
+import java.util.Arrays;
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.spi.DeploymentConfiguration;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.deployment.tools.loader.WebDeployable;
+
+/**
+ * @version $Rev: 56771 $ $Date: 2004-11-06 12:58:54 -0700 (Sat, 06 Nov 2004) $
+ */
+public class WebAppDConfigTest extends TestCase {
+    private DeploymentConfiguration config;
+    private WebDeployable deployable;
+    private DDBeanRoot ddBeanRoot;
+    private WebAppDConfigRoot configRoot;
+
+    public void testWebAppRoot() throws Exception {
+        assertNotNull(configRoot);
+        assertTrue(Arrays.equals(new String[]{"web-app"}, configRoot.getXpaths()));
+        assertNotNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app")[0]));
+        assertNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app/description")[0]));
+    }
+
+    public void testWebApp() throws Exception {
+        DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
+        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
+        assertNotNull(webApp);
+/*
+        String[] xpaths = webApp.getXpaths();
+        assertTrue(Arrays.equals(
+                new String[]{
+                    "ejb-ref",
+                    "ejb-local-ref",
+                    "message-destination-ref",
+                    "resource-env-ref",
+                    "resource-ref",
+                },
+                xpaths)
+        );
+*/
+    }
+
+/*
+    public void testEJBRef() throws Exception {
+        DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
+        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
+        DDBean[] ddBeans = ddBean.getChildBean(webApp.getXpaths()[0]);
+        assertEquals(2, ddBeans.length);
+        assertEquals("fake-ejb-ref", ddBeans[0].getChildBean("ejb-ref-name")[0].getText());
+        assertEquals("another-ejb-ref", ddBeans[1].getChildBean("ejb-ref-name")[0].getText());
+
+        EJBRefDConfigBean ejbRef0 = (EJBRefDConfigBean) webApp.getDConfigBean(ddBeans[0]);
+        EJBRefDConfigBean ejbRef1 = (EJBRefDConfigBean) webApp.getDConfigBean(ddBeans[1]);
+        assertNotNull(ejbRef0);
+        assertEquals(ddBeans[0], ejbRef0.getDDBean());
+        assertNotNull(ejbRef1);
+        assertEquals(ddBeans[1], ejbRef1.getDDBean());
+        assertTrue(ejbRef0 != ejbRef1);
+    }
+*/
+
+/*
+    public void testEJBLocalRef() throws Exception {
+        DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
+        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
+        DDBean[] ddBeans = ddBean.getChildBean(webApp.getXpaths()[1]);
+        assertEquals(2, ddBeans.length);
+        assertEquals("fake-ejb-local-ref", ddBeans[0].getChildBean("ejb-ref-name")[0].getText());
+        assertEquals("another-ejb-local-ref", ddBeans[1].getChildBean("ejb-ref-name")[0].getText());
+
+        EJBLocalRefDConfigBean ejbRef0 = (EJBLocalRefDConfigBean) webApp.getDConfigBean(ddBeans[0]);
+        EJBLocalRefDConfigBean ejbRef1 = (EJBLocalRefDConfigBean) webApp.getDConfigBean(ddBeans[1]);
+        assertNotNull(ejbRef0);
+        assertEquals(ddBeans[0], ejbRef0.getDDBean());
+        assertNotNull(ejbRef1);
+        assertEquals(ddBeans[1], ejbRef1.getDDBean());
+        assertTrue(ejbRef0 != ejbRef1);
+    }
+*/
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
+        config = new WARConfiguration(deployable);
+
+        ddBeanRoot = deployable.getDDBeanRoot();
+        configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+}



Mime
View raw message