geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r449615 - in /geronimo/server/trunk/modules: geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/ geronimo-j2ee-builder/src/test/resources/j2ee_1_3...
Date Mon, 25 Sep 2006 09:02:17 GMT
Author: djencks
Date: Mon Sep 25 02:02:15 2006
New Revision: 449615

URL: http://svn.apache.org/viewvc?view=rev&rev=449615
Log:
GERONIMO-2414 move the application conversions to EARConfigBuilder

Added:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/SchemaConversionTest.java
  (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/resources/j2ee_1_3dtd/
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/resources/j2ee_1_3dtd/application-13.xml
      - copied unchanged from r449524, geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/application-13.xml
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/resources/j2ee_1_3dtd/application-14.xml
      - copied unchanged from r449524, geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/application-14.xml
Removed:
    geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/application-13.xml
    geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/application-14.xml
Modified:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
    geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/java/org/apache/geronimo/schema/SchemaConversionUtilsTest.java

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?view=diff&rev=449615&r1=449614&r2=449615
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Mon Sep 25 02:02:15 2006
@@ -86,8 +86,10 @@
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerModuleType;
 import org.apache.geronimo.xbeans.j2ee.ApplicationType;
 import org.apache.geronimo.xbeans.j2ee.ModuleType;
+import org.apache.geronimo.xbeans.j2ee.ApplicationDocument;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
 
 /**
  * @version $Rev$ $Date$
@@ -305,7 +307,7 @@
             //we found something called application.xml in the right place, if we can't parse
it it's an error
             try {
                 XmlObject xmlObject = XmlBeansUtil.parse(specDD);
-                application = SchemaConversionUtils.convertToApplicationSchema(xmlObject).getApplication();
+                application = convertToApplicationSchema(xmlObject).getApplication();
             } catch (XmlException e) {
                 throw new DeploymentException("Could not parse application.xml", e);
             }
@@ -411,6 +413,34 @@
         return gerApplication;
     }
 
+    static ApplicationDocument convertToApplicationSchema(XmlObject xmlObject) throws XmlException
{
+        if (ApplicationDocument.type.equals(xmlObject.schemaType())) {
+            XmlBeansUtil.validateDD(xmlObject);
+            return (ApplicationDocument) xmlObject;
+        }
+        XmlCursor cursor = xmlObject.newCursor();
+        XmlCursor moveable = xmlObject.newCursor();
+        String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/application_1_4.xsd";
+        String version = "1.4";
+        try {
+            SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.J2EE_NAMESPACE,
schemaLocationURL, version);
+            cursor.toStartDoc();
+            cursor.toChild(SchemaConversionUtils.J2EE_NAMESPACE, "application");
+            cursor.toFirstChild();
+            SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.J2EE_NAMESPACE,
cursor, moveable);
+        } finally {
+            cursor.dispose();
+            moveable.dispose();
+        }
+        XmlObject result = xmlObject.changeType(ApplicationDocument.type);
+        if (result != null) {
+            XmlBeansUtil.validateDD(result);
+            return (ApplicationDocument) result;
+        }
+        XmlBeansUtil.validateDD(xmlObject);
+        return (ApplicationDocument) xmlObject;
+    }
+
     public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder)
throws IOException, DeploymentException {
         ApplicationInfo applicationInfo = (ApplicationInfo) plan;
         Artifact test = applicationInfo.getEnvironment().getConfigId();
@@ -938,4 +968,5 @@
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }
+
 }

Added: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/SchemaConversionTest.java?view=auto&rev=449615
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/SchemaConversionTest.java
(added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/SchemaConversionTest.java
Mon Sep 25 02:02:15 2006
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.j2ee.deployment;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.testsupport.XmlBeansTestSupport;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * ejb 1.1 dtd appears to be a subset of ejb 2.0 dtd so the same xsl should
+ * work for both.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SchemaConversionTest extends XmlBeansTestSupport {
+    private static final Log log = LogFactory.getLog(SchemaConversionTest.class);
+
+    private ClassLoader classLoader = this.getClass().getClassLoader();
+
+
+    public void testApplication13ToApplication14Transform() throws Exception {
+        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-13.xml");
+        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-14.xml");
+        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+        XmlBeansUtil.validateDD(expected);
+        xmlObject = EARConfigBuilder.convertToApplicationSchema(xmlObject);
+//        log.debug(xmlObject.toString());
+//        log.debug(expected.toString());
+        List problems = new ArrayList();
+        boolean ok = compareXmlObjects(xmlObject, expected, problems);
+        assertTrue("Differences: " + problems, ok);
+        //make sure trying to convert twice has no bad effects
+        XmlCursor cursor2 = xmlObject.newCursor();
+        try {
+            String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/application_1_4.xsd";
+            String version = "1.4";
+            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE,
schemaLocationURL, version));
+        } finally {
+            cursor2.dispose();
+        }
+        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+        assertTrue("Differences after reconverting to schema: " + problems, ok2);
+        //do the whole transform twice...
+        xmlObject = EARConfigBuilder.convertToApplicationSchema(xmlObject);
+        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
+        assertTrue("Differences after reconverting to application schema: " + problems, ok3);
+    }
+
+}

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

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

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

Modified: geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java?view=diff&rev=449615&r1=449614&r2=449615
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
Mon Sep 25 02:02:15 2006
@@ -80,35 +80,6 @@
         GERONIMO_SCHEMA_CONVERSIONS.putAll(conversions);
     }
 
-    public static ApplicationDocument convertToApplicationSchema(XmlObject xmlObject) throws
XmlException {
-        if (ApplicationDocument.type.equals(xmlObject.schemaType())) {
-            XmlBeansUtil.validateDD(xmlObject);
-            return (ApplicationDocument) xmlObject;
-        }
-        XmlCursor cursor = xmlObject.newCursor();
-        XmlCursor moveable = xmlObject.newCursor();
-        String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/application_1_4.xsd";
-        String version = "1.4";
-        try {
-            convertToSchema(cursor, J2EE_NAMESPACE, schemaLocationURL, version);
-            cursor.toStartDoc();
-            cursor.toChild(J2EE_NAMESPACE, "application");
-            cursor.toFirstChild();
-            convertToDescriptionGroup(J2EE_NAMESPACE, cursor, moveable);
-        } finally {
-            cursor.dispose();
-            moveable.dispose();
-        }
-        XmlObject result = xmlObject.changeType(ApplicationDocument.type);
-        if (result != null) {
-            XmlBeansUtil.validateDD(result);
-            return (ApplicationDocument) result;
-        }
-        XmlBeansUtil.validateDD(xmlObject);
-        return (ApplicationDocument) xmlObject;
-
-    }
-
     public static ApplicationClientDocument convertToApplicationClientSchema(XmlObject xmlObject)
throws XmlException {
         if (ApplicationClientDocument.type.equals(xmlObject.schemaType())) {
             XmlBeansUtil.validateDD(xmlObject);

Modified: geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/java/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/java/org/apache/geronimo/schema/SchemaConversionUtilsTest.java?view=diff&rev=449615&r1=449614&r2=449615
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/java/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-schema/src/test/java/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
Mon Sep 25 02:02:15 2006
@@ -25,7 +25,6 @@
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlException;
 import org.apache.geronimo.xbeans.j2ee.EjbJarType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.testsupport.XmlBeansTestSupport;
@@ -92,35 +91,6 @@
         xmlObject = SchemaConversionUtils.convertToApplicationClientSchema(xmlObject);
         boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
         assertTrue("Differences after reconverting to application client schema: " + problems,
ok3);
-    }
-
-    public void testApplication13ToApplication14Transform() throws Exception {
-        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-13.xml");
-        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-14.xml");
-        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
-        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
-        XmlBeansUtil.validateDD(expected);
-        xmlObject = SchemaConversionUtils.convertToApplicationSchema(xmlObject);
-//        log.debug(xmlObject.toString());
-//        log.debug(expected.toString());
-        List problems = new ArrayList();
-        boolean ok = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences: " + problems, ok);
-        //make sure trying to convert twice has no bad effects
-        XmlCursor cursor2 = xmlObject.newCursor();
-        try {
-            String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/application_1_4.xsd";
-            String version = "1.4";
-            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE,
schemaLocationURL, version));
-        } finally {
-            cursor2.dispose();
-        }
-        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to schema: " + problems, ok2);
-        //do the whole transform twice...
-        xmlObject = SchemaConversionUtils.convertToApplicationSchema(xmlObject);
-        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to application schema: " + problems, ok3);
     }
 
     public void testConnector10ToConnector15Transform() throws Exception {



Mime
View raw message