[jbossws-commits] JBossWS SVN: r3461 - in branches/dlofthouse/JBWS-1697/jbossws-core/src: main/java/org/jboss/ws/tools/helpers and 5 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Wed Jun 6 06:03:39 EDT 2007
Author: darran.lofthouse at jboss.com
Date: 2007-06-06 06:03:39 -0400 (Wed, 06 Jun 2007)
New Revision: 3461
Added:
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1697/
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1697/JBWS1697TestCase.java
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook.wsdl
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook_PortType.java
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/jaxrpc-mapping.xml
branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/wstools-config.xml
Modified:
branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
Log:
Initial implementation and first test case.
Modified: branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-06-06 10:02:29 UTC (rev 3460)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-06-06 10:03:39 UTC (rev 3461)
@@ -441,7 +441,10 @@
XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI());
XSTypeDefinition xt = xe.getTypeDefinition();
QName xmlType = new QName(xt.getNamespace(), xt.getName());
-
+
+ // Replace the xt with the real type from the schema.
+ xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
+
if (buf.length() > 0)
{
buf.append(", ");
Modified: branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-06-06 10:02:29 UTC (rev 3460)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-06-06 10:03:39 UTC (rev 3461)
@@ -373,6 +373,11 @@
XSTypeDefinition xt = xe.getTypeDefinition();
QName xmlType = new QName(xt.getNamespace(), xt.getName());
+ // Replace the xt with the real type from the schema.
+ xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
+ if (xt instanceof XSSimpleTypeDefinition)
+ xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
+
String partName = header.getPartName();
MethodParamPartsMapping mpin = getMethodParamPartsMapping(semm, elementName, xmlType, paramPosition, wsdlMessageName, mode, partName, false, true);
@@ -460,11 +465,11 @@
wrvm.setWsdlMessagePartName(partName);
semm.setWsdlReturnValueMapping(wrvm);
}
-
+
if (bindingOperation != null)
{
constructHeaderParameters(semm, wiop, bindingOperation);
- }
+ }
}
public void constructJavaXmlTypeMapping(JavaWsdlMapping jwm)
Added: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1697/JBWS1697TestCase.java
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1697/JBWS1697TestCase.java (rev 0)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1697/JBWS1697TestCase.java 2007-06-06 10:03:39 UTC (rev 3461)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.tools.jbws1697;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+
+/**
+ * Test case for http://jira.jboss.com/jira/browse/JBWS-1697
+ *
+ * WSDL to Java, handling of holders for simple types defined by restriction.
+ *
+ * @author darran.lofthouse at jboss.com
+ * @since Jun 6, 2007
+ */
+public class JBWS1697TestCase extends WSToolsTest
+{
+
+ /**
+ * Test WSDL to Java with the a document/literal endpoint
+ * where the message part is the same for both the input
+ * and output message.
+ *
+ */
+ public void testGenerateDocLitInOut() throws Exception
+ {
+ generateScenario("doclit_inout");
+ }
+
+ protected void generateScenario(final String scenario) throws Exception
+ {
+ String resourceDir = "resources/tools/jbws1697/" + scenario;
+ String toolsDir = "tools/jbws1697/" + scenario;
+ String[] args = new String[] { "-dest", toolsDir, "-config", resourceDir + "/wstools-config.xml" };
+ new WSTools().generate(args);
+ File resourceDirFile = new File(resourceDir);
+ String[] expectedFiles = resourceDirFile.list(new FilenameFilter() {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".java");
+ }
+ });
+
+ for (int i = 0; i < expectedFiles.length; i++)
+ {
+ String currentFile = expectedFiles[i];
+
+ try
+ {
+ compareSource(resourceDir + "/" + currentFile, toolsDir + "/org/jboss/test/ws/jbws1697/" + currentFile);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Validation of '" + currentFile + "' failed.", e);
+ }
+ }
+
+ File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws1697");
+ String[] generatedFiles = packageDir.list();
+ for (int i = 0; i < generatedFiles.length; i++)
+ {
+ String currentFile = generatedFiles[i];
+
+ boolean matched = "PhoneBookService.java".equals(currentFile);
+
+ for (int j = 0; j < expectedFiles.length && (matched == false); j++)
+ matched = currentFile.equals(expectedFiles[j]);
+
+ assertTrue("File '" + currentFile + "' was not expected to be generated", matched);
+ }
+
+ JaxrpcMappingValidator mappingValidator = new JaxrpcMappingValidator();
+ mappingValidator.validate(resourceDir + "/jaxrpc-mapping.xml", toolsDir + "/jaxrpc-mapping.xml");
+ }
+
+ private static void compareSource(final String expectedName, final String generatedName) throws Exception
+ {
+ File expected = new File(expectedName);
+ File generated = new File(generatedName);
+
+ JBossSourceComparator sc = new JBossSourceComparator(expected, generated);
+ sc.validate();
+ sc.validateImports();
+ }
+
+}
Property changes on: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1697/JBWS1697TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook.wsdl
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook.wsdl (rev 0)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook.wsdl 2007-06-06 10:03:39 UTC (rev 3461)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook' targetNamespace='http://test.jboss.org/ws/jbws1697'
+ xmlns='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:ns1='http://test.jboss.org/ws/jbws1697/types'
+ xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1697'
+ xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+
+ <types>
+ <schema targetNamespace='http://test.jboss.org/ws/jbws1697/types'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1697/types'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+
+ <simpleType name='Person'>
+ <restriction base='string'>
+ <pattern value="[a-zA-Z]*"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name='BillingAccount'>
+ <restriction base='string'>
+ <pattern value="[a-zA-Z]*"/>
+ </restriction>
+ </simpleType>
+
+ <element name='lookup' type='tns:Person'/>
+ <element name='account' type='tns:BillingAccount'/>
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup'>
+ <part element='ns1:lookup' name='lookup'/>
+ <part element='ns1:account' name='header'/>
+ </message>
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookup' name='lookup'/>
+ <part element='ns1:account' name='header'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ </operation>
+ </portType>
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal' parts='lookup'/>
+ <soap:header use='literal' message='tns:PhoneBook_lookup' part='header' />
+ </input>
+ <output>
+ <soap:body use='literal' parts='lookup'/>
+ <soap:header use='literal' message='tns:PhoneBook_lookupResponse' part='header' />
+ </output>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
Property changes on: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook_PortType.java
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook_PortType.java (rev 0)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook_PortType.java 2007-06-06 10:03:39 UTC (rev 3461)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 11:54:39 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+package org.jboss.test.ws.jbws1697;
+public interface PhoneBook_PortType extends java.rmi.Remote
+{
+
+ public void lookup(javax.xml.rpc.holders.StringHolder lookup, javax.xml.rpc.holders.StringHolder header) throws java.rmi.RemoteException;
+}
Property changes on: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/PhoneBook_PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/jaxrpc-mapping.xml
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/jaxrpc-mapping.xml (rev 0)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/jaxrpc-mapping.xml 2007-06-06 10:03:39 UTC (rev 3461)
@@ -0,0 +1,41 @@
+<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' 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://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1697</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1697</namespaceURI>
+ </package-mapping>
+ <service-interface-mapping>
+ <service-interface>org.jboss.test.ws.jbws1697.PhoneBook_Service</service-interface>
+ <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1697'>serviceNS:PhoneBook</wsdl-service-name>
+ <port-mapping>
+ <port-name>PhoneBookPort</port-name>
+ <java-port-name>PhoneBookPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+ <service-endpoint-interface>org.jboss.test.ws.jbws1697.PhoneBook_PortType</service-endpoint-interface>
+ <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1697'>portTypeNS:PhoneBook</wsdl-port-type>
+ <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1697'>bindingNS:PhoneBookBinding</wsdl-binding>
+ <service-endpoint-method-mapping>
+ <java-method-name>lookup</java-method-name>
+ <wsdl-operation>lookup</wsdl-operation>
+ <method-param-parts-mapping>
+ <param-position>0</param-position>
+ <param-type>java.lang.String</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1697'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
+ <wsdl-message-part-name>lookup</wsdl-message-part-name>
+ <parameter-mode>INOUT</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ <method-param-parts-mapping>
+ <param-position>1</param-position>
+ <param-type>java.lang.String</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1697'>wsdlMsgNS:PhoneBook</wsdl-message>
+ <wsdl-message-part-name>header</wsdl-message-part-name>
+ <parameter-mode>INOUT</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Property changes on: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/jaxrpc-mapping.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/wstools-config.xml
===================================================================
--- branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/wstools-config.xml (rev 0)
+++ branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/wstools-config.xml 2007-06-06 10:03:39 UTC (rev 3461)
@@ -0,0 +1,5 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1697/doclit_inout/PhoneBook.wsdl" parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
Property changes on: branches/dlofthouse/JBWS-1697/jbossws-core/src/test/resources/tools/jbws1697/doclit_inout/wstools-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbossws-commits
mailing list