[jboss-svn-commits] JBossWS SVN: r942 - in trunk/src: main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/metadata test test/ant test/java/org/jboss/test/ws/jaxws test/java/org/jboss/test/ws/jaxws/jbws1123 test/resources/jaxws test/resources/jaxws/jbws1123 test/resources/jaxws/jbws1123/WEB-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 11 16:54:22 EDT 2006


Author: darran.lofthouse at jboss.com
Date: 2006-09-11 16:54:14 -0400 (Mon, 11 Sep 2006)
New Revision: 942

Added:
   trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/
   trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java
   trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java
   trunk/src/test/resources/jaxws/jbws1123/
   trunk/src/test/resources/jaxws/jbws1123/WEB-INF/
   trunk/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml
Removed:
   trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java
   trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java
   trunk/src/test/resources/jaxws/jbws1123/WEB-INF/
   trunk/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml
Modified:
   trunk/src/main/java/org/jboss/ws/jaxrpc/TypeMappingImpl.java
   trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
   trunk/src/test/ant/build-jars-jaxws.xml
   trunk/src/test/build.xml
Log:
JBWS-1123 - Merged from branches/jbossws-1.0


Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/TypeMappingImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/TypeMappingImpl.java	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/TypeMappingImpl.java	2006-09-11 20:54:14 UTC (rev 942)
@@ -216,6 +216,22 @@
    }
 
    /**
+    * Get all of the Classes registered for this xmlType.
+    */
+   public List<Class> getJavaTypes(QName xmlType)
+   {
+      List<KeyPair> keyPairList = getKeyPairs(xmlType, null);
+      List<Class> classes = new ArrayList<Class>(keyPairList.size());
+      
+      for (KeyPair current : keyPairList)
+      {
+         classes.add(current.getJavaType());
+      }
+      
+      return classes;
+   }
+   
+   /**
     * Get the Class that was registered last for this xmlType
     * If there are two Java Types registered for the xmlType
     * return the primitive type rather than the wrapper,

Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java	2006-09-11 20:54:14 UTC (rev 942)
@@ -449,14 +449,24 @@
          String javaTypeName = tmMetaData.getJavaTypeName();
          QName xmlType = tmMetaData.getXmlType();
          if (xmlType != null)
-         {
-            Class registeredType = typeMapping.getJavaType(xmlType);
-            if (registeredType == null || registeredType.getName().equals(javaTypeName) == false)
+         {                       
+            List<Class> classes = typeMapping.getJavaTypes(xmlType);
+            
+            boolean registered = false;
+            for (Class current : classes) {
+               if (current.getName().equals(javaTypeName))
+               {
+                  registered = true;
+                  break;
+               }
+            }
+            
+            if (registered == false)
             {
                ClassLoader classLoader = service.getUnifiedMetaData().getClassLoader();
                if (classLoader == null)
                   throw new WSException("ClassLoader not available in meta data");
-
+               
                try
                {
                   Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);

Modified: trunk/src/test/ant/build-jars-jaxws.xml
===================================================================
--- trunk/src/test/ant/build-jars-jaxws.xml	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/test/ant/build-jars-jaxws.xml	2006-09-11 20:54:14 UTC (rev 942)
@@ -107,6 +107,14 @@
       </metainf>
     </jar>
     
+    <!-- jaxws-jbws1123 -->
+    <war destfile="${build.test.dir}/libs/jaxws-jbws1123.war"
+         webxml="${build.test.dir}/resources/jaxws/jbws1123/WEB-INF/web.xml">      
+      <classes dir="${build.test.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/jbws1123/MessageBean.class"/>
+      </classes>
+    </war>    
+    
     <!-- jaxws-jsr181-complex -->
     <war warfile="${build.test.dir}/libs/jaxws-jsr181-complex.war" webxml="${build.test.dir}/resources/jaxws/jsr181/complex/WEB-INF/web.xml">
       <classes dir="${build.test.dir}/classes">

Modified: trunk/src/test/build.xml
===================================================================
--- trunk/src/test/build.xml	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/test/build.xml	2006-09-11 20:54:14 UTC (rev 942)
@@ -178,17 +178,18 @@
     <mkdir dir="${build.test.dir}/classes"/>
     <javac destdir="${build.test.dir}/classes" debug="${javac.debug}" verbose="${javac.verbose}" deprecation="${javac.deprecation}" failonerror="${javac.fail.onerror}">
       <src path="${test.java.dir}"/>
-      <exclude name="org/jboss/test/ws/addressing/**"/>
-      <!--exclude name="org/jboss/test/ws/benchmark/**"/-->
-      <exclude name="org/jboss/test/ws/interop/**"/>
-      <exclude name="org/jboss/test/ws/jsr181/**"/>
-      <exclude name="org/jboss/test/ws/jbws860/**"/>
-      <exclude name="org/jboss/test/ws/jbws871/**"/>
-      <exclude name="org/jboss/test/ws/jbws944/**"/>
-      <exclude name="org/jboss/test/ws/jbws947/**"/>
-      <exclude name="org/jboss/test/ws/samples/jsr181ejb/**"/>
-      <exclude name="org/jboss/test/ws/samples/jsr181pojo/**"/>
-      <exclude name="org/jboss/test/ws/samples/wsaddressing/**"/>
+      <!-- TODO - Remove dynamichandler once Java 5.0 code is removed -->
+      <exclude name="org/jboss/test/ws/jaxrpc/samples/dynamichandler/**"/>
+      <exclude name="org/jboss/test/ws/interop/**"/>      
+      <exclude name="org/jboss/test/ws/jaxws/jsr181/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/jbws1123/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/jbws860/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/jbws871/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/jbws944/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/samples/jsr181ejb/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/samples/jsr181pojo/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/wsaddressing/**"/>
+      <exclude name="org/jboss/test/ws/jaxws/samples/wsaddressing/**"/>      
       <exclude name="org/jboss/test/ws/tools/jsr181/**"/>
       <classpath refid="javac.classpath"/>
     </javac>

Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123 (from rev 941, branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1123)

Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java	2006-09-11 20:54:14 UTC (rev 942)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.jbws1123;
-
-import java.io.ByteArrayInputStream;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPMessage;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.util.xml.DOMUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * 
- * @author darran.lofthouse at jboss.com
- * @since 31-August-2006
- */
-public class JBWS1123TestCase extends JBossWSTest
-{
-
-   private final String TARGET_ENDPOINT = "http://" + getServerHost() + ":8080/jaxws-jbws1123/MessageService";
-
-   public static Test suite() throws Exception
-   {
-      return JBossWSTestSetup.newTestSetup(JBWS1123TestCase.class, "jaxws-jbws1123.war");
-   }
-
-   public void testProcessElement() throws Exception
-   {
-      performTest("processElement");
-   }
-
-   public void testProcessSOAPElement() throws Exception
-   {
-      performTest("processSOAPElement");
-   }
-
-   private void performTest(final String methodName) throws Exception
-   {
-      MessageFactory mf = MessageFactory.newInstance();
-      SOAPMessage reqMsg = mf.createMessage();
-
-      String request = MessageBean.request.replace("METHOD_NAME", methodName);
-
-      DocumentBuilder builder = getDocumentBuilder();
-      Document doc = builder.parse(new ByteArrayInputStream(request.getBytes()));
-      reqMsg.getSOAPBody().addDocument(doc);
-
-      SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
-      SOAPConnection con = conFactory.createConnection();
-      SOAPMessage resMsg = con.call(reqMsg, new URL(TARGET_ENDPOINT));
-
-      SOAPBody soapBody = resMsg.getSOAPBody();
-      SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
-
-      validateResponse(methodName, soapElement);
-   }
-
-   private DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
-   {
-      // Setup document builder
-      DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
-      docBuilderFactory.setNamespaceAware(true);
-
-      DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
-      return builder;
-   }
-
-   private void validateResponse(final String methodName, final Element resEl) throws Exception
-   {
-      QName expName = new QName(MessageBean.TARGET_NAMESPACE, methodName + "Response", MessageBean.PREFIX_1);
-      QName elementName = new QName(resEl.getNamespaceURI(), resEl.getLocalName(), resEl.getPrefix());
-      assertEquals(expName, elementName);
-
-      expName = new QName("POID");
-      Element poidEl = DOMUtils.getFirstChildElement(resEl, expName);
-      elementName = new QName(poidEl.getLocalName());
-      assertEquals(expName, elementName);
-
-      String elementValue = DOMUtils.getTextContent(poidEl);
-      assertEquals("12345", elementValue);
-
-      expName = new QName("Status");
-      Element statusEl = DOMUtils.getFirstChildElement(resEl, expName);
-      elementName = new QName(statusEl.getLocalName());
-      assertEquals(expName, elementName);
-
-      elementValue = DOMUtils.getTextContent(statusEl);
-      assertEquals("ok", elementValue);
-   }
-}

Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java (from rev 941, branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1123/JBWS1123TestCase.java)

Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java	2006-09-11 20:54:14 UTC (rev 942)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.jbws1123;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-import java.rmi.RemoteException;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.DOMUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import com.ibm.wsdl.util.xml.DOM2Writer;
-
-/**
- * 
- * @author darran.lofthouse at jboss.com
- * @since 31-August-2006
- */
- at WebService(targetNamespace = "http://org.jboss/test/ws/jbws1123")
- at SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
-public class MessageBean
-{
-
-   private static final Logger log = Logger.getLogger(MessageBean.class);
-
-   static final String TARGET_NAMESPACE = "http://org.jboss/test/ws/jbws1123";
-
-   static final String PREFIX_1 = "ns1";
-
-   static final String NSURI_2 = "http://somens";
-   static final String PREFIX_2 = "ns2";
-
-   static final String request = "<ns1:METHOD_NAME xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:ns2='http://somens' attrval='somevalue'>"
-         + "  <ns2:Customer>Kermit</ns2:Customer>" + "  <Item>Ferrari</Item>" + "</ns1:METHOD_NAME>";
-
-   static final String response = "<ns1:METHOD_NAME_RESPONSE xmlns:ns1='" + TARGET_NAMESPACE + "'>" + "  <POID>12345</POID>" + "  <Status>ok</Status>"
-         + "</ns1:METHOD_NAME_RESPONSE>";
-
-   @WebMethod
-   public Element processElement(final Element element) throws RemoteException
-   {
-      return commonProcessElement("processElement", element);
-   }
-
-   @WebMethod
-   public SOAPElement processSOAPElement(final SOAPElement element) throws RemoteException
-   {
-      return commonProcessElement("processSOAPElement", element);
-   }
-
-   private SOAPElement commonProcessElement(final String methodName, final Element msg) throws RemoteException
-   {
-      StringWriter swr = new StringWriter();
-      DOM2Writer.serializeAsXML(msg, swr);
-      log.info("processElement: " + swr);
-
-      try
-      {
-         Element reqEl = (Element)msg;
-
-         // verify order element
-         QName qname = new QName(TARGET_NAMESPACE, methodName, PREFIX_1);
-         QName elementName = new QName(reqEl.getNamespaceURI(), reqEl.getLocalName(), reqEl.getPrefix());
-         if (qname.equals(elementName) == false)
-            throw new IllegalArgumentException("Unexpected element: " + elementName);
-
-         // Verify the custom attribute
-         String attrVal = reqEl.getAttribute("attrval");
-         if ("somevalue".equals(attrVal) == false)
-            throw new IllegalArgumentException("Unexpected attribute value: " + attrVal);
-
-         // Verify NS declarations
-         String nsURI_1 = reqEl.getAttribute("xmlns:" + PREFIX_1);
-         if (TARGET_NAMESPACE.equals(nsURI_1) == false)
-            throw new IllegalArgumentException("Unexpected namespace URI: " + nsURI_1);
-
-         String nsURI_2 = reqEl.getAttribute("xmlns:" + PREFIX_2);
-         if (NSURI_2.equals(nsURI_2) == false)
-            throw new IllegalArgumentException("Unexpected namespace URI: " + nsURI_2);
-
-         // Test getElementsByTagNameNS
-         // http://jira.jboss.com/jira/browse/JBWS-99
-         NodeList nodeList1 = reqEl.getElementsByTagNameNS(NSURI_2, "Customer");
-         if (nodeList1.getLength() != 1)
-            throw new IllegalArgumentException("Cannot getElementsByTagNameNS");
-
-         // Test getElementsByTagName
-         // http://jira.jboss.com/jira/browse/JBWS-99
-         NodeList nodeList2 = reqEl.getElementsByTagName("Item");
-         if (nodeList2.getLength() != 1)
-            throw new IllegalArgumentException("Cannot getElementsByTagName");
-
-         // verify customer element
-         qname = new QName(NSURI_2, "Customer", PREFIX_2);
-         Element custEl = DOMUtils.getFirstChildElement(reqEl, qname);
-         String elementValue = DOMUtils.getTextContent(custEl);
-         if ("Customer".equals(custEl.getLocalName()) == false || "Kermit".equals(elementValue) == false)
-            throw new IllegalArgumentException("Unexpected element value: " + elementValue);
-
-         // verify item element
-         qname = new QName("Item");
-         Element itemEl = DOMUtils.getFirstChildElement(reqEl, qname);
-         elementValue = DOMUtils.getTextContent(itemEl);
-         if ("Item".equals(itemEl.getLocalName()) == false || "Ferrari".equals(elementValue) == false)
-            throw new IllegalArgumentException("Unexpected element value: " + elementValue);
-
-         // Setup document builder
-         DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
-         docBuilderFactory.setNamespaceAware(true);
-
-         // Prepare response
-         DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
-
-         String response = MessageBean.response.replace("METHOD_NAME_RESPONSE", methodName + "Response");
-         Document doc = builder.parse(new ByteArrayInputStream(response.getBytes()));
-
-         SOAPElement parent = SOAPFactory.newInstance().createElement("dummy");
-         TransformerFactory factory = TransformerFactory.newInstance();
-         Transformer transformer = factory.newTransformer();
-         transformer.transform(new DOMSource(doc), new DOMResult(parent));
-         return (SOAPElement)parent.getChildElements().next();
-      }
-      catch (RuntimeException e)
-      {
-         throw e;
-      }
-      catch (Exception e)
-      {
-         throw new RemoteException(e.toString(), e);
-      }
-   }
-
-}

Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java (from rev 941, branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1123/MessageBean.java)

Copied: trunk/src/test/resources/jaxws/jbws1123 (from rev 941, branches/jbossws-1.0/src/test/resources/jaxws/jbws1123)

Copied: trunk/src/test/resources/jaxws/jbws1123/WEB-INF (from rev 941, branches/jbossws-1.0/src/test/resources/jaxws/jbws1123/WEB-INF)

Deleted: trunk/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml	2006-09-11 18:17:49 UTC (rev 941)
+++ trunk/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml	2006-09-11 20:54:14 UTC (rev 942)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<web-app 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"
-  version="2.4">
-
-  <servlet>
-    <servlet-name>MessageService</servlet-name>
-    <servlet-class>org.jboss.test.ws.jaxws.jbws1123.MessageBean</servlet-class>
-  </servlet>
-
-  <servlet-mapping>
-    <servlet-name>MessageService</servlet-name>
-    <url-pattern>/*</url-pattern>
-  </servlet-mapping>
-
-</web-app>
-

Copied: trunk/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml (from rev 941, branches/jbossws-1.0/src/test/resources/jaxws/jbws1123/WEB-INF/web.xml)




More information about the jboss-svn-commits mailing list