Author: darran.lofthouse(a)jboss.com
Date: 2008-11-11 07:56:57 -0500 (Tue, 11 Nov 2008)
New Revision: 8699
Added:
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/jbws2389/JBWS2389TestCase.java
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/PhoneBook.wsdl
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/wstools-config.xml
Log:
Added initial test case.
Copied:
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/jbws2389/JBWS2389TestCase.java
(from rev 8689,
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/jbws1801/JBWS1801TestCase.java)
===================================================================
---
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/jbws2389/JBWS2389TestCase.java
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/jbws2389/JBWS2389TestCase.java 2008-11-11
12:56:57 UTC (rev 8699)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2389;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * Test case to test the following fix: -
+ *
+ * @see
http://jira.jboss.com/jira/browse/JBWS-2389
+ *
+ * WSDL To Java - WSDL To Java - Anonymous types
+ * nested within anonymous types not being processed correctly.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since Nov 10, 2008
+ */
+public class JBWS2389TestCase extends JBossWSTest
+{
+
+ public void testDocumentLiteral() throws Exception
+ {
+ generateScenario("doclit");
+ }
+
+ protected void generateScenario(final String scenario) throws Exception
+ {
+ File resourceDir = createResourceFile("tools/jbws2389/" + scenario);
+ String toolsDir = resourceDir.getAbsolutePath();
+
+ String[] args = new String[] { "-dest", toolsDir, "-config",
resourceDir.getAbsolutePath() + "/wstools-config.xml" };
+ new WSTools().generate(args);
+
+ String[] expectedFiles = resourceDir.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/jbws2389/" + currentFile);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Validation of '" + currentFile +
"' failed.", e);
+ }
+ }
+
+ File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws2389");
+ 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]);
+
+ System.out.println(packageDir.getAbsolutePath());
+ 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();
+ }
+
+}
Copied:
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/PhoneBook.wsdl
(from rev 8689,
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws1260/scenario_F/Wrapped.wsdl)
===================================================================
---
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/PhoneBook.wsdl
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/PhoneBook.wsdl 2008-11-11
12:56:57 UTC (rev 8699)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
targetNamespace='http://test.jboss.org/ws/jbws2389'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:ns1='http://test.jboss.org/ws/jbws2389/types'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://test.jboss.org/ws/jbws2389'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema
targetNamespace='http://test.jboss.org/ws/jbws2389/types'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:tns='http://test.jboss.org/ws/jbws2389/types'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+
+ <element name='lookup'>
+ <complexType>
+ <sequence>
+ <element name='Details'>
+ <complexType>
+ <sequence>
+ <element name='Name'>
+ <complexType>
+ <sequence>
+ <element name='firstName' nillable='true'
type='string'/>
+ <element name='surname' nillable='true'
type='string'/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name='lookupResponse'>
+ <complexType>
+ <sequence>
+ <element name='Details'>
+ <complexType>
+ <sequence>
+ <element name='Number'>
+ <complexType>
+ <sequence>
+ <element name='areaCode' nillable='true'
type='string'/>
+ <element name='number' nillable='true'
type='string'/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </types>
+ <message name='PhoneBook_lookup'>
+ <part element='ns1:lookup' name='parameters'/>
+ </message>
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='result'/>
+ </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'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Copied:
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/wstools-config.xml
(from rev 8689,
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws1801/doclit/wstools-config.xml)
===================================================================
---
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/wstools-config.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-2389/modules/testsuite/native-tests/src/test/resources/tools/jbws2389/doclit/wstools-config.xml 2008-11-11
12:56:57 UTC (rev 8699)
@@ -0,0 +1,6 @@
+<configuration>
+ <wsdl-java
location="${test.resources.directory}/tools/jbws2389/doclit/PhoneBook.wsdl"
+ parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>