geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r345365 - in /geronimo/trunk/modules/web-builder/src: java/org/apache/geronimo/web/deployment/ test-resources/plans/ test/org/apache/geronimo/web/deployment/
Date Thu, 17 Nov 2005 23:38:34 GMT
Author: djencks
Date: Thu Nov 17 15:38:25 2005
New Revision: 345365

URL: http://svn.apache.org/viewcvs?rev=345365&view=rev
Log:
GERONIMO-1175 support legacy web plan namespace

Added:
    geronimo/trunk/modules/web-builder/src/test-resources/plans/tomcat-pre3.xml
Modified:
    geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverter.java
    geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java

Modified: geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverter.java?rev=345365&r1=345364&r2=345365&view=diff
==============================================================================
--- geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverter.java
(original)
+++ geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverter.java
Thu Nov 17 15:38:25 2005
@@ -33,7 +33,10 @@
 
     private static final QName GENERIC_QNAME = GerWebAppDocument.type.getDocumentElementName();
     private static final String GENERIC_NAMESPACE = GENERIC_QNAME.getNamespaceURI();
+    private static final String OLD_GENERIC_NAMESPACE = "http://geronimo.apache.org/xml/ns/web";
+
     private static final QName GENERIC_CONFIG_QNAME = new QName(GENERIC_NAMESPACE, "container-config");
+    private static final QName OLD_GENERIC_CONFIG_QNAME = new QName(OLD_GENERIC_NAMESPACE,
"container-config");
     private static final String SYSTEM_NAMESPACE = ConfigurationDocument.type.getDocumentElementName().getNamespaceURI();
     private static final QName SECURITY_QNAME = GerSecurityDocument.type.getDocumentElementName();
     private final String configNamespace;
@@ -56,7 +59,7 @@
                 XmlCursor end = cursor.newCursor();
                 try {
                     cursor.push();
-                    if (cursor.toChild(GENERIC_CONFIG_QNAME)) {
+                    if (cursor.toChild(GENERIC_CONFIG_QNAME) || cursor.toChild(OLD_GENERIC_CONFIG_QNAME))
{
                         XmlCursor source = cursor.newCursor();
                         cursor.push();
                         cursor.toEndToken();

Added: geronimo/trunk/modules/web-builder/src/test-resources/plans/tomcat-pre3.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/web-builder/src/test-resources/plans/tomcat-pre3.xml?rev=345365&view=auto
==============================================================================
--- geronimo/trunk/modules/web-builder/src/test-resources/plans/tomcat-pre3.xml (added)
+++ geronimo/trunk/modules/web-builder/src/test-resources/plans/tomcat-pre3.xml Thu Nov 17
15:38:25 2005
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<web-app xmlns="http://geronimo.apache.org/xml/ns/web" configId="org/apache/jetspeed/web">
+    <context-priority-classloader>false</context-priority-classloader>
+    <container-config>
+        <tomcat xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat/config-1.0">
+            <cross-context/>
+            <tomcat-realm>TomcatJAASRealm</tomcat-realm>
+        </tomcat>
+    </container-config>
+    <resource-ref>
+      <ref-name>jdbc/DB1</ref-name>
+      <target-name>DefaultDatabase</target-name>
+    </resource-ref>
+    <security-realm-name>jetspeed-realm</security-realm-name>
+    <security>
+        <default-principal>
+            <principal class="org.apache.jetspeed.security.impl.UserPrincipalImpl" name="guest"/>
+        </default-principal>
+        <role-mappings>
+            <role role-name="admin">
+                <principal class="org.apache.jetspeed.security.impl.RolePrincipalImpl"
name="admin" designated-run-as="true"/>
+            </role>
+        </role-mappings>
+    </security>
+    <gbean name="jetspeed-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm"
xmlns="http://geronimo.apache.org/xml/ns/deployment-1.0">
+        <attribute name="realmName">jetspeed-realm</attribute>
+        <xml-reference name="LoginModuleConfiguration">
+            <lc:login-config xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.0">
+                <lc:login-module control-flag="REQUIRED" server-side="true">
+                    <lc:login-domain-name>jetspeed-realm</lc:login-domain-name>
+                    <lc:login-module-class>org.apache.jetspeed.security.impl.DefaultLoginModule</lc:login-module-class>
+                </lc:login-module>
+            </lc:login-config>
+        </xml-reference>
+        <reference name="ServerInfo">
+            <module>org/apache/geronimo/System</module>
+            <name>ServerInfo</name>
+        </reference>
+        <reference name="LoginService">
+            <name>JaasLoginService</name>
+        </reference>
+    </gbean>
+</web-app>

Modified: geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java?rev=345365&r1=345364&r2=345365&view=diff
==============================================================================
--- geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java
(original)
+++ geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java
Thu Nov 17 15:38:25 2005
@@ -32,35 +32,31 @@
 public class GenericToSpecificPlanConverterTest extends TestCase {
     private ClassLoader classLoader = this.getClass().getClassLoader();
 
-    public void testConvertPlan() throws Exception {
-        URL srcXml = classLoader.getResource("plans/tomcat-pre.xml");
-        URL expectedOutputXml = classLoader.getResource("plans/tomcat-post.xml");
-        XmlObject rawPlan = XmlObject.Factory.parse(srcXml);
-        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
-        XmlObject webPlan = new GenericToSpecificPlanConverter("http://geronimo.apache.org/xml/ns/j2ee/web/tomcat/config-1.0",
-                "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0", "tomcat").convertToSpecificPlan(rawPlan);
-
-//        System.out.println(webPlan.toString());
-//        System.out.println(expected.toString());
-        List problems = new ArrayList();
-        boolean ok = compareXmlObjects(webPlan, expected, problems);
-        assertTrue("Differences: " + problems, ok);
+    public void testConvertPlan1() throws Exception {
+        testConvertPlan("plans/tomcat-pre.xml");
     }
-
     public void testConvertPlan2() throws Exception {
-        URL srcXml = classLoader.getResource("plans/tomcat-pre2.xml");
+        testConvertPlan("plans/tomcat-pre2.xml");
+    }
+    public void testConvertPlan3() throws Exception {
+        testConvertPlan("plans/tomcat-pre3.xml");
+    }
+
+    public void testConvertPlan(String prePlanName) throws Exception {
+        URL srcXml = classLoader.getResource(prePlanName);
         URL expectedOutputXml = classLoader.getResource("plans/tomcat-post.xml");
         XmlObject rawPlan = XmlObject.Factory.parse(srcXml);
         XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
         XmlObject webPlan = new GenericToSpecificPlanConverter("http://geronimo.apache.org/xml/ns/j2ee/web/tomcat/config-1.0",
                 "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0", "tomcat").convertToSpecificPlan(rawPlan);
 
-        System.out.println(webPlan.toString());
+//        System.out.println(webPlan.toString());
 //        System.out.println(expected.toString());
         List problems = new ArrayList();
         boolean ok = compareXmlObjects(webPlan, expected, problems);
         assertTrue("Differences: " + problems, ok);
     }
+
 
 
     private boolean compareXmlObjects(XmlObject xmlObject, XmlObject expectedObject, List
problems) {



Mime
View raw message