Author: mageshbk(a)jboss.com
Date: 2008-01-03 12:51:00 -0500 (Thu, 03 Jan 2008)
New Revision: 5394
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1217/
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1217/JBWS1217TestCase.java
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MultiplePackageNamespace.wsdl
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEI.java
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEIService.java
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/TestException.java
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/jaxrpc-mapping.xml
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/wstools-config.xml
Modified:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-core/src/java/org/jboss/ws/tools/WSDLToJava.java
Log:
[JBWS-1900] JBWS-1217 WSDLtoJava Namespace to package mapping does not support multiple
namespaces - added testcase and fixed java file generation
Modified:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-core/src/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-core/src/java/org/jboss/ws/tools/WSDLToJava.java 2008-01-03
13:22:11 UTC (rev 5393)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-core/src/java/org/jboss/ws/tools/WSDLToJava.java 2008-01-03
17:51:00 UTC (rev 5394)
@@ -634,7 +634,7 @@
className = packageName + "." + className + arraySuffix;
if (holder)
{
- className = holderWriter.getOrCreateHolder(className,
getLocationForJavaGeneration());
+ className = holderWriter.getOrCreateHolder(className,
getLocationForJavaGeneration(packageName));
}
buf.append(className);
@@ -798,9 +798,9 @@
return paramName;
}
- private File getLocationForJavaGeneration()
+ private File getLocationForJavaGeneration(String packageName)
{
- return new File(this.directoryToGenerate + "/" +
seiPkgName.replace('.', '/'));
+ return new File(this.directoryToGenerate + "/" +
packageName.replace('.', '/'));
}
private void generateJavaSource(XSComplexTypeDefinition xt, JBossXSModel xsmodel,
String containingElement) throws IOException
@@ -815,8 +815,11 @@
String targetNS = wsdl.getTargetNamespace();
String tgtNS = xt.getNamespace();
String packName = getPackageName(tgtNS);
- //if(tgtNS.equals(targetNS))
- xtj.createJavaFile((XSComplexTypeDefinition)xt, containingElement,
getLocationForJavaGeneration(), packName, xsmodel, exception);
+ if(!tgtNS.equals(targetNS))
+ {
+ File dir = utils.createPackage(this.directoryToGenerate, packName);
+ }
+ xtj.createJavaFile((XSComplexTypeDefinition)xt, containingElement,
getLocationForJavaGeneration(packName), packName, xsmodel, exception);
}
public void setParameterStyle(String paramStyle)
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1217/JBWS1217TestCase.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1217/JBWS1217TestCase.java
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1217/JBWS1217TestCase.java 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,64 @@
+/*
+ * 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.jbws1217;
+
+import java.io.File;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+
+/**
+ * JBWS-1217 - Test the support of multiple namespace to multiple
+ * package generation of tools.
+ *
+ * @author mageshbk(a)jboss.com
+ * @since 02 Jan 2008
+ */
+public class JBWS1217TestCase extends JBossWSTest
+{
+ public final void testMultiplePackageNameSpace() throws Exception
+ {
+ String resourceDir = "resources/tools/jbws1217";
+ String toolsDir = "tools/jbws1217";
+ String[] args = new String[] { "-dest", toolsDir, "-config",
resourceDir + "/wstools-config.xml" };
+ new WSTools().generate(args);
+
+ compareSource(resourceDir + "/MySEIService.java", toolsDir +
"/org/jboss/test/ws/jbws1217/MySEIService.java");
+ compareSource(resourceDir + "/MySEI.java", toolsDir +
"/org/jboss/test/ws/jbws1217/MySEI.java");
+ compareSource(resourceDir + "/TestException.java", toolsDir +
"/com/other/TestException.java");
+
+ 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:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1217/JBWS1217TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MultiplePackageNamespace.wsdl
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MultiplePackageNamespace.wsdl
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MultiplePackageNamespace.wsdl 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='MySEIService'
targetNamespace='http://org.jboss.test.ws/jbws1217'
xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://other.com'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://org.jboss.test.ws/jbws1217'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema targetNamespace='http://other.com'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:tns='http://other.com'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <complexType name='TestException'>
+ <sequence/>
+ </complexType>
+ <element name='TestException' type='tns:TestException'/>
+ </schema>
+ </types>
+ <message name='MySEI_testException'/>
+ <message name='MySEI_testExceptionResponse'/>
+ <message name='TestException'>
+ <part element='ns1:TestException' name='TestException'/>
+ </message>
+ <portType name='MySEI'>
+ <operation name='testException'>
+ <input message='tns:MySEI_testException'/>
+ <output message='tns:MySEI_testExceptionResponse'/>
+ <fault message='tns:TestException' name='TestException'/>
+ </operation>
+ </portType>
+ <binding name='MySEIBinding' type='tns:MySEI'>
+ <soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='testException'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body namespace='http://org.jboss.test.ws/jbws1217'
use='literal'/>
+ </input>
+ <output>
+ <soap:body namespace='http://org.jboss.test.ws/jbws1217'
use='literal'/>
+ </output>
+ <fault name='TestException'>
+ <soap:fault name='TestException' use='literal'/>
+ </fault>
+ </operation>
+ </binding>
+ <service name='MySEIService'>
+ <port binding='tns:MySEIBinding' name='MySEIPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Property changes on:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MultiplePackageNamespace.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEI.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEI.java
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEI.java 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Thu Jan 03 16:38:10 IST 2008
+ *
+ * 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.jbws1217;
+public interface MySEI extends java.rmi.Remote
+{
+
+ public void testException() throws com.other.TestException, java.rmi.RemoteException;
+}
Property changes on:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEI.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEIService.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEIService.java
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEIService.java 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,19 @@
+/*
+* JBoss, the OpenSource EJB server
+* Distributable under LGPL license. See terms of license at
gnu.org.
+*/
+
+//Auto Generated by jbossws - Please do not edit!!!
+
+package org.jboss.test.ws.jbws1217;
+
+
+import javax.xml.rpc.*;
+
+
+public interface MySEIService extends javax.xml.rpc.Service
+{
+
+ public org.jboss.test.ws.jbws1217.MySEI getMySEIPort() throws ServiceException;
+
+}
Property changes on:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/MySEIService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/TestException.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/TestException.java
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/TestException.java 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,18 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Thu Jan 03 16:24:09 IST 2008
+ *
+ * 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 com.other;
+
+
+public class TestException
+ extends Exception{
+public TestException(){
+}
+}
Property changes on:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/TestException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/jaxrpc-mapping.xml
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/jaxrpc-mapping.xml
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/jaxrpc-mapping.xml 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,36 @@
+<?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>com.other</package-type>
+ <namespaceURI>http://other.com</namespaceURI>
+ </package-mapping>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1217</package-type>
+ <namespaceURI>http://org.jboss.test.ws/jbws1217</namespaceURI>
+ </package-mapping>
+ <java-xml-type-mapping>
+ <java-type>com.other.TestException</java-type>
+ <root-type-qname
xmlns:typeNS='http://other.com'>typeNS:TestException</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ </java-xml-type-mapping>
+ <exception-mapping>
+ <exception-type>com.other.TestException</exception-type>
+ <wsdl-message
xmlns:exMsgNS='http://org.jboss.test.ws/jbws1217'>exMsgNS:TestException</wsdl-message>
+ </exception-mapping>
+ <service-interface-mapping>
+
<service-interface>org.jboss.test.ws.jbws1217.MySEIService</service-interface>
+ <wsdl-service-name
xmlns:serviceNS='http://org.jboss.test.ws/jbws1217'>serviceNS:MySEIService</wsdl-service-name>
+ <port-mapping>
+ <port-name>MySEIPort</port-name>
+ <java-port-name>MySEIPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+
<service-endpoint-interface>org.jboss.test.ws.jbws1217.MySEI</service-endpoint-interface>
+ <wsdl-port-type
xmlns:portTypeNS='http://org.jboss.test.ws/jbws1217'>portTypeNS:MySEI</wsdl-port-type>
+ <wsdl-binding
xmlns:bindingNS='http://org.jboss.test.ws/jbws1217'>bindingNS:MySEIBinding</wsdl-binding>
+ <service-endpoint-method-mapping>
+ <java-method-name>testException</java-method-name>
+ <wsdl-operation>testException</wsdl-operation>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Property changes on:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/jaxrpc-mapping.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/wstools-config.xml
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/wstools-config.xml
(rev 0)
+++
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/wstools-config.xml 2008-01-03
17:51:00 UTC (rev 5394)
@@ -0,0 +1,9 @@
+<configuration
xmlns="http://www.jboss.org/jbossws-tools">
+ <global>
+ <package-namespace package="com.other"
namespace="http://other.com"/>
+ <package-namespace package="org.jboss.test.ws.jbws1217"
namespace="http://org.jboss.test.ws/jbws1217"/>
+ </global>
+ <wsdl-java
location="resources/tools/jbws1217/MultiplePackageNamespace.wsdl">
+ <mapping file="jaxrpc-mapping.xml" />
+ </wsdl-java>
+</configuration>
\ No newline at end of file
Property changes on:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/jbossws-tests/src/resources/tools/jbws1217/wstools-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF