You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/10/25 19:10:56 UTC
svn commit: r588283 [18/18] - in /incubator/cxf/branches/jliu: ./ api/
api/src/main/java/org/apache/cxf/databinding/
api/src/main/java/org/apache/cxf/io/
api/src/main/java/org/apache/cxf/message/
api/src/main/java/org/apache/cxf/phase/ api/src/main/jav...
Modified: incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java Thu Oct 25 10:09:20 2007
@@ -20,13 +20,9 @@
package org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.logging.Logger;
import javax.jws.soap.SOAPBinding;
@@ -40,18 +36,19 @@
import javax.wsdl.extensions.ExtensionRegistry;
import javax.wsdl.xml.WSDLReader;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.OASISCatalogManager;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.helpers.FileUtils;
+
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolException;
import org.apache.cxf.tools.util.SOAPBindingUtil;
+import org.apache.cxf.tools.util.URIParserUtil;
import org.apache.cxf.tools.validator.internal.WSDL11Validator;
import org.apache.cxf.tools.wsdlto.core.AbstractWSDLBuilder;
import org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.CustomizationParser;
@@ -88,6 +85,7 @@
public Definition build(String wsdlURL) {
this.builder.setBus(this.bus);
wsdlDefinition = builder.build(wsdlURL);
+ context.put(Bus.class, bus);
context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
checkSupported(wsdlDefinition);
return wsdlDefinition;
@@ -126,7 +124,7 @@
} catch (Exception e) {
Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION",
LOG,
- cusParser.getCustomizedWSDLElement().getBaseURI());
+ (String)context.get(ToolConstants.CFG_WSDLURL));
throw new RuntimeException(msg.toString(), e);
}
}
@@ -166,25 +164,17 @@
return true;
}
}
-
}
return false;
}
- private CustomizationParser getCustomizationParser() {
- return cusParser;
- }
+ private Definition buildCustomizedDefinition() throws Exception {
+ Map<String, Element> eleMap = cusParser.getCustomizedWSDLElements();
+ String wsdlUrl = URIParserUtil.getAbsoluteURI((String)context.get(ToolConstants.CFG_WSDLURL));
+ CustomizedWSDLLocator wsdlLocator = new CustomizedWSDLLocator(wsdlUrl, eleMap);
+ wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus).getCatalog());
+ return wsdlReader.readWSDL(wsdlLocator);
- private Definition buildCustomizedDefinition() throws Exception {
- File tmpFile = File.createTempFile("customzied", ".wsdl");
- OutputStream outs = new FileOutputStream(tmpFile);
- DOMUtils.writeXml(getCustomizationParser().getCustomizedWSDLElement(), outs);
- InputStream ins = new FileInputStream(new File(tmpFile.toURI()));
- Document wsdlDoc = DOMUtils.readXml(ins);
- Definition def = wsdlReader.readWSDL(this.wsdlDefinition.getDocumentBaseURI(),
- wsdlDoc);
- FileUtils.delete(tmpFile);
- return def;
}
public Definition getWSDLModel() {
Modified: incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParserTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParserTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParserTest.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParserTest.java Thu Oct 25 10:09:20 2007
@@ -76,7 +76,7 @@
Element jaxwsBinding = getDocumentElement("resources/external_jaxws.xml");
parser.setWSDLNode(wsdlDoc);
- parser.internalizeBinding(jaxwsBinding, "");
+ parser.internalizeBinding(jaxwsBinding, wsdlDoc, "");
File file = new File(output, "custom_test.wsdl");
XMLUtils.writeTo(wsdlDoc, new FileOutputStream(file));
@@ -94,7 +94,7 @@
Element jaxwsBinding = getDocumentElement("resources/external_jaxws_embed_jaxb.xml");
parser.setWSDLNode(wsdlDoc);
- parser.internalizeBinding(jaxwsBinding, "");
+ parser.internalizeBinding(jaxwsBinding, wsdlDoc, "");
String base = "wsdl:definitions/wsdl:types/xsd:schema/xsd:annotation/xsd:appinfo/";
String[] checkingPoints =
@@ -112,7 +112,7 @@
Element wsdlDoc = getDocumentElement("resources/test.wsdl");
Element jaxwsBinding = getDocumentElement("resources/external_jaxws_embed_jaxb_date.xml");
parser.setWSDLNode(wsdlDoc);
- parser.internalizeBinding(jaxwsBinding, "");
+ parser.internalizeBinding(jaxwsBinding, wsdlDoc, "");
String base = "wsdl:definitions/wsdl:types/xsd:schema/xsd:annotation/xsd:appinfo/";
String[] checkingPoints =
@@ -130,7 +130,7 @@
Element wsdlDoc = getDocumentElement("resources/hello_world.wsdl");
Element jaxwsBinding = getDocumentElement("resources/binding2.xml");
parser.setWSDLNode(wsdlDoc);
- parser.internalizeBinding(jaxwsBinding, "");
+ parser.internalizeBinding(jaxwsBinding, wsdlDoc, "");
String checkingPoint = "wsdl:definitions/wsdl:types/xsd:schema";
checkingPoint += "/xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence";
Modified: incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java Thu Oct 25 10:09:20 2007
@@ -19,10 +19,11 @@
package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
+import java.util.List;
import java.util.Map;
-
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
import org.apache.cxf.tools.common.model.JavaMethod;
import org.junit.Assert;
import org.junit.Test;
@@ -35,7 +36,7 @@
method.setName("echoFoo");
method.setOperationName("echoFoo");
method.annotate(new WebMethodAnnotator());
- Map<String, JavaAnnotation> annotations = method.getAnnotationMap();
+ Map<String, JAnnotation> annotations = method.getAnnotationMap();
assertNotNull(annotations);
assertEquals(1, annotations.size());
assertEquals("WebMethod", annotations.keySet().iterator().next());
@@ -45,15 +46,16 @@
public void testAddWebResultAnnotation() throws Exception {
JavaMethod method = new JavaMethod();
method.annotate(new WebResultAnnotator());
- Map<String, JavaAnnotation> annotations = method.getAnnotationMap();
+ Map<String, JAnnotation> annotations = method.getAnnotationMap();
assertNotNull(annotations);
assertEquals(1, annotations.size());
assertEquals("WebResult", annotations.keySet().iterator().next());
- JavaAnnotation resultAnnotation = annotations.values().iterator().next();
- Map<String, String> arguments = resultAnnotation.getArguments();
- assertNotNull(arguments);
- assertEquals(1, arguments.size());
- assertEquals("name", arguments.keySet().iterator().next());
- assertEquals("\"return\"", arguments.values().iterator().next());
+ JAnnotation resultAnnotation = annotations.get("WebResult");
+ assertEquals("@WebResult(name = \"return\")", resultAnnotation.toString());
+ List<JAnnotationElement> elements = resultAnnotation.getElements();
+ assertNotNull(elements);
+ assertEquals(1, elements.size());
+ assertEquals("name", elements.get(0).getName());
+ assertEquals("return", elements.get(0).getValue());
}
}
Modified: incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java Thu Oct 25 10:09:20 2007
@@ -19,12 +19,13 @@
package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
-import java.util.Map;
+import java.util.List;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
import org.apache.cxf.tools.common.model.JavaMethod;
import org.apache.cxf.tools.common.model.JavaParameter;
import org.junit.Assert;
@@ -58,11 +59,13 @@
init(method, parameter, SOAPBinding.Style.DOCUMENT, true);
parameter.annotate(new WebParamAnnotator());
- JavaAnnotation annotation = parameter.getAnnotation();
- Map<String, String> args = annotation.getArguments();
- assertEquals(2, args.size());
- assertEquals("\"http://apache.org/cxf\"", args.get("targetNamespace"));
- assertEquals("\"x\"", args.get("name"));
+ JAnnotation annotation = parameter.getAnnotation();
+ assertEquals("@WebParam(name = \"x\", targetNamespace = \"http://apache.org/cxf\")",
+ annotation.toString());
+ List<JAnnotationElement> elements = annotation.getElements();
+ assertEquals(2, elements.size());
+ assertEquals("http://apache.org/cxf", elements.get(1).getValue());
+ assertEquals("x", elements.get(0).getValue());
// XXX - order that attributes are appended to the string
// differs with the ibmjdk...
//assertEquals("@WebParam(targetNamespace = \"http://apache.org/cxf\", name = \"x\")",
@@ -75,12 +78,12 @@
parameter.annotate(new WebParamAnnotator());
- JavaAnnotation annotation = parameter.getAnnotation();
- Map<String, String> args = annotation.getArguments();
- assertEquals(3, args.size());
- assertEquals("\"http://apache.org/cxf\"", args.get("targetNamespace"));
- assertEquals("\"y\"", args.get("partName"));
- assertEquals("\"x\"", args.get("name"));
+ JAnnotation annotation = parameter.getAnnotation();
+ assertEquals("@WebParam(partName = \"y\", name = \"x\", "
+ + "targetNamespace = \"http://apache.org/cxf\")",
+ annotation.toString());
+ List<JAnnotationElement> elements = annotation.getElements();
+ assertEquals(3, elements.size());
// XXX - order that attributes are appended to the string
// differs with the ibmjdk...
//assertEquals(
@@ -92,8 +95,8 @@
public void testAnnotateRPC() throws Exception {
init(method, parameter, SOAPBinding.Style.RPC, true);
parameter.annotate(new WebParamAnnotator());
- JavaAnnotation annotation = parameter.getAnnotation();
- assertEquals(2, annotation.getArguments().size());
+ JAnnotation annotation = parameter.getAnnotation();
+ assertEquals(2, annotation.getElements().size());
assertEquals("@WebParam(partName = \"y\", name = \"y\")",
annotation.toString());
}
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/pom.xml (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/pom.xml Thu Oct 25 10:09:20 2007
@@ -70,10 +70,15 @@
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>${jetty.version}</version>
- <scope>test</scope>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>${jetty.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
@@ -101,7 +106,7 @@
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/tools/wsdlto/test</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/cxf/trunk/tools/wsdlto/test</developerConnection>
- <url>http://svn.apache.org/viewvc/incubator/cxf/trunk/cxf-parent/cxf-tools-wsdlto-test</url>
- </scm>
+ <url>http://svn.apache.org/viewvc/incubator/cxf/trunk/cxf-parent/cxf-tools-wsdlto-test</url>
+ </scm>
</project>
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Thu Oct 25 10:09:20 2007
@@ -22,6 +22,7 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import javax.jws.WebService;
import javax.xml.namespace.QName;
@@ -178,16 +179,13 @@
assertTrue("Generate " + clz.getName() + "error", clz.isInterface());
}
-
-
-
@Test
public void testBug305772() throws Exception {
env.put(ToolConstants.CFG_COMPILE, "compile");
env.put(ToolConstants.CFG_ANT, ToolConstants.CFG_ANT);
env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
- // env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
+ env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/bug305772/hello_world.wsdl"));
processor.setContext(env);
processor.execute();
@@ -501,14 +499,11 @@
getLocation("/wsdl2java_wsdl/hello-mime.wsdl")};
WSDLToJava.main(args);
+
assertFileEquals(getClass().getResource("expected/expected_hello_mime").getFile(),
output.getCanonicalPath() + "/org/apache/hello_world_mime/Hello.java");
-
-
-
}
-
@Test
public void testWebResult() throws Exception {
@@ -516,9 +511,12 @@
processor.setContext(env);
processor.execute();
- assertFileEquals(getClass().getResource("expected/expected_sayHi").getFile(),
- output.getCanonicalPath() + "/org/apache/sayhi/SayHi.java");
-
+ String results = getStringFromFile(new File(output.getCanonicalPath(),
+ "org/apache/sayhi/SayHi.java"));
+ assertTrue(results.trim().length() > 0);
+ assertTrue(results.indexOf("@WebResult(name = \"return\", "
+ + "targetNamespace = \"http://apache.org/sayHi\")") != -1);
+ assertTrue(results.indexOf("@WebResult(name = \"return\", targetNamespace = \"\")") != -1);
}
@@ -677,4 +675,175 @@
fail("The cxf967.wsdl is a valid wsdl, should pass the test, caused by: " + e.getMessage());
}
}
+
+ @Test
+ public void testParameterOrderDifferentNS() throws Exception {
+ try {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/bug978/bug.wsdl"));
+ processor.setContext(env);
+ processor.execute();
+
+ String results = getStringFromFile(new File(output.getCanonicalPath(),
+ "org/tempuri/GreeterRPCLit.java"));
+ assertTrue(results.indexOf("@WebParam(partName = \"inInt\", name = \"inInt\")") != -1);
+ } catch (Exception e) {
+ fail("The cxf978.wsdl is a valid wsdl, should pass the test, caused by: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAsyncImplAndClient() throws Exception {
+ //CXF994
+ env.put(ToolConstants.CFG_COMPILE, "compile");
+ env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+ env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
+ env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf994/hello_world_async.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf994/async.xml"));
+ processor.setContext(env);
+ processor.execute();
+ }
+
+ @Test
+ public void testZeroInputOutOfBandHeader() throws Exception {
+ env.put(ToolConstants.CFG_COMPILE, "compile");
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf1001.wsdl"));
+ env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "TRUE");
+ env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+ env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
+ env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
+
+ processor.setContext(env);
+ processor.execute();
+
+ String results = getStringFromFile(new File(output.getCanonicalPath(),
+ "soapinterface/ems/esendex/com/AccountServiceSoap.java"));
+ assertTrue(results.indexOf("public int getMessageLimit") != -1);
+ assertTrue(results.indexOf("name = \"MessengerHeader") != -1);
+ assertTrue(results.indexOf("header = true") != -1);
+ }
+
+ @Test
+ public void testBindingForImportWSDL() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1095/hello_world_services.wsdl"));
+ env.put(ToolConstants.CFG_BINDING,
+ new String[] {getLocation("/wsdl2java_wsdl/cxf1095/binding.xml")
+ , getLocation("/wsdl2java_wsdl/cxf1095/binding1.xml")});
+ processor.setContext(env);
+ processor.execute();
+ Class clz = classLoader
+ .loadClass("org.apache.hello_world.messages.CustomizedFault");
+ assertNotNull("Customization Fault Class is not generated", clz);
+ Class serviceClz = classLoader
+ .loadClass("org.apache.hello_world.services.CustomizedService");
+ assertNotNull("Customization Fault Class is not generated", serviceClz);
+
+ }
+
+ @Test
+ public void testReuseJaxwsBindingFile() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1094/hello_world.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1094/async_binding.xml"));
+ processor.setContext(env);
+ processor.execute();
+
+ Class clz = classLoader.loadClass("org.apache.hello_world_soap_http.Greeter");
+
+ Method method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
+ javax.xml.ws.AsyncHandler.class});
+
+ assertNotNull("jaxws binding file does not take effect for hello_world.wsdl", method1);
+
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1094/echo_date.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1094/async_binding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ clz = classLoader.loadClass("org.apache.cxf.tools.fortest.date.EchoDate");
+
+ Method method2 = clz.getMethod("echoDateAsync",
+ new Class[] {javax.xml.datatype.XMLGregorianCalendar.class,
+ javax.xml.ws.AsyncHandler.class});
+ assertNotNull("jaxws binding file does not take effect for echo_date.wsdl", method2);
+
+ }
+
+
+ @Test
+ public void testReuseJabBindingFile1() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1094/hello_world.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1094/jaxbbinding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ Class clz = classLoader.loadClass("org.apache.hello_world_soap_http.types.CreateProcess$MyProcess");
+ assertNotNull("Failed to generate customized class for hello_world.wsdl" , clz);
+
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1094/hello_world_oneway.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1094/jaxbbinding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ Class customizedClz = classLoader.loadClass("org.apache.oneway.types.CreateProcess$MyProcess");
+ assertNotNull("Failed to generate customized class for hello_world_oneway.wsdl",
+ customizedClz);
+ }
+
+ @Test
+ public void testBindingXPath() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1106/binding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ Class clz = classLoader
+ .loadClass("org.apache.hello_world_soap_http.Greeter");
+ assertNotNull("Failed to generate SEI class", clz);
+ Method[] methods = clz.getMethods();
+ assertEquals("jaxws binding file parse error, number of generated method is not expected"
+ , 14, methods.length);
+
+ boolean existSayHiAsyn = false;
+ for (Method m : methods) {
+ if (m.getName().equals("sayHiAsyn")) {
+ existSayHiAsyn = true;
+ }
+ }
+ assertFalse("sayHiAsyn method should not be generated", existSayHiAsyn);
+ }
+
+
+ @Test
+ public void testCatalog() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1112/myservice.wsdl"));
+ env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/catalog.xml"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/jaxbbinding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ }
+
+
+ @Test
+ public void testCatalog2() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, "http://example.org/wsdl");
+ env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/binding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ }
+
+ @Test
+ public void testCatalog3() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, "http://example.org/wsdl");
+ env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/jax-ws-catalog2.xml"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/binding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ }
+
+
}
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java Thu Oct 25 10:09:20 2007
@@ -144,4 +144,20 @@
fail("Catalog not working");
}
}
+
+ @Test
+ public void testGetCatalogPublic() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf1053/myservice.wsdl"));
+ env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1053/catalog.xml"));
+ env.put(ToolConstants.CFG_COMPILE, null);
+ env.put(ToolConstants.CFG_CLASSDIR, null);
+
+ processor.setContext(env);
+ try {
+ processor.execute();
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Catalog not working");
+ }
+ }
}
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Thu Oct 25 10:09:20 2007
@@ -1119,4 +1119,34 @@
assertTrue(contents.indexOf("SOAPBinding.ParameterStyle.BARE") != -1);
assertTrue(contents.indexOf("@ResponseWrapper") == -1);
}
+
+ @Test
+ public void testXmlSeeAlso() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cardealer.wsdl"));
+
+ processor.setContext(env);
+ processor.execute();
+
+ File sei = new File(output, "type_substitution/server/CarDealer.java");
+ assertTrue(output.exists());
+ String contents = getStringFromFile(sei);
+ assertTrue(contents.indexOf("@XmlSeeAlso({ObjectFactory.class})") != -1);
+ }
+
+ @Test
+ public void testWSAction() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/wsdl_addr.wsdl"));
+
+ processor.setContext(env);
+ processor.execute();
+
+ File sei = new File(output, "com/example/AddNumbersPortType.java");
+ assertTrue(sei.exists());
+ String contents = getStringFromFile(sei).replace(" ", " ");
+ String expected = "@Action(input = \"3in\", output = \"3out\", "
+ + "fault = {@FaultAction(className = AddNumbersFault_Exception.class, value = \"3fault\")})";
+ assertTrue(contents.indexOf("import javax.xml.ws.Action;") != -1);
+ assertTrue(contents.indexOf("import javax.xml.ws.FaultAction;") != -1);
+ assertTrue(contents.indexOf(expected) != -1);
+ }
}
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime Thu Oct 25 10:09:20 2007
@@ -16,46 +16,50 @@
* specific language governing permissions and limitations
* under the License.
*/
+
+
package org.apache.hello_world_mime;
-import javax.jws.WebParam.Mode;
+import javax.jws.WebMethod;
import javax.jws.WebParam;
+import javax.jws.WebParam.Mode;
+import javax.jws.WebResult;
import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding;
-import javax.jws.WebMethod;
-import javax.jws.WebResult;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
@WebService(targetNamespace = "http://apache.org/hello_world_mime", name = "Hello")
+@XmlSeeAlso({org.apache.cxf.mime.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface Hello {
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
- @WebResult(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "mime", name = "addressRes")
+ @WebResult(name = "addressRes", targetNamespace = "http://apache.org/hello_world_mime/types", partName = "mime")
@WebMethod
public javax.xml.transform.Source address(
- @WebParam(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "mime", name = "address")
+ @WebParam(partName = "mime", name = "address", targetNamespace = "http://apache.org/hello_world_mime/types")
org.apache.cxf.mime.Address mime
);
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebMethod
public void helloMime(
- @WebParam(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "body", name = "body")
+ @WebParam(partName = "body", name = "body", targetNamespace = "http://apache.org/hello_world_mime/types")
java.lang.String body,
- @WebParam(targetNamespace = "", mode = Mode.INOUT, partName = "mime", name = "mime")
+ @WebParam(partName = "mime", mode = WebParam.Mode.INOUT, name = "mime", targetNamespace = "")
javax.xml.ws.Holder<java.awt.Image> mime
);
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebMethod
public void hello(
- @WebParam(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "body", name = "body")
+ @WebParam(partName = "body", name = "body", targetNamespace = "http://apache.org/hello_world_mime/types")
java.lang.String body,
- @WebParam(targetNamespace = "", mode = Mode.INOUT, partName = "mime", name = "mime")
+ @WebParam(partName = "mime", mode = WebParam.Mode.INOUT, name = "mime", targetNamespace = "")
javax.xml.ws.Holder<byte[]> mime
);
}
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi Thu Oct 25 10:09:20 2007
@@ -1,21 +1,4 @@
-/**
- * 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.sayhi;
import javax.jws.WebParam.Mode;
@@ -25,11 +8,19 @@
import javax.jws.soap.SOAPBinding;
import javax.jws.WebMethod;
import javax.jws.WebResult;
+import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
+/**
+ * This class was generated by the CXF 2.1-incubator-SNAPSHOT
+ * Thu Sep 27 20:10:08 CST 2007
+ * Generated source version: 2.1-incubator-SNAPSHOT
+ *
+ */
@WebService(targetNamespace = "http://apache.org/sayHi", name = "SayHi")
+@XmlSeeAlso({ObjectFactory.class})
public interface SayHi {
Modified: incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl (original)
+++ incubator/cxf/branches/jliu/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl Thu Oct 25 10:09:20 2007
@@ -18,22 +18,25 @@
under the License.
-->
-<wsdl:definitions name="VoidVoid" targetNamespace="http://apache.org/hello_world_rpclit/voidvoid"
+<wsdl:definitions name="Voidint" targetNamespace="http://apache.org/hello_world_rpclit/voidint"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:http-conf="http://schemas.iona.com/transports/http/configuration"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://apache.org/hello_world_rpclit/voidvoid"
- xmlns:x1="http://apache.org/hello_world_rpclit/voidvoid/types"
+ xmlns:tns="http://apache.org/hello_world_rpclit/voidint"
+ xmlns:x1="http://apache.org/hello_world_rpclit/voidint/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="sayHiRequest">
<wsdl:part name="inInt" type="xsd:int"/>
</wsdl:message>
+
+ <wsdl:message name="sayHiResponse"/>
<wsdl:portType name="GreeterRPCLit">
<wsdl:operation name="sayHi" parameterOrder="inInt">
<wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
</wsdl:operation>
</wsdl:portType>
@@ -43,10 +46,10 @@
<wsdl:operation name="sayHi">
<soap:operation soapAction="" style="rpc"/>
<wsdl:input>
- <soap:body namespace="http://apache.org/hello_world_rpclit/voidvoid" use="literal"/>
+ <soap:body namespace="http://apache.org/hello_world_rpclit/voidint" use="literal"/>
</wsdl:input>
<wsdl:output>
- <soap:body namespace="http://apache.org/hello_world_rpclit/voidvoid" use="literal"/>
+ <soap:body namespace="http://apache.org/hello_world_rpclit/voidint" use="literal"/>
</wsdl:output>
</wsdl:operation>