geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r489976 - in /geronimo/server/trunk/modules/geronimo-webservices-builder/src: main/java/org/apache/geronimo/webservices/builder/ test/java/org/apache/geronimo/webservices/builder/ test/resources/
Date Sun, 24 Dec 2006 04:09:40 GMT
Author: djencks
Date: Sat Dec 23 20:09:39 2006
New Revision: 489976

URL: http://svn.apache.org/viewvc?view=rev&rev=489976
Log:
GERONIMO-2668 fix errors in previous two fixes, add tests, and this time actually verify that
daytrader deploys now

Added:
    geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-j2ee14.xml
      - copied unchanged from r486263, geronimo/daytrader/trunk/modules/web/src/main/webapp/WEB-INF/webservices.xml
    geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
  (with props)
Modified:
    geronimo/server/trunk/modules/geronimo-webservices-builder/src/main/java/org/apache/geronimo/webservices/builder/WSDescriptorParser.java
    geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/java/org/apache/geronimo/webservices/builder/ParsingTest.java

Modified: geronimo/server/trunk/modules/geronimo-webservices-builder/src/main/java/org/apache/geronimo/webservices/builder/WSDescriptorParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-webservices-builder/src/main/java/org/apache/geronimo/webservices/builder/WSDescriptorParser.java?view=diff&rev=489976&r1=489975&r2=489976
==============================================================================
--- geronimo/server/trunk/modules/geronimo-webservices-builder/src/main/java/org/apache/geronimo/webservices/builder/WSDescriptorParser.java
(original)
+++ geronimo/server/trunk/modules/geronimo-webservices-builder/src/main/java/org/apache/geronimo/webservices/builder/WSDescriptorParser.java
Sat Dec 23 20:09:39 2006
@@ -371,10 +371,23 @@
     }
 
     public static Map<String,PortInfo> parseWebServiceDescriptor(URL wsDDUrl, JarFile
moduleFile, boolean isEJB, Map servletLocations) throws DeploymentException {
+            WebservicesType webservicesType = getWebservicesType(wsDDUrl);
+        if (webservicesType != null) {
+            return parseWebServiceDescriptor(webservicesType, moduleFile, isEJB, servletLocations);
+        } else {
+            return null;
+        }
+
+    }
+
+    static WebservicesType getWebservicesType(URL wsDDUrl) throws DeploymentException {
         try {
             XmlObject webservicesDocumentUntyped = XmlObject.Factory.parse(wsDDUrl);
             XmlCursor cursor = webservicesDocumentUntyped.newCursor();
             try {
+                if (cursor.currentTokenType() != XmlCursor.TokenType.START) {
+                    while(cursor.toNextToken()  != XmlCursor.TokenType.START) {}
+                }
                 QName qname = cursor.getName();
                 if (!WebservicesDocument.type.getDocumentElementName().equals(qname)) {
                     //not a jaxrpc/j2ee 1.4 webservices document.
@@ -384,10 +397,15 @@
             } finally {
                 cursor.dispose();
             }
-            WebservicesDocument webservicesDocument = (WebservicesDocument) webservicesDocumentUntyped;
+
+            WebservicesDocument webservicesDocument;
+            if (webservicesDocumentUntyped instanceof WebservicesDocument) {
+                webservicesDocument = (WebservicesDocument) webservicesDocumentUntyped;
+            } else {
+                webservicesDocument = (WebservicesDocument) webservicesDocumentUntyped.changeType(WebservicesDocument.type);
+            }
             XmlBeansUtil.validateDD(webservicesDocument);
-            WebservicesType webservicesType = webservicesDocument.getWebservices();
-            return parseWebServiceDescriptor(webservicesType, moduleFile, isEJB, servletLocations);
+            return webservicesDocument.getWebservices();
         } catch (XmlException e) {
             throw new DeploymentException("Could not read descriptor document", e);
         } catch (IOException e) {

Modified: geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/java/org/apache/geronimo/webservices/builder/ParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/java/org/apache/geronimo/webservices/builder/ParsingTest.java?view=diff&rev=489976&r1=489975&r2=489976
==============================================================================
--- geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/java/org/apache/geronimo/webservices/builder/ParsingTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/java/org/apache/geronimo/webservices/builder/ParsingTest.java
Sat Dec 23 20:09:39 2006
@@ -24,6 +24,7 @@
 import java.util.Iterator;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URL;
 
 import org.apache.geronimo.testsupport.TestSupport;
 
@@ -111,6 +112,16 @@
         log.debug("ELEMENT MAP");
         log.debug(elements);
         assertEquals(4, elements.size());
+    }
+    
+    public void testWebservicesJ2ee14() throws Exception {
+        URL url = getClass().getClassLoader().getResource("webservices-j2ee14.xml");
+        assertNotNull(WSDescriptorParser.getWebservicesType(url));
+    }
+
+    public void testWebservicesJee5() throws Exception {
+        URL url = getClass().getClassLoader().getResource("webservices-jee5.xml");
+        assertNull(WSDescriptorParser.getWebservicesType(url));
     }
 
 }

Added: geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml?view=auto&rev=489976
==============================================================================
--- geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
(added)
+++ geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
Sat Dec 23 20:09:39 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<webservices xmlns="http://java.sun.com/xml/ns/javaee"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+		http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd"
+             version="1.2">
+    <webservice-description>
+        <webservice-description-name>cxfPojo</webservice-description-name>
+        <wsdl-file>WEB-INF/wsdl/greeter_control.wsdl</wsdl-file>
+        <port-component>
+            <port-component-name>cxfPojoName</port-component-name>
+            <wsdl-service></wsdl-service>
+            <enable-mtom>false</enable-mtom>
+            <service-endpoint-interface>org.apache.hello_world_soap_http.Greeter</service-endpoint-interface>
+            <service-impl-bean>
+                <servlet-link>cxfPojoServlet</servlet-link>
+            </service-impl-bean>
+        </port-component>
+    </webservice-description>
+
+</webservices>
\ No newline at end of file

Propchange: geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-webservices-builder/src/test/resources/webservices-jee5.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message