You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/03/28 17:35:29 UTC
svn commit: r642284 [7/8] - in /incubator/cxf/branches/2.0.x-fixes:
benchmark/performance/soap_http_doc_lit/
benchmark/performance/soap_http_doc_lit/src/org/apache/cxf/performance/complex_type/client/
benchmark/performance/soap_http_doc_lit/src/org/apa...
Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java Fri Mar 28 09:33:52 2008
@@ -1,328 +1,328 @@
-/**
- * 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.
- */
-package org.apache.cxf.tools.java2ws;
-
-import java.io.File;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import org.apache.cxf.helpers.FileUtils;
-import org.apache.cxf.tools.common.ToolContext;
-import org.apache.cxf.tools.common.ToolTestBase;
-import org.apache.cxf.tools.util.Compiler;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class JavaToWSTest extends ToolTestBase {
- protected String cp;
- protected ToolContext env;
- protected File output;
- protected File classDir;
-
- @Before
- public void setUpResource() throws Exception {
- super.setUp();
- env = new ToolContext();
- cp = System.getProperty("java.class.path");
- URL url = getClass().getResource(".");
- output = new File(url.toURI());
- System.setProperty("java.class.path", getClassPath());
- output = new File(output, "/generated/");
- FileUtils.mkDir(output);
- classDir = new File(output, "/classes/");
- FileUtils.mkDir(classDir);
- }
-
- @After
- public void tearDown() {
- super.tearDown();
- System.setProperty("java.class.path", cp);
- FileUtils.removeDir(output);
- output = null;
- }
-
- private File outputFile(String name) {
- return new File(output.getPath() + File.separator + name);
- }
-
- @Test
- public void testVersionOutput() throws Exception {
- String[] args = new String[] {"-v"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
- }
-
- @Test
- public void testFlagWSDL() throws Exception {
- File wsdlFile = outputFile("tmp.wsdl");
- String[] args = new String[] {"-wsdl", "-o", wsdlFile.getAbsolutePath(), "-s", output.getPath(),
- "-client", "-server", "org.apache.hello_world_soap12_http.Greeter"};
- JavaToWS.main(args);
- checkStdErr();
- assertTrue("Failed to generate WSDL file", wsdlFile.exists());
- }
-
- private void checkStdErr() {
- String err = getStdErr();
- if (err != null) {
- assertEquals("errors: ", "", err);
- }
- }
-
- @Test
- public void testJaxwsFrontend() throws Exception {
- File wsdlFile = outputFile("tmp.wsdl");
- String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-s",
- output.getPath(), "-frontend", "jaxws", "-client", "-server",
- "-address", "http://localhost:1234/test",
- "org.apache.hello_world_doc_lit.Greeter"};
- JavaToWS.main(args);
- checkStdErr();
- assertTrue("Failed to generate WSDL file", wsdlFile.exists());
- String str = FileUtils.getStringFromFile(wsdlFile);
- assertTrue("Port address in generated wsdl is not correct",
- str.indexOf("http://localhost:1234/test") > -1);
- File client = outputFile("org/apache/hello_world_doc_lit/GreeterClient.java");
- str = FileUtils.getStringFromFile(client);
- assertTrue("Address generated in client side code is not correct",
- str.indexOf("http://localhost:1234/test") > -1);
-
- File server = outputFile("org/apache/hello_world_doc_lit/GreeterServer.java");
- str = FileUtils.getStringFromFile(server);
- assertTrue("Address generated in server side code is not correct",
- str.indexOf("http://localhost:1234/test") > -1);
-
- File impl = outputFile("org/apache/hello_world_doc_lit/GreeterImpl.java");
- Compiler compiler = new Compiler();
- String[] files = new String[]{client.getAbsoluteFile().toString(),
- server.getAbsoluteFile().toString(),
- impl.getAbsoluteFile().toString()};
- compiler.compileFiles(files, this.classDir);
- }
-
- @Test
- public void testSimpleFrontend() throws Exception {
- String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-s",
- output.getPath(), "-frontend", "simple", "-client", "-server",
- "-address", "http://localhost:1234/test",
- "org.apache.cxf.tools.fortest.simple.Hello"};
- JavaToWS.main(args);
- File client = outputFile("org/apache/cxf/tools/fortest/simple/HelloPortTypeClient.java");
- File server = outputFile("org/apache/cxf/tools/fortest/simple/HelloPortTypeServer.java");
- File impl = outputFile("org/apache/cxf/tools/fortest/simple/HelloPortTypeImpl.java");
- File wsdl = outputFile("tmp.wsdl");
- assertTrue("Failed to generate client file for simple front end ", client.exists());
- assertTrue("Failed to generate server file for simple front end ", server.exists());
- assertTrue("Failed to generate impl file for simple front end ", impl.exists());
- assertTrue("Failed to generate wsdl file for simple front end ", wsdl.exists());
-
- String str = FileUtils.getStringFromFile(client);
- assertTrue("Address generated in client side code is not correct",
- str.indexOf("http://localhost:1234/test") > -1);
- str = FileUtils.getStringFromFile(server);
- assertTrue("Address generated in server side code is not correct",
- str.indexOf("http://localhost:1234/test") > -1);
- str = FileUtils.getStringFromFile(wsdl);
- assertTrue("Address generated in wsdl is not correct",
- str.indexOf("http://localhost:1234/test") > -1);
-
-
- Compiler compiler = new Compiler();
- String[] files = new String[]{client.getAbsoluteFile().toString(),
- server.getAbsoluteFile().toString(),
- impl.getAbsoluteFile().toString()};
- compiler.compileFiles(files, this.classDir);
-
-
- }
-
- @Test
- public void testMissingBeans() {
- String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose", "-s",
- output.getPath(), "-frontend", "jaxws", "-client", "-server",
- "-beans", "nobodyHome.xml",
- "-beans", "nothing.xml",
- "org.apache.hello_world_doc_lit.Greeter"};
- JavaToWS.main(args);
- String err = getStdErr();
- assertTrue("Missing file error message",
- err.indexOf("Unable to open bean definition file nobodyHome.xml") >= 0);
- }
-
- @Test
- public void testClassNoWebServiceAnno() throws Exception {
- File wsdlFile = outputFile("tmp.wsdl");
- String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose", "-s",
- output.getPath(), "-frontend", "jaxws", "-client", "-server",
- "org.apache.cxf.tools.fortest.HelloWithNoAnno"};
- JavaToWS.main(args);
- assertTrue("Failed to generate WSDL file", wsdlFile.exists());
- assertTrue("Class does not carry WebService error should be detected", getStdErr()
- .indexOf("does not carry a WebService annotation") > -1);
- }
-
- @Test
- public void testClassWithRMI() throws Exception {
- File wsdlFile = outputFile("tmp.wsdl");
- String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
- "-s", output.getPath(), "-frontend", "jaxws", "-client", "-server",
- "org.apache.cxf.tools.fortest.HelloRMI"};
- JavaToWS.main(args);
- assertTrue("Failed to generate WSDL file", wsdlFile.exists());
- assertTrue("Parameter or return type implemented java.rmi.Remote interface error should be detected",
- getStdErr().indexOf("implemented the java.rmi.Remote interface") > -1);
- }
-
- @Test
- public void testGenServerAndClient() throws Exception {
- File client = outputFile("org/apache/hello_world_soap12_http/GreeterClient.java");
- File server = outputFile("org/apache/hello_world_soap12_http/GreeterServer.java");
- File impl = outputFile("org/apache/hello_world_soap12_http/GreeterImpl.java");
- String[] args = new String[] {"-s", output.getPath(), "-client", "-server",
- "org.apache.hello_world_soap12_http.Greeter"};
- JavaToWS.main(args);
- checkStdErr();
- assertTrue("Client was not generated", client.exists());
- assertTrue("Greeter_GreeterPort_Server.java was not generated", server.exists());
- assertTrue("Impl was not generated", impl.exists());
- String implContent = FileUtils.getStringFromFile(impl);
- assertTrue("serviceName annotation was not generated",
- implContent.indexOf("serviceName=\"GreeterService\"") > -1);
- }
-
- @Test
- public void testGenServerAndImpl() throws Exception {
- File server = outputFile("org/apache/hello_world_soap12_http/GreeterServer.java");
- File impl = outputFile("org/apache/hello_world_soap12_http/GreeterImpl.java");
-
- String[] args = new String[] {"-s", output.getPath(), "-server",
- "org.apache.hello_world_soap12_http.Greeter"};
- JavaToWS.main(args);
- checkStdErr();
- assertTrue("GreeterServer.java was not generated", server.exists());
- assertTrue("GreeterImpl.java was not generated", impl.exists());
- }
-
- @Test
- public void testGenWrapperBean() throws Exception {
- String[] args = new String[] {"-s", output.getPath(), "-wrapperbean", "-server",
- "org.apache.cxf.tools.java2ws.fortest.Calculator"};
- JavaToWS.main(args);
- checkStdErr();
- }
-
- @Test
- public void testInvalidFlag() throws Exception {
- String[] args = new String[] {"-frontend", "tmp", "-wsdl", "-o", output.getPath() + "/tmp.wsdl",
- "org.apache.hello_world_soap12_http.Greeter"};
- JavaToWS.main(args);
- assertTrue("invalid frontend flag should be detected", getStdErr()
- .indexOf("is not a valid frontend,") > -1);
- }
-
- @Test
- public void testInvalidFlag2() throws Exception {
- String[] args = new String[] {"-frontend", "simple", "-wrapperbean", "-wsdl", "-o",
- output.getPath() + "/tmp.wsdl",
- "org.apache.hello_world_soap12_http.Greeter"};
- JavaToWS.main(args);
- assertTrue("wrapperbean flag error should be detected", getStdErr()
- .indexOf("-wrapperbean is only valid for the jaxws front end.") > -1);
- }
-
- @Test
- public void testInvalidFlag3() throws Exception {
- String[] args = new String[] {"-databinding", "jaxb", "-frontend", "simple",
- "-wsdl", "-o",
- output.getPath() + "/tmp.wsdl",
- "org.apache.hello_world_soap12_http.Greeter"};
- JavaToWS.main(args);
- assertTrue("jaxb databinding warning should be detected", getStdErr()
- .indexOf("Simple front end only supports aegis databinding") > -1);
- }
-
-
- @Test
- public void testImplClassWithoutSei() throws Exception {
- File wsdlFile = outputFile("tmp.wsdl");
- String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose", "-s",
- output.getPath(), "-frontend", "jaxws", "-client", "-server",
- "org.apache.cxf.tools.fortest.GreeterImpl"};
- JavaToWS.main(args);
- assertTrue("Failed to generate WSDL file", wsdlFile.exists());
-
- File sei = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortType.java");
- assertTrue("Failed to generate SEI file : GreeterImpl_PortType.java", sei.exists());
- File client = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeClient.java");
- assertTrue("Failed to generate client file : GreeterImpl_PortTypeClient.java", client.exists());
- File server = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeServer.java");
- assertTrue("Failed to generate SEI file : GreeterImpl_PortTypeServer.java", server.exists());
- }
-
- @Test
- public void testXmlList() throws Exception {
- String[] args = new String[] {"-o", output.getPath() + "/xml-list.wsdl", "-verbose",
- "-wsdl", "org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType"};
- JavaToWS.main(args);
-
- File file = new File(output.getPath() + "/xml-list.wsdl");
- String str = FileUtils.getStringFromFile(file);
- assertTrue("Java2wsdl did not generate xsd:list element",
- str.indexOf("<xsd:list itemType=") > -1);
-
- }
-
- @Test
- public void testXmlAttachementRef() throws Exception {
- String[] args = new String[] {"-o", output.getPath() + "/swa-ref.wsdl", "-verbose",
- "-wsdl", "org.apache.attachment.AddNumbersImpl"};
- JavaToWS.main(args);
- File file = new File(output.getPath() + "/AddNumbers.wsdl");
- String str = FileUtils.getStringFromFile(file);
- String swaImport = "<xsd:import namespace=\"http://ws-i.org/profiles/basic/1.1/xsd\""
- + " schemaLocation=\"http://ws-i.org/profiles/basic/1.1/swaref.xsd\"";
-
- assertTrue("Java2wsdl did not generate swaRef type element",
- str.indexOf(":swaRef") > -1 && str.indexOf(swaImport) > -1);
-
- }
-
-
- protected String getClassPath() throws URISyntaxException {
- ClassLoader loader = getClass().getClassLoader();
- StringBuffer classPath = new StringBuffer();
- if (loader instanceof URLClassLoader) {
- URLClassLoader urlLoader = (URLClassLoader)loader;
- for (URL url : urlLoader.getURLs()) {
- File file;
- file = new File(url.toURI());
- String filename = file.getAbsolutePath();
- if (filename.indexOf("junit") == -1) {
- classPath.append(filename);
- classPath.append(System.getProperty("path.separator"));
- }
- }
- }
- return classPath.toString();
- }
-
-}
+/**
+ * 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.
+ */
+package org.apache.cxf.tools.java2ws;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.ToolTestBase;
+import org.apache.cxf.tools.util.Compiler;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JavaToWSTest extends ToolTestBase {
+ protected String cp;
+ protected ToolContext env;
+ protected File output;
+ protected File classDir;
+
+ @Before
+ public void setUpResource() throws Exception {
+ super.setUp();
+ env = new ToolContext();
+ cp = System.getProperty("java.class.path");
+ URL url = getClass().getResource(".");
+ output = new File(url.toURI());
+ System.setProperty("java.class.path", getClassPath());
+ output = new File(output, "/generated/");
+ FileUtils.mkDir(output);
+ classDir = new File(output, "/classes/");
+ FileUtils.mkDir(classDir);
+ }
+
+ @After
+ public void tearDown() {
+ super.tearDown();
+ System.setProperty("java.class.path", cp);
+ FileUtils.removeDir(output);
+ output = null;
+ }
+
+ private File outputFile(String name) {
+ return new File(output.getPath() + File.separator + name);
+ }
+
+ @Test
+ public void testVersionOutput() throws Exception {
+ String[] args = new String[] {"-v"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+ }
+
+ @Test
+ public void testFlagWSDL() throws Exception {
+ File wsdlFile = outputFile("tmp.wsdl");
+ String[] args = new String[] {"-wsdl", "-o", wsdlFile.getAbsolutePath(), "-s", output.getPath(),
+ "-client", "-server", "org.apache.hello_world_soap12_http.Greeter"};
+ JavaToWS.main(args);
+ checkStdErr();
+ assertTrue("Failed to generate WSDL file", wsdlFile.exists());
+ }
+
+ private void checkStdErr() {
+ String err = getStdErr();
+ if (err != null) {
+ assertEquals("errors: ", "", err);
+ }
+ }
+
+ @Test
+ public void testJaxwsFrontend() throws Exception {
+ File wsdlFile = outputFile("tmp.wsdl");
+ String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-s",
+ output.getPath(), "-frontend", "jaxws", "-client", "-server",
+ "-address", "http://localhost:1234/test",
+ "org.apache.hello_world_doc_lit.Greeter"};
+ JavaToWS.main(args);
+ checkStdErr();
+ assertTrue("Failed to generate WSDL file", wsdlFile.exists());
+ String str = FileUtils.getStringFromFile(wsdlFile);
+ assertTrue("Port address in generated wsdl is not correct",
+ str.indexOf("http://localhost:1234/test") > -1);
+ File client = outputFile("org/apache/hello_world_doc_lit/GreeterClient.java");
+ str = FileUtils.getStringFromFile(client);
+ assertTrue("Address generated in client side code is not correct",
+ str.indexOf("http://localhost:1234/test") > -1);
+
+ File server = outputFile("org/apache/hello_world_doc_lit/GreeterServer.java");
+ str = FileUtils.getStringFromFile(server);
+ assertTrue("Address generated in server side code is not correct",
+ str.indexOf("http://localhost:1234/test") > -1);
+
+ File impl = outputFile("org/apache/hello_world_doc_lit/GreeterImpl.java");
+ Compiler compiler = new Compiler();
+ String[] files = new String[]{client.getAbsoluteFile().toString(),
+ server.getAbsoluteFile().toString(),
+ impl.getAbsoluteFile().toString()};
+ compiler.compileFiles(files, this.classDir);
+ }
+
+ @Test
+ public void testSimpleFrontend() throws Exception {
+ String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-s",
+ output.getPath(), "-frontend", "simple", "-client", "-server",
+ "-address", "http://localhost:1234/test",
+ "org.apache.cxf.tools.fortest.simple.Hello"};
+ JavaToWS.main(args);
+ File client = outputFile("org/apache/cxf/tools/fortest/simple/HelloPortTypeClient.java");
+ File server = outputFile("org/apache/cxf/tools/fortest/simple/HelloPortTypeServer.java");
+ File impl = outputFile("org/apache/cxf/tools/fortest/simple/HelloPortTypeImpl.java");
+ File wsdl = outputFile("tmp.wsdl");
+ assertTrue("Failed to generate client file for simple front end ", client.exists());
+ assertTrue("Failed to generate server file for simple front end ", server.exists());
+ assertTrue("Failed to generate impl file for simple front end ", impl.exists());
+ assertTrue("Failed to generate wsdl file for simple front end ", wsdl.exists());
+
+ String str = FileUtils.getStringFromFile(client);
+ assertTrue("Address generated in client side code is not correct",
+ str.indexOf("http://localhost:1234/test") > -1);
+ str = FileUtils.getStringFromFile(server);
+ assertTrue("Address generated in server side code is not correct",
+ str.indexOf("http://localhost:1234/test") > -1);
+ str = FileUtils.getStringFromFile(wsdl);
+ assertTrue("Address generated in wsdl is not correct",
+ str.indexOf("http://localhost:1234/test") > -1);
+
+
+ Compiler compiler = new Compiler();
+ String[] files = new String[]{client.getAbsoluteFile().toString(),
+ server.getAbsoluteFile().toString(),
+ impl.getAbsoluteFile().toString()};
+ compiler.compileFiles(files, this.classDir);
+
+
+ }
+
+ @Test
+ public void testMissingBeans() {
+ String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose", "-s",
+ output.getPath(), "-frontend", "jaxws", "-client", "-server",
+ "-beans", "nobodyHome.xml",
+ "-beans", "nothing.xml",
+ "org.apache.hello_world_doc_lit.Greeter"};
+ JavaToWS.main(args);
+ String err = getStdErr();
+ assertTrue("Missing file error message",
+ err.indexOf("Unable to open bean definition file nobodyHome.xml") >= 0);
+ }
+
+ @Test
+ public void testClassNoWebServiceAnno() throws Exception {
+ File wsdlFile = outputFile("tmp.wsdl");
+ String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose", "-s",
+ output.getPath(), "-frontend", "jaxws", "-client", "-server",
+ "org.apache.cxf.tools.fortest.HelloWithNoAnno"};
+ JavaToWS.main(args);
+ assertTrue("Failed to generate WSDL file", wsdlFile.exists());
+ assertTrue("Class does not carry WebService error should be detected", getStdErr()
+ .indexOf("does not carry a WebService annotation") > -1);
+ }
+
+ @Test
+ public void testClassWithRMI() throws Exception {
+ File wsdlFile = outputFile("tmp.wsdl");
+ String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
+ "-s", output.getPath(), "-frontend", "jaxws", "-client", "-server",
+ "org.apache.cxf.tools.fortest.HelloRMI"};
+ JavaToWS.main(args);
+ assertTrue("Failed to generate WSDL file", wsdlFile.exists());
+ assertTrue("Parameter or return type implemented java.rmi.Remote interface error should be detected",
+ getStdErr().indexOf("implemented the java.rmi.Remote interface") > -1);
+ }
+
+ @Test
+ public void testGenServerAndClient() throws Exception {
+ File client = outputFile("org/apache/hello_world_soap12_http/GreeterClient.java");
+ File server = outputFile("org/apache/hello_world_soap12_http/GreeterServer.java");
+ File impl = outputFile("org/apache/hello_world_soap12_http/GreeterImpl.java");
+ String[] args = new String[] {"-s", output.getPath(), "-client", "-server",
+ "org.apache.hello_world_soap12_http.Greeter"};
+ JavaToWS.main(args);
+ checkStdErr();
+ assertTrue("Client was not generated", client.exists());
+ assertTrue("Greeter_GreeterPort_Server.java was not generated", server.exists());
+ assertTrue("Impl was not generated", impl.exists());
+ String implContent = FileUtils.getStringFromFile(impl);
+ assertTrue("serviceName annotation was not generated",
+ implContent.indexOf("serviceName=\"GreeterService\"") > -1);
+ }
+
+ @Test
+ public void testGenServerAndImpl() throws Exception {
+ File server = outputFile("org/apache/hello_world_soap12_http/GreeterServer.java");
+ File impl = outputFile("org/apache/hello_world_soap12_http/GreeterImpl.java");
+
+ String[] args = new String[] {"-s", output.getPath(), "-server",
+ "org.apache.hello_world_soap12_http.Greeter"};
+ JavaToWS.main(args);
+ checkStdErr();
+ assertTrue("GreeterServer.java was not generated", server.exists());
+ assertTrue("GreeterImpl.java was not generated", impl.exists());
+ }
+
+ @Test
+ public void testGenWrapperBean() throws Exception {
+ String[] args = new String[] {"-s", output.getPath(), "-wrapperbean", "-server",
+ "org.apache.cxf.tools.java2ws.fortest.Calculator"};
+ JavaToWS.main(args);
+ checkStdErr();
+ }
+
+ @Test
+ public void testInvalidFlag() throws Exception {
+ String[] args = new String[] {"-frontend", "tmp", "-wsdl", "-o", output.getPath() + "/tmp.wsdl",
+ "org.apache.hello_world_soap12_http.Greeter"};
+ JavaToWS.main(args);
+ assertTrue("invalid frontend flag should be detected", getStdErr()
+ .indexOf("is not a valid frontend,") > -1);
+ }
+
+ @Test
+ public void testInvalidFlag2() throws Exception {
+ String[] args = new String[] {"-frontend", "simple", "-wrapperbean", "-wsdl", "-o",
+ output.getPath() + "/tmp.wsdl",
+ "org.apache.hello_world_soap12_http.Greeter"};
+ JavaToWS.main(args);
+ assertTrue("wrapperbean flag error should be detected", getStdErr()
+ .indexOf("-wrapperbean is only valid for the jaxws front end.") > -1);
+ }
+
+ @Test
+ public void testInvalidFlag3() throws Exception {
+ String[] args = new String[] {"-databinding", "jaxb", "-frontend", "simple",
+ "-wsdl", "-o",
+ output.getPath() + "/tmp.wsdl",
+ "org.apache.hello_world_soap12_http.Greeter"};
+ JavaToWS.main(args);
+ assertTrue("jaxb databinding warning should be detected", getStdErr()
+ .indexOf("Simple front end only supports aegis databinding") > -1);
+ }
+
+
+ @Test
+ public void testImplClassWithoutSei() throws Exception {
+ File wsdlFile = outputFile("tmp.wsdl");
+ String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose", "-s",
+ output.getPath(), "-frontend", "jaxws", "-client", "-server",
+ "org.apache.cxf.tools.fortest.GreeterImpl"};
+ JavaToWS.main(args);
+ assertTrue("Failed to generate WSDL file", wsdlFile.exists());
+
+ File sei = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortType.java");
+ assertTrue("Failed to generate SEI file : GreeterImpl_PortType.java", sei.exists());
+ File client = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeClient.java");
+ assertTrue("Failed to generate client file : GreeterImpl_PortTypeClient.java", client.exists());
+ File server = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeServer.java");
+ assertTrue("Failed to generate SEI file : GreeterImpl_PortTypeServer.java", server.exists());
+ }
+
+ @Test
+ public void testXmlList() throws Exception {
+ String[] args = new String[] {"-o", output.getPath() + "/xml-list.wsdl", "-verbose",
+ "-wsdl", "org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType"};
+ JavaToWS.main(args);
+
+ File file = new File(output.getPath() + "/xml-list.wsdl");
+ String str = FileUtils.getStringFromFile(file);
+ assertTrue("Java2wsdl did not generate xsd:list element",
+ str.indexOf("<xsd:list itemType=") > -1);
+
+ }
+
+ @Test
+ public void testXmlAttachementRef() throws Exception {
+ String[] args = new String[] {"-o", output.getPath() + "/swa-ref.wsdl", "-verbose",
+ "-wsdl", "org.apache.attachment.AddNumbersImpl"};
+ JavaToWS.main(args);
+ File file = new File(output.getPath() + "/AddNumbers.wsdl");
+ String str = FileUtils.getStringFromFile(file);
+ String swaImport = "<xsd:import namespace=\"http://ws-i.org/profiles/basic/1.1/xsd\""
+ + " schemaLocation=\"http://ws-i.org/profiles/basic/1.1/swaref.xsd\"";
+
+ assertTrue("Java2wsdl did not generate swaRef type element",
+ str.indexOf(":swaRef") > -1 && str.indexOf(swaImport) > -1);
+
+ }
+
+
+ protected String getClassPath() throws URISyntaxException {
+ ClassLoader loader = getClass().getClassLoader();
+ StringBuffer classPath = new StringBuffer();
+ if (loader instanceof URLClassLoader) {
+ URLClassLoader urlLoader = (URLClassLoader)loader;
+ for (URL url : urlLoader.getURLs()) {
+ File file;
+ file = new File(url.toURI());
+ String filename = file.getAbsolutePath();
+ if (filename.indexOf("junit") == -1) {
+ classPath.append(filename);
+ classPath.append(System.getProperty("path.separator"));
+ }
+ }
+ }
+ return classPath.toString();
+ }
+
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/AddException.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/AddException.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/AddException.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/AddException.java Fri Mar 28 09:33:52 2008
@@ -1,29 +1,29 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.java2ws.fortest;
-
-/**
- *
- */
-public class AddException extends Exception {
- public AddException(String message) {
- super(message);
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.java2ws.fortest;
+
+/**
+ *
+ */
+public class AddException extends Exception {
+ public AddException(String message) {
+ super(message);
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/AddException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/Calculator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/Calculator.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/Calculator.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/Calculator.java Fri Mar 28 09:33:52 2008
@@ -1,28 +1,28 @@
-/**
- * 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.
- */
-package org.apache.cxf.tools.java2ws.fortest;
-
-public class Calculator {
- public int add(int a, int b) throws AddException {
- if (a < 0 || b < 0) {
- throw new AddException("No negative values please");
- }
- return a + b;
- }
-}
+/**
+ * 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.
+ */
+package org.apache.cxf.tools.java2ws.fortest;
+
+public class Calculator {
+ public int add(int a, int b) throws AddException {
+ if (a < 0 || b < 0) {
+ throw new AddException("No negative values please");
+ }
+ return a + b;
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/fortest/Calculator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/JavaToWSFlagTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/JavaToWSFlagTest.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/JavaToWSFlagTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/JavaToWSFlagTest.java Fri Mar 28 09:33:52 2008
@@ -1,89 +1,89 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.java2wsdl;
-
-import org.apache.cxf.tools.common.ToolTestBase;
-import org.apache.cxf.tools.java2ws.JavaToWS;
-import org.junit.After;
-import org.junit.Test;
-
-public class JavaToWSFlagTest extends ToolTestBase {
-
- @After
- public void tearDown() {
- super.tearDown();
- }
-
- @Test
- public void testVersionOutput() throws Exception {
- String[] args = new String[] {"-v"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
- }
-
- @Test
- public void testHelpOutput() {
- String[] args = new String[] {"-help"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
- }
-
- @Test
- public void testNormalArgs() throws Exception {
- System.err.println(getLocation("test.wsdl"));
- String[] args = new String[] {"-o",
- getLocation("normal.wsdl"),
- "org.apache.hello_world_soap_http.Greeter"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
- }
-
- @Test
- public void testBadUsage() {
- String[] args = new String[] {"-ttt", "a.ww"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
-
- }
-
- @Test
- public void testValidArgs() {
- String[] args = new String[] {"a.ww"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
-
- }
-
- @Test
- public void testNoOutPutFile() throws Exception {
- String[] args = new String[] {"-o",
- getLocation("nooutput.wsdl"),
- "org.apache.hello_world_soap_http.Greeter"};
- JavaToWS.main(args);
- assertNotNull(getStdOut());
- }
-
- @Test
- public void testNoArg() {
- String[] args = new String[] {};
- JavaToWS.main(args);
- assertEquals(-1, getStdOut().indexOf("Caused by:"));
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.java2wsdl;
+
+import org.apache.cxf.tools.common.ToolTestBase;
+import org.apache.cxf.tools.java2ws.JavaToWS;
+import org.junit.After;
+import org.junit.Test;
+
+public class JavaToWSFlagTest extends ToolTestBase {
+
+ @After
+ public void tearDown() {
+ super.tearDown();
+ }
+
+ @Test
+ public void testVersionOutput() throws Exception {
+ String[] args = new String[] {"-v"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+ }
+
+ @Test
+ public void testHelpOutput() {
+ String[] args = new String[] {"-help"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+ }
+
+ @Test
+ public void testNormalArgs() throws Exception {
+ System.err.println(getLocation("test.wsdl"));
+ String[] args = new String[] {"-o",
+ getLocation("normal.wsdl"),
+ "org.apache.hello_world_soap_http.Greeter"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+ }
+
+ @Test
+ public void testBadUsage() {
+ String[] args = new String[] {"-ttt", "a.ww"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+
+ }
+
+ @Test
+ public void testValidArgs() {
+ String[] args = new String[] {"a.ww"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+
+ }
+
+ @Test
+ public void testNoOutPutFile() throws Exception {
+ String[] args = new String[] {"-o",
+ getLocation("nooutput.wsdl"),
+ "org.apache.hello_world_soap_http.Greeter"};
+ JavaToWS.main(args);
+ assertNotNull(getStdOut());
+ }
+
+ @Test
+ public void testNoArg() {
+ String[] args = new String[] {};
+ JavaToWS.main(args);
+ assertEquals(-1, getStdOut().indexOf("Caused by:"));
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/JavaToWSFlagTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/AbstractGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/AbstractGeneratorTest.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/AbstractGeneratorTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/AbstractGeneratorTest.java Fri Mar 28 09:33:52 2008
@@ -1,68 +1,68 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.wsdlto.core;
-
-import java.io.Writer;
-
-import org.apache.cxf.tools.common.ProcessorTestBase;
-import org.apache.cxf.tools.common.ToolConstants;
-import org.apache.cxf.tools.common.ToolContext;
-import org.apache.cxf.tools.util.FileWriterUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AbstractGeneratorTest extends ProcessorTestBase {
-
- DummyGenerator gen;
- ToolContext context;
- FileWriterUtil util;
-
- String packageName = "org.apache";
- String className = "Hello";
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- gen = new DummyGenerator();
- util = new FileWriterUtil(output.toString());
-
- context = new ToolContext();
- context.put(ToolConstants.CFG_OUTPUTDIR, output.toString());
- gen.setEnvironment(context);
-
- Writer writer = util.getWriter(packageName, className + ".java");
- writer.write("hello world");
- writer.flush();
- writer.close();
- }
-
- @Test
- public void testKeep() throws Exception {
- context.put(ToolConstants.CFG_GEN_NEW_ONLY, "keep");
- assertNull(gen.parseOutputName(packageName, className));
- }
-
- @Test
- public void testOverwrite() throws Exception {
- assertNotNull(gen.parseOutputName(packageName, className));
- }
-}
-
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.wsdlto.core;
+
+import java.io.Writer;
+
+import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.util.FileWriterUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AbstractGeneratorTest extends ProcessorTestBase {
+
+ DummyGenerator gen;
+ ToolContext context;
+ FileWriterUtil util;
+
+ String packageName = "org.apache";
+ String className = "Hello";
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ gen = new DummyGenerator();
+ util = new FileWriterUtil(output.toString());
+
+ context = new ToolContext();
+ context.put(ToolConstants.CFG_OUTPUTDIR, output.toString());
+ gen.setEnvironment(context);
+
+ Writer writer = util.getWriter(packageName, className + ".java");
+ writer.write("hello world");
+ writer.flush();
+ writer.close();
+ }
+
+ @Test
+ public void testKeep() throws Exception {
+ context.put(ToolConstants.CFG_GEN_NEW_ONLY, "keep");
+ assertNull(gen.parseOutputName(packageName, className));
+ }
+
+ @Test
+ public void testOverwrite() throws Exception {
+ assertNotNull(gen.parseOutputName(packageName, className));
+ }
+}
+
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/AbstractGeneratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/DummyGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/DummyGenerator.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/DummyGenerator.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/DummyGenerator.java Fri Mar 28 09:33:52 2008
@@ -1,36 +1,36 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.wsdlto.core;
-
-import org.apache.cxf.tools.common.ToolContext;
-import org.apache.cxf.tools.util.ClassCollector;
-
-public class DummyGenerator extends AbstractGenerator {
- public DummyGenerator() {
- super();
- this.name = "dummy";
- }
- public void register(ClassCollector collector, String packageName, String fileName) {
- // empty
- }
- public void generate(ToolContext context) {
- // empty
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.wsdlto.core;
+
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.util.ClassCollector;
+
+public class DummyGenerator extends AbstractGenerator {
+ public DummyGenerator() {
+ super();
+ this.name = "dummy";
+ }
+ public void register(ClassCollector collector, String packageName, String fileName) {
+ // empty
+ }
+ public void generate(ToolContext context) {
+ // empty
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/DummyGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/WrapperElement.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/WrapperElement.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/WrapperElement.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/WrapperElement.java Fri Mar 28 09:33:52 2008
@@ -1,57 +1,57 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal;
-
-import javax.xml.namespace.QName;
-
-public final class WrapperElement {
-
- private QName elementName;
-
- private QName schemaTypeName;
-
- public WrapperElement() {
- }
-
- public WrapperElement(QName en, QName tn) {
- this.elementName = en;
- this.schemaTypeName = tn;
- }
-
- public QName getElementName() {
- return elementName;
- }
-
- public void setElementName(final QName newElementName) {
- this.elementName = newElementName;
- }
-
- public QName getSchemaTypeName() {
- return schemaTypeName;
- }
-
- public void setSchemaTypeName(final QName newSchemaTypeName) {
- this.schemaTypeName = newSchemaTypeName;
- }
-
- public String toString() {
- return elementName.toString() + " " + schemaTypeName.toString();
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal;
+
+import javax.xml.namespace.QName;
+
+public final class WrapperElement {
+
+ private QName elementName;
+
+ private QName schemaTypeName;
+
+ public WrapperElement() {
+ }
+
+ public WrapperElement(QName en, QName tn) {
+ this.elementName = en;
+ this.schemaTypeName = tn;
+ }
+
+ public QName getElementName() {
+ return elementName;
+ }
+
+ public void setElementName(final QName newElementName) {
+ this.elementName = newElementName;
+ }
+
+ public QName getSchemaTypeName() {
+ return schemaTypeName;
+ }
+
+ public void setSchemaTypeName(final QName newSchemaTypeName) {
+ this.schemaTypeName = newSchemaTypeName;
+ }
+
+ public String toString() {
+ return elementName.toString() + " " + schemaTypeName.toString();
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/WrapperElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/Messages.properties?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/Messages.properties (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/Messages.properties Fri Mar 28 09:33:52 2008
@@ -1,22 +1,22 @@
-#
-#
-# 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.
-#
-#
-NON_UNIQUE_BODY = Non unique body parts! In a port, operations must have unique operation signaure on the wire for successful dispatch. In port {0}, Operations \"{1}\" and \"{2}\" have the same request body block {3}
+#
+#
+# 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.
+#
+#
+NON_UNIQUE_BODY = Non unique body parts! In a port, operations must have unique operation signaure on the wire for successful dispatch. In port {0}, Operations \"{1}\" and \"{2}\" have the same request body block {3}
WRAPPER_STYLE_NAME_COLLISION = Element {0} has Having the same name with different types[{1} -- {2}], In wrapper style, there is a collision as per the spec.
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/Messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java Fri Mar 28 09:33:52 2008
@@ -1,92 +1,92 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.wsdlto.frontend.jaxws.validator;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-import javax.xml.namespace.QName;
-
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.validator.ServiceValidator;
-
-public class UniqueBodyValidator extends ServiceValidator {
- public static final Logger LOG = LogUtils.getL7dLogger(UniqueBodyValidator.class);
-
- public UniqueBodyValidator() {
- }
-
- public UniqueBodyValidator(ServiceInfo s) {
- this.service = s;
- }
-
- @Override
- public boolean isValid() {
- return checkUniqueBody();
- }
-
- private boolean checkUniqueBody() {
- Collection<EndpointInfo> endpoints = service.getEndpoints();
- if (endpoints != null) {
- for (EndpointInfo endpoint : endpoints) {
- if (!isValidEndpoint(endpoint)) {
- return false;
- }
- }
- }
- return true;
- }
-
- private boolean isValidEndpoint(EndpointInfo endpoint) {
- BindingInfo binding = endpoint.getBinding();
- Map<QName, QName> uniqueNames = new HashMap<QName, QName>();
-
- Collection<BindingOperationInfo> bos = binding.getOperations();
- for (BindingOperationInfo bo : bos) {
- OperationInfo op = binding.getInterface().getOperation(bo.getName());
- if (op.getInput() != null
- && op.getInput().getMessageParts().size() == 1) {
- MessagePartInfo part = op.getInput().getMessageParts().iterator().next();
- if (part.getElementQName() == null) {
- continue;
- }
- QName mName = part.getElementQName();
- QName opName = uniqueNames.get(mName);
- if (opName != null) {
- Message msg = new Message("NON_UNIQUE_BODY", LOG,
- endpoint.getName(), op.getName(), opName, mName);
- addErrorMessage(msg.toString());
- return false;
- } else {
- uniqueNames.put(mName, op.getName());
- }
- }
- }
- return true;
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.wsdlto.frontend.jaxws.validator;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.validator.ServiceValidator;
+
+public class UniqueBodyValidator extends ServiceValidator {
+ public static final Logger LOG = LogUtils.getL7dLogger(UniqueBodyValidator.class);
+
+ public UniqueBodyValidator() {
+ }
+
+ public UniqueBodyValidator(ServiceInfo s) {
+ this.service = s;
+ }
+
+ @Override
+ public boolean isValid() {
+ return checkUniqueBody();
+ }
+
+ private boolean checkUniqueBody() {
+ Collection<EndpointInfo> endpoints = service.getEndpoints();
+ if (endpoints != null) {
+ for (EndpointInfo endpoint : endpoints) {
+ if (!isValidEndpoint(endpoint)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private boolean isValidEndpoint(EndpointInfo endpoint) {
+ BindingInfo binding = endpoint.getBinding();
+ Map<QName, QName> uniqueNames = new HashMap<QName, QName>();
+
+ Collection<BindingOperationInfo> bos = binding.getOperations();
+ for (BindingOperationInfo bo : bos) {
+ OperationInfo op = binding.getInterface().getOperation(bo.getName());
+ if (op.getInput() != null
+ && op.getInput().getMessageParts().size() == 1) {
+ MessagePartInfo part = op.getInput().getMessageParts().iterator().next();
+ if (part.getElementQName() == null) {
+ continue;
+ }
+ QName mName = part.getElementQName();
+ QName opName = uniqueNames.get(mName);
+ if (opName != null) {
+ Message msg = new Message("NON_UNIQUE_BODY", LOG,
+ endpoint.getName(), op.getName(), opName, mName);
+ addErrorMessage(msg.toString());
+ return false;
+ } else {
+ uniqueNames.put(mName, op.getName());
+ }
+ }
+ }
+ return true;
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java?rev=642284&r1=642283&r2=642284&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java Fri Mar 28 09:33:52 2008
@@ -1,117 +1,117 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.tools.wsdlto.frontend.jaxws.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-import javax.xml.namespace.QName;
-
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.service.model.InterfaceInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.ToolContext;
-import org.apache.cxf.tools.validator.ServiceValidator;
-import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
-import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.WrapperElement;
-
-public class WrapperStyleNameCollisionValidator extends ServiceValidator {
- public static final Logger LOG = LogUtils.getL7dLogger(WrapperStyleNameCollisionValidator.class);
-
- public WrapperStyleNameCollisionValidator() {
- }
-
- public WrapperStyleNameCollisionValidator(ServiceInfo s) {
- this.service = s;
- }
-
- @Override
- public boolean isValid() {
- return checkNameColllision();
- }
-
- private boolean checkNameColllision() {
- InterfaceInfo interfaceInfo = service.getInterface();
- if (interfaceInfo != null) {
- for (OperationInfo operation : interfaceInfo.getOperations()) {
- if (!isValidOperation(operation)) {
- return false;
- }
- }
- }
- return true;
- }
-
- private boolean isValidOperation(OperationInfo operation) {
- ToolContext context = service.getProperty(ToolContext.class.getName(), ToolContext.class);
-
- if (operation.getUnwrappedOperation() == null) {
- return true;
- }
-
- MessagePartInfo input = null;
- MessagePartInfo output = null;
- if (operation.getInput() != null
- && operation.getInput().getMessageParts().size() == 1) {
- input = operation.getInput().getMessageParts().iterator().next();
- }
-
- if (operation.getOutput() != null
- && operation.getOutput().getMessageParts().size() == 1) {
- output = operation.getOutput().getMessageParts().iterator().next();
- }
-
- Map<QName, QName> names = new HashMap<QName, QName>();
- if (input != null) {
- for (WrapperElement element : ProcessorUtil.getWrappedElement(context, input.getElementQName())) {
- if (names.containsKey(element.getElementName())
- && names.get(element.getElementName()).equals(element.getSchemaTypeName())) {
- handleErrors(names.get(element.getElementName()), element);
- return false;
- } else {
- names.put(element.getElementName(), element.getSchemaTypeName());
- }
- }
- }
-
- if (output != null) {
- for (WrapperElement element : ProcessorUtil.getWrappedElement(context,
- output.getElementQName())) {
- if (names.containsKey(element.getElementName())
- && !names.get(element.getElementName()).equals(element.getSchemaTypeName())) {
- handleErrors(names.get(element.getElementName()), element);
- return false;
- } else {
- names.put(element.getElementName(), element.getSchemaTypeName());
- }
- }
- }
- return true;
- }
-
- private void handleErrors(QName e1, WrapperElement e2) {
- Message msg = new Message("WRAPPER_STYLE_NAME_COLLISION", LOG,
- e2.getElementName(), e1, e2.getSchemaTypeName());
- addErrorMessage(msg.toString());
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.wsdlto.frontend.jaxws.validator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.validator.ServiceValidator;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.WrapperElement;
+
+public class WrapperStyleNameCollisionValidator extends ServiceValidator {
+ public static final Logger LOG = LogUtils.getL7dLogger(WrapperStyleNameCollisionValidator.class);
+
+ public WrapperStyleNameCollisionValidator() {
+ }
+
+ public WrapperStyleNameCollisionValidator(ServiceInfo s) {
+ this.service = s;
+ }
+
+ @Override
+ public boolean isValid() {
+ return checkNameColllision();
+ }
+
+ private boolean checkNameColllision() {
+ InterfaceInfo interfaceInfo = service.getInterface();
+ if (interfaceInfo != null) {
+ for (OperationInfo operation : interfaceInfo.getOperations()) {
+ if (!isValidOperation(operation)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private boolean isValidOperation(OperationInfo operation) {
+ ToolContext context = service.getProperty(ToolContext.class.getName(), ToolContext.class);
+
+ if (operation.getUnwrappedOperation() == null) {
+ return true;
+ }
+
+ MessagePartInfo input = null;
+ MessagePartInfo output = null;
+ if (operation.getInput() != null
+ && operation.getInput().getMessageParts().size() == 1) {
+ input = operation.getInput().getMessageParts().iterator().next();
+ }
+
+ if (operation.getOutput() != null
+ && operation.getOutput().getMessageParts().size() == 1) {
+ output = operation.getOutput().getMessageParts().iterator().next();
+ }
+
+ Map<QName, QName> names = new HashMap<QName, QName>();
+ if (input != null) {
+ for (WrapperElement element : ProcessorUtil.getWrappedElement(context, input.getElementQName())) {
+ if (names.containsKey(element.getElementName())
+ && names.get(element.getElementName()).equals(element.getSchemaTypeName())) {
+ handleErrors(names.get(element.getElementName()), element);
+ return false;
+ } else {
+ names.put(element.getElementName(), element.getSchemaTypeName());
+ }
+ }
+ }
+
+ if (output != null) {
+ for (WrapperElement element : ProcessorUtil.getWrappedElement(context,
+ output.getElementQName())) {
+ if (names.containsKey(element.getElementName())
+ && !names.get(element.getElementName()).equals(element.getSchemaTypeName())) {
+ handleErrors(names.get(element.getElementName()), element);
+ return false;
+ } else {
+ names.put(element.getElementName(), element.getSchemaTypeName());
+ }
+ }
+ }
+ return true;
+ }
+
+ private void handleErrors(QName e1, WrapperElement e2) {
+ Message msg = new Message("WRAPPER_STYLE_NAME_COLLISION", LOG,
+ e2.getElementName(), e1, e2.getSchemaTypeName());
+ addErrorMessage(msg.toString());
+ }
+}
Propchange: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
------------------------------------------------------------------------------
svn:eol-style = native