You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2006/08/31 10:28:16 UTC
svn commit: r438838 - in /incubator/cxf/trunk/tools/wsdl2java/src:
main/java/org/apache/cxf/tools/wsdl2java/
main/java/org/apache/cxf/tools/wsdl2java/processor/
main/java/org/apache/cxf/tools/wsdl2java/processor/internal/
test/java/org/apache/cxf/tools...
Author: ema
Date: Thu Aug 31 01:28:15 2006
New Revision: 438838
URL: http://svn.apache.org/viewvc?rev=438838&view=rev
Log:
* Added error message for notification wsdl operation
* Remove default exclude namespace in wsdl2java tool
* Fixed null exception issue when removing the exclude files
Added:
incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl (with props)
Modified:
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/Messages.properties
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/OperationProcessor.java
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ParameterProcessor.java
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ServiceProcessor.java
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavaexclude.cfg
incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java
Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java Thu Aug 31 01:28:15 2006
@@ -132,7 +132,7 @@
File file = new File(outPutDir, excludeFile);
file.delete();
File tmpFile = file.getParentFile();
- while (!tmpFile.getCanonicalPath().equalsIgnoreCase(outPutDir)) {
+ while (tmpFile != null && !tmpFile.getCanonicalPath().equalsIgnoreCase(outPutDir)) {
if (tmpFile.isDirectory() && tmpFile.list().length == 0) {
tmpFile.delete();
}
@@ -146,7 +146,7 @@
+ ".class");
classFile.delete();
File tmpClzFile = classFile.getParentFile();
- while (!tmpClzFile.getCanonicalPath().equalsIgnoreCase(outPutDir)) {
+ while (tmpClzFile != null && !tmpClzFile.getCanonicalPath().equalsIgnoreCase(outPutDir)) {
if (tmpClzFile.isDirectory() && tmpClzFile.list().length == 0) {
tmpClzFile.delete();
}
Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/Messages.properties?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/Messages.properties (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/Messages.properties Thu Aug 31 01:28:15 2006
@@ -14,4 +14,6 @@
FAIL_TO_BUILD_WSDLMODEL = Fail to build wsdl model
GENERATE_TYPES_ERROR = Generate types error
FAIL_TO_GET_JAXBINDINGNODE_FROM_JAXWSBINDING = Fail to get jaxb binding information from jaxws binding file
+NO_INPUT_MESSAGE=Problem outputting method for {0} as no input message was found
+INVALID_MEP = Invalid WSDL, wsdl:operation {0} is not request-response or one-way
Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/OperationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/OperationProcessor.java?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/OperationProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/OperationProcessor.java Thu Aug 31 01:28:15 2006
@@ -37,16 +37,13 @@
import org.apache.cxf.tools.common.ProcessorEnvironment;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolException;
-
import org.apache.cxf.tools.common.extensions.jaxws.CustomizationParser;
import org.apache.cxf.tools.common.extensions.jaxws.JAXWSBinding;
-
import org.apache.cxf.tools.common.model.JavaAnnotation;
import org.apache.cxf.tools.common.model.JavaInterface;
import org.apache.cxf.tools.common.model.JavaMethod;
import org.apache.cxf.tools.common.model.JavaParameter;
import org.apache.cxf.tools.common.model.JavaReturn;
-
import org.apache.cxf.tools.util.ProcessorUtil;
import org.apache.cxf.tools.util.SOAPBindingUtil;
@@ -62,9 +59,9 @@
@SuppressWarnings("unchecked")
public void process(JavaInterface intf, Operation operation) throws ToolException {
JavaMethod method = new JavaMethod(intf);
- //set default Document Bare style
+ // set default Document Bare style
method.setSoapStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);
-
+
method.setName(ProcessorUtil.mangleNameToVariableName(operation.getName()));
method.setOperationName(operation.getName());
method.setStyle(operation.getStyle());
@@ -80,7 +77,7 @@
method.setJAXWSBinding(customizing(intf, operation));
processMethod(method, operation);
Map<String, Fault> faults = operation.getFaults();
-
+
FaultProcessor faultProcessor = new FaultProcessor(env);
faultProcessor.process(method, faults);
@@ -94,18 +91,18 @@
Message outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage();
if (inputMessage == null) {
- LOG.log(Level.WARNING, "NO_INPUT_MESSAGE",
- new Object[] {operation.getName(), operation.getInput().getName()});
+ LOG.log(Level.WARNING, "NO_INPUT_MESSAGE", new Object[] {operation.getName()});
+ org.apache.cxf.common.i18n.Message msg
+ = new org.apache.cxf.common.i18n.Message("INVALID_MEP", LOG,
+ new Object[] {operation.getName()});
+ throw new ToolException(msg);
}
-
+
ParameterProcessor paramProcessor = new ParameterProcessor(env);
method.clear();
- paramProcessor.process(method,
- inputMessage,
- outputMessage,
- isRequestResponse(operation),
+ paramProcessor.process(method, inputMessage, outputMessage, isRequestResponse(operation),
parameterOrder);
- isWrapperStyle(operation);
+ isWrapperStyle(operation);
addWebMethodAnnotation(method);
addWrapperAnnotation(method, operation);
addWebResultAnnotation(method);
@@ -126,7 +123,7 @@
private void addWebMethodAnnotation(JavaMethod method) {
addWebMethodAnnotation(method, method.getOperationName());
}
-
+
private void addWebMethodAnnotation(JavaMethod method, String operationName) {
JavaAnnotation methodAnnotation = new JavaAnnotation("WebMethod");
methodAnnotation.addArgument("operationName", operationName);
@@ -136,7 +133,7 @@
method.addAnnotation("WebMethod", methodAnnotation);
method.getInterface().addImport("javax.jws.WebMethod");
}
-
+
private void addWebResultAnnotation(JavaMethod method) {
if (method.isOneWay()) {
JavaAnnotation oneWayAnnotation = new JavaAnnotation("Oneway");
@@ -144,7 +141,7 @@
method.getInterface().addImport("javax.jws.Oneway");
return;
}
-
+
if ("void".equals(method.getReturn().getType())) {
return;
}
@@ -152,8 +149,7 @@
String targetNamespace = method.getReturn().getTargetNamespace();
String name = "return";
- if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT
- && !method.isWrapperStyle()) {
+ if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT && !method.isWrapperStyle()) {
name = method.getName() + "Response";
}
@@ -167,12 +163,10 @@
}
targetNamespace = method.getReturn().getTargetNamespace();
}
-
+
resultAnnotation.addArgument("name", name);
resultAnnotation.addArgument("targetNamespace", targetNamespace);
-
-
-
+
if (method.getSoapStyle() == SOAPBinding.Style.RPC
|| (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT && !method.isWrapperStyle())) {
resultAnnotation.addArgument("partName", method.getReturn().getName());
@@ -181,12 +175,12 @@
method.addAnnotation("WebResult", resultAnnotation);
method.getInterface().addImport("javax.jws.WebResult");
}
-
+
protected void addWrapperAnnotation(JavaMethod method, Operation operation) {
if (!isWrapperStyle(operation)) {
return;
}
-
+
if (wrapperRequest != null) {
JavaAnnotation wrapperRequestAnnotation = new JavaAnnotation("RequestWrapper");
wrapperRequestAnnotation.addArgument("localName", wrapperRequest.getType());
@@ -214,17 +208,18 @@
Map<String, Part> inputParts = new HashMap<String, Part>();
Map<String, Part> outputParts = new HashMap<String, Part>();
-
+
if (inputMessage != null) {
inputParts = inputMessage.getParts();
}
if (outputMessage != null) {
outputParts = outputMessage.getParts();
}
-
+
//
// RULE No.1:
- // The operation's input and output message (if present) each contain only a single part
+ // The operation's input and output message (if present) each contain
+ // only a single part
//
if (inputParts.size() > 1 || outputParts.size() > 1) {
return false;
@@ -232,7 +227,8 @@
//
// RULE No.2:
- // The input message part refers to a global element decalration whose localname
+ // The input message part refers to a global element decalration whose
+ // localname
// is equal to the operation name
//
Part inputPart = null;
@@ -266,7 +262,7 @@
// RULE No.4 and No5:
// wrapper element should be pure complex type
//
- if (ProcessorUtil.getBlock(inputPart, env) == null
+ if (ProcessorUtil.getBlock(inputPart, env) == null
|| ProcessorUtil.getBlock(outputPart, env) == null) {
return false;
}
@@ -278,7 +274,6 @@
wrapperRequest.setTargetNamespace(ProcessorUtil.resolvePartNamespace(inputPart));
wrapperRequest.setClassName(ProcessorUtil.getFullClzName(inputPart, this.env, this.collector));
-
}
if (outputPart != null) {
@@ -290,7 +285,7 @@
wrapperResponse.setClassName(ProcessorUtil.getFullClzName(outputPart, this.env, this.collector));
}
-
+
return true;
}
@@ -318,12 +313,13 @@
binding = CustomizationParser.getInstance().getPortTypeOperationExtension(portTypeName,
operationName);
}
-
+
if (binding == null) {
binding = new JAXWSBinding();
}
- if (!binding.isSetAsyncMapping() && (intf.getJavaModel().getJAXWSBinding().isEnableAsyncMapping()
- || intf.getJAXWSBinding().isEnableAsyncMapping())) {
+ if (!binding.isSetAsyncMapping()
+ && (intf.getJavaModel().getJAXWSBinding().isEnableAsyncMapping() || intf.getJAXWSBinding()
+ .isEnableAsyncMapping())) {
binding.setEnableAsyncMapping(true);
}
return binding;
@@ -337,14 +333,14 @@
method.getInterface().addImport("java.util.concurrent.Future");
method.getInterface().addImport("javax.xml.ws.Response");
}
-
+
private void addPollingMethod(JavaMethod method) throws ToolException {
JavaMethod pollingMethod = new JavaMethod(method.getInterface());
pollingMethod.setName(method.getName() + ToolConstants.ASYNC_METHOD_SUFFIX);
pollingMethod.setStyle(method.getStyle());
pollingMethod.setWrapperStyle(method.isWrapperStyle());
pollingMethod.setSoapAction(method.getSoapAction());
-
+
JavaReturn future = new JavaReturn();
future.setClassName("Future<?>");
pollingMethod.setReturn(future);
@@ -353,7 +349,7 @@
pollingMethod.addAnnotation("ResponseWrapper", method.getAnnotationMap().get("ResponseWrapper"));
pollingMethod.addAnnotation("RequestWrapper", method.getAnnotationMap().get("RequestWrapper"));
pollingMethod.addAnnotation("SOAPBinding", method.getAnnotationMap().get("SOAPBinding"));
-
+
for (Iterator iter = method.getParameters().iterator(); iter.hasNext();) {
pollingMethod.addParameter((JavaParameter)iter.next());
}
@@ -377,7 +373,7 @@
callbackMethod.setStyle(method.getStyle());
callbackMethod.setWrapperStyle(method.isWrapperStyle());
callbackMethod.setSoapAction(method.getSoapAction());
-
+
JavaReturn response = new JavaReturn();
response.setClassName(getAsyncClassName(method, "Response"));
callbackMethod.setReturn(response);
Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ParameterProcessor.java?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ParameterProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ParameterProcessor.java Thu Aug 31 01:28:15 2006
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -189,8 +190,10 @@
@SuppressWarnings("unchecked")
private void processOutput(JavaMethod method, Message inputMessage, Message outputMessage,
boolean isRequestResponse) throws ToolException {
- Map<String, Part> inputPartsMap = inputMessage.getParts();
- Map<String, Part> outputPartsMap = outputMessage.getParts();
+ Map<String, Part> inputPartsMap =
+ inputMessage == null ? new HashMap<String, Part>() : inputMessage.getParts();
+ Map<String, Part> outputPartsMap =
+ outputMessage == null ? new HashMap<String, Part>() : outputMessage.getParts();
Collection<Part> outputParts = outputPartsMap.values();
// figure out output parts that are not present in input parts
List<Part> outParts = new ArrayList<Part>();
@@ -229,8 +232,10 @@
private void processWrappedOutput(JavaMethod method, Message inputMessage, Message outputMessage,
boolean isRequestResponse) throws ToolException {
- Map<String, Part> inputPartsMap = inputMessage.getParts();
- Map<String, Part> outputPartsMap = outputMessage.getParts();
+ Map<String, Part> inputPartsMap =
+ inputMessage == null ? new HashMap<String, Part>() : inputMessage.getParts();
+ Map<String, Part> outputPartsMap =
+ outputMessage == null ? new HashMap<String, Part>() : outputMessage.getParts();
Collection<Part> outputParts = outputPartsMap.values();
Collection<Part> inputParts = inputPartsMap.values();
@@ -384,8 +389,10 @@
private void buildParamModelsWithOrdering(JavaMethod method, Message inputMessage, Message outputMessage,
boolean isRequestResponse, List<String> parameterList)
throws ToolException {
- Map<String, Part> inputPartsMap = inputMessage.getParts();
- Map<String, Part> outputPartsMap = outputMessage.getParts();
+ Map<String, Part> inputPartsMap =
+ inputMessage == null ? new HashMap<String, Part>() : inputMessage.getParts();
+ Map<String, Part> outputPartsMap =
+ outputMessage == null ? new HashMap<String, Part>() : outputMessage.getParts();
Collection<Part> inputParts = inputPartsMap.values();
Collection<Part> outputParts = outputPartsMap.values();
Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ServiceProcessor.java?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ServiceProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/internal/ServiceProcessor.java Thu Aug 31 01:28:15 2006
@@ -50,11 +50,9 @@
import org.apache.cxf.tools.common.ProcessorEnvironment;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolException;
-
import org.apache.cxf.tools.common.extensions.jaxws.CustomizationParser;
import org.apache.cxf.tools.common.extensions.jaxws.JAXWSBinding;
import org.apache.cxf.tools.common.extensions.jms.JMSAddress;
-
import org.apache.cxf.tools.common.model.JavaAnnotation;
import org.apache.cxf.tools.common.model.JavaInterface;
import org.apache.cxf.tools.common.model.JavaMethod;
@@ -64,7 +62,6 @@
import org.apache.cxf.tools.common.model.JavaServiceClass;
import org.apache.cxf.tools.common.model.JavaType;
import org.apache.cxf.tools.common.toolspec.parser.CommandLineParser;
-
import org.apache.cxf.tools.util.ProcessorUtil;
public class ServiceProcessor extends AbstractProcessor {
@@ -99,7 +96,7 @@
}
public void process(JavaModel model) throws ToolException {
-
+
Collection services = definition.getServices().values();
if (services.size() == 0) {
Iterator bindingIte = definition.getBindings().values().iterator();
@@ -158,7 +155,8 @@
// TODO: extend other bindings
jport.setBindingAdress(getPortAddress(port));
jport.setBindingName(binding.getQName().getLocalPart());
-
+
+
String namespace = binding.getPortType().getQName().getNamespaceURI();
String packageName = ProcessorUtil.parsePackageName(namespace, env.mapPackageName(namespace));
jport.setPackageName(packageName);
@@ -172,8 +170,8 @@
if (bindingType == null) {
org.apache.cxf.common.i18n.Message msg =
new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
- LOG,
- binding.getQName());
+ LOG,
+ binding.getQName());
throw new ToolException(msg);
}
@@ -217,8 +215,6 @@
}
-
-
private void processOperation(JavaModel model, BindingOperation bop, Binding binding)
throws ToolException {
String portType = ProcessorUtil
@@ -250,8 +246,8 @@
jm.setSoapAction(soapAction);
if (getSoapStyle(soapStyle) == null && this.bindingObj == null) {
org.apache.cxf.common.i18n.Message msg =
- new org.apache.cxf.common.i18n.Message("BINDING_STYLE_NOT_DEFINED",
- LOG);
+ new org.apache.cxf.common.i18n.Message("BINDING_STYLE_NOT_DEFINED",
+ LOG);
throw new ToolException(msg);
}
if (getSoapStyle(soapStyle) == null) {
@@ -263,18 +259,18 @@
// REVISIT: fix for xml binding
jm.setSoapStyle(jf.getSOAPStyle());
}
-
+
if (jm.getSoapStyle().equals(javax.jws.soap.SOAPBinding.Style.RPC)) {
jm.getAnnotationMap().remove("SOAPBinding");
}
-
+
OperationProcessor processor = new OperationProcessor(env);
int headerType = isNonWrappable(bop);
if (jm.isWrapperStyle() && headerType > this.noHEADER) {
// changed wrapper style
-
+
jm.setWrapperStyle(false);
processor.processMethod(jm, bop.getOperation());
jm.getAnnotationMap().remove("ResponseWrapper");
@@ -282,7 +278,7 @@
} else {
processor.processMethod(jm, bop.getOperation());
-
+
}
if (headerType == this.resultHeader) {
@@ -304,9 +300,13 @@
private void processParameter(JavaMethod jm, BindingOperation operation) throws ToolException {
// process input
- Iterator inbindings = operation.getBindingInput().getExtensibilityElements().iterator();
+
+ Iterator inbindings = null;
+ if (operation.getBindingInput() != null) {
+ inbindings = operation.getBindingInput().getExtensibilityElements().iterator();
+ }
String use = null;
- while (inbindings.hasNext()) {
+ while (inbindings != null && inbindings.hasNext()) {
Object obj = inbindings.next();
if (obj instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody)obj;
@@ -600,7 +600,7 @@
// TBD: There is no extensibilityelement in port type
bindingExt = new JAXWSBinding();
}
-
+
ji.setBindingExt(bindingExt);
}
Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavaexclude.cfg
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavaexclude.cfg?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavaexclude.cfg (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavaexclude.cfg Thu Aug 31 01:28:15 2006
@@ -1 +0,0 @@
-http://schemas.iona.com/references =
\ No newline at end of file
Modified: incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java?rev=438838&r1=438837&r2=438838&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java Thu Aug 31 01:28:15 2006
@@ -64,7 +64,7 @@
processor = null;
}
-
+
public void testRPCLit() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/hello_world_rpc_lit.wsdl"));
processor.setEnvironment(env);
@@ -84,14 +84,12 @@
assertEquals(3, files.length);
files = types.listFiles();
assertEquals(files.length, 3);
-
-
-
+
Class clz = classLoader.loadClass("org.apache.hello_world_rpclit.GreeterRPCLit");
-
+
javax.jws.WebService ws = AnnotationUtil.getPrivClassAnnotation(clz, javax.jws.WebService.class);
- assertTrue("Webservice annotation wsdlLocation should begin with file",
- ws.wsdlLocation().startsWith("file"));
+ assertTrue("Webservice annotation wsdlLocation should begin with file", ws.wsdlLocation()
+ .startsWith("file"));
SOAPBinding soapBindingAnno = AnnotationUtil.getPrivClassAnnotation(clz, SOAPBinding.class);
assertEquals("LITERAL", soapBindingAnno.use().toString());
@@ -103,7 +101,7 @@
Method method = clz.getMethod("sendReceiveData", new Class[] {paraClass});
assertEquals("MyComplexStruct", method.getReturnType().getSimpleName());
}
-
+
public void testAsynMethod() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/hello_world_async.wsdl"));
processor.setEnvironment(env);
@@ -122,8 +120,7 @@
assertEquals(3, files.length);
Class clz = classLoader.loadClass("org.apache.hello_world_async_soap_http.GreeterAsync");
-
-
+
Method method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
javax.xml.ws.AsyncHandler.class});
WebMethod webMethodAnno1 = AnnotationUtil.getPrivMethodAnnotation(method1, WebMethod.class);
@@ -357,7 +354,7 @@
clz = classLoader.loadClass("org.apache.Greeter_Exception");
clz = classLoader.loadClass("org.apache.Greeter_Service");
}
-
+
public void testImportNameCollision() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/helloworld-portname_servicename.wsdl"));
env.setPackageName("org.apache");
@@ -382,7 +379,7 @@
clz = classLoader.loadClass("org.apache.HelloWorldServiceImpl_Service");
}
-
+
public void testHelloWorldExternalBindingFile() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/hello_world_jaxws_base.wsdl"));
env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl/hello_world_jaxws_binding.wsdl"));
@@ -603,7 +600,7 @@
assertFalse("Generated file has been excluded", com.exists());
File iona = new File(com, "iona");
assertFalse("Generated file has been excluded", iona.exists());
-
+
File org = new File(output, "org");
File apache = new File(org, "apache");
File invoice = new File(apache, "Invoice");
@@ -717,7 +714,7 @@
assertNotNull("WebParam should be annotated", webParamAnno);
}
-
+
public void testVoidInOutMethod() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/interoptestdoclit.wsdl"));
processor.setEnvironment(env);
@@ -763,7 +760,6 @@
File helloWorld = new File(apache, "hello_world");
assertTrue(helloWorld.exists());
-
Class clz = classLoader.loadClass("org.apache.hello_world.Greeter");
assertEquals(3, clz.getMethods().length);
@@ -773,13 +769,12 @@
assertEquals("org.apache.hello_world.messages.PingMeFault", method.getExceptionTypes()[0]
.getCanonicalName());
}
-
+
public void testWebFault() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/InvoiceServer-issue305570.wsdl"));
processor.setEnvironment(env);
processor.process();
-
assertNotNull(output);
File org = new File(output, "org");
@@ -797,10 +792,9 @@
}
-
public void testMultiSchemaParsing() throws Exception {
- String[] args = new String[] {"-d", output.getCanonicalPath(),
- getLocation("/wsdl/multi_schema.wsdl")};
+ String[] args =
+ new String[] {"-d", output.getCanonicalPath(), getLocation("/wsdl/multi_schema.wsdl")};
WSDLToJava.main(args);
assertNotNull(output);
@@ -814,14 +808,12 @@
File[] files = header.listFiles();
assertEquals(3, files.length);
}
-
-
public void testBug305728HelloWorld() {
try {
- String[] args = new String[] {"-compile", "-classdir", output.getCanonicalPath() + "/classes",
- "-d",
- output.getCanonicalPath(),
+ String[] args = new String[] {"-compile", "-classdir",
+ output.getCanonicalPath() + "/classes",
+ "-d", output.getCanonicalPath(),
"-nexclude",
"http://www.w3.org/2005/08/addressing"
+ "=org.apache.cxf.ws.addressing",
@@ -830,27 +822,26 @@
} catch (Exception e) {
e.printStackTrace(System.err);
}
-
+
try {
- File file = new File(output.getCanonicalPath(),
+ File file = new File(output.getCanonicalPath(),
"org/apache/cxf/ws/addressing/EndpointReferenceType.java");
-
- assertFalse("Exclude java file should not be generated : " + file.getCanonicalPath(),
- file.exists());
-
+
+ assertFalse("Exclude java file should not be generated : " + file.getCanonicalPath(), file
+ .exists());
+
file = new File(output.getCanonicalPath() + File.separator + "classes",
"org/apache/cxf/ws/addressing/EndpointReferenceType.class");
assertFalse("Exclude class should not be generated : " + file.getCanonicalPath(), file.exists());
-
-
- file = new File(output.getCanonicalPath(),
+
+ file = new File(output.getCanonicalPath(),
"org/w3/_2005/_08/addressing/EndpointReferenceType.java");
assertFalse("Exclude file should not be generated : " + file.getCanonicalPath(), file.exists());
-
- file = new File(output.getCanonicalPath() + File.separator + "classes",
+
+ file = new File(output.getCanonicalPath() + File.separator + "classes",
"org/w3/_2005/_08/addressing/EndpointReferenceType.class");
assertFalse("Exclude class should not be generated : " + file.getCanonicalPath(), file.exists());
-
+
} catch (IOException e) {
e.printStackTrace();
}
@@ -859,31 +850,29 @@
public void testBug305728HelloWorld2() {
try {
String[] args = new String[] {"-compile", "-classdir", output.getCanonicalPath() + "/classes",
- "-d",
- output.getCanonicalPath(),
- "-nexclude",
+ "-d", output.getCanonicalPath(), "-nexclude",
"http://apache.org/hello_world/types",
getLocation("/wsdl/bug305728/hello_world2.wsdl")};
WSDLToJava.main(args);
} catch (Exception e) {
e.printStackTrace();
}
-
+
try {
- File file = new File(output.getCanonicalPath() , "org/apache/hello_world/types");
+ File file = new File(output.getCanonicalPath(), "org/apache/hello_world/types");
assertFalse("Exclude file should not be generated : " + file.getCanonicalPath(), file.exists());
-
- file = new File(output.getCanonicalPath() + File.separator + "classes",
+
+ file = new File(output.getCanonicalPath() + File.separator + "classes",
"org/apache/hello_world/types");
-
+
assertFalse("Exclude file should not be generated : " + file.getCanonicalPath(), file.exists());
-
+
} catch (IOException e) {
e.printStackTrace();
}
-
+
}
-
+
public void testBug305729() {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/bug305729/hello_world.wsdl"));
processor.setEnvironment(env);
@@ -904,7 +893,7 @@
e.printStackTrace();
}
}
-
+
public void testBug305773() {
try {
env.put(ToolConstants.CFG_COMPILE, "compile");
@@ -915,20 +904,19 @@
processor.setEnvironment(env);
processor.process();
Class clz = classLoader.loadClass("org.apache.hello_world_soap_http.GreeterImpl");
-
WebService webServiceAnn = AnnotationUtil.getPrivClassAnnotation(clz, WebService.class);
assertEquals("Greeter", webServiceAnn.name());
- assertFalse("Impl class should generate portName property value in webService annotation"
- , webServiceAnn.portName().equals(""));
- assertFalse("Impl class should generate serviceName property value in webService annotation"
- , webServiceAnn.serviceName().equals(""));
-
+ assertFalse("Impl class should generate portName property value in webService annotation",
+ webServiceAnn.portName().equals(""));
+ assertFalse("Impl class should generate serviceName property value in webService annotation",
+ webServiceAnn.serviceName().equals(""));
+
} catch (Exception e) {
e.printStackTrace();
}
}
-
+
public void testBug305772() {
try {
env.put(ToolConstants.CFG_COMPILE, "compile");
@@ -942,22 +930,22 @@
File file = new File(output.getCanonicalPath(), "build.xml");
FileInputStream fileinput = new FileInputStream(file);
java.io.BufferedInputStream filebuffer = new java.io.BufferedInputStream(fileinput);
- byte[] buffer = new byte[(int)file.length()];
+ byte[] buffer = new byte[(int)file.length()];
filebuffer.read(buffer);
String content = new String(buffer);
- assertTrue("wsdl location should be url style in build.xml",
+ assertTrue("wsdl location should be url style in build.xml",
content.indexOf("param1=\"file:") > -1);
} catch (Exception e) {
e.printStackTrace();
}
}
-
+
public void testBug305770() {
try {
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_CLASSDIR, output.getCanonicalPath() + "/classes");
env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/bug305770/Printer.wsdl"));
processor.setEnvironment(env);
@@ -966,20 +954,18 @@
e.printStackTrace();
}
}
-
+
public void testHangingBug() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/bughanging/wsdl/wsrf.wsdl"));
processor.setEnvironment(env);
- processor.process();
+ processor.process();
}
-
+
public void testBug305924ForNestedBinding() {
try {
- String[] args = new String[] {"-all", "-compile", "-classdir",
- output.getCanonicalPath() + "/classes",
- "-d",
- output.getCanonicalPath(),
- "-b",
+ String[] args = new String[] {"-all", "-compile", "-classdir",
+ output.getCanonicalPath() + "/classes", "-d",
+ output.getCanonicalPath(), "-b",
getLocation("/wsdl/bug305924/binding2.xml"),
getLocation("/wsdl/bug305924/hello_world.wsdl")};
WSDLToJava.main(args);
@@ -988,21 +974,19 @@
}
try {
- Class clz =
- classLoader.loadClass("org.apache.hello_world_soap_http.types.CreateProcess$MyProcess");
+ Class clz = classLoader
+ .loadClass("org.apache.hello_world_soap_http.types.CreateProcess$MyProcess");
assertNotNull("Customization binding code should be generated", clz);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
-
+
public void testBug305924ForExternalBinding() {
try {
- String[] args = new String[] {"-all", "-compile", "-classdir",
- output.getCanonicalPath() + "/classes",
- "-d",
- output.getCanonicalPath(),
- "-b",
+ String[] args = new String[] {"-all", "-compile", "-classdir",
+ output.getCanonicalPath() + "/classes", "-d",
+ output.getCanonicalPath(), "-b",
getLocation("/wsdl/bug305924/binding1.xml"),
getLocation("/wsdl/bug305924/hello_world.wsdl")};
WSDLToJava.main(args);
@@ -1011,14 +995,25 @@
}
try {
- Class clz =
- classLoader.loadClass("org.apache.hello_world_soap_http.types.CreateProcess$MyProcess");
+ Class clz = classLoader
+ .loadClass("org.apache.hello_world_soap_http.types.CreateProcess$MyProcess");
assertNotNull("Customization binding code should be generated", clz);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
-
+
+ public void testInvalidMepOperation() throws Exception {
+ try {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/invalid_mep.wsdl"));
+ processor.setEnvironment(env);
+ processor.process();
+ } catch (Exception e) {
+ assertTrue("Invalid wsdl should be diagnoised", e.getMessage()
+ .indexOf("Invalid WSDL, wsdl:operation") > -1);
+ }
+
+ }
private String getLocation(String wsdlFile) {
return WSDLToJavaProcessorTest.class.getResource(wsdlFile).getFile();
Added: incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl?rev=438838&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl (added)
+++ incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl Thu Aug 31 01:28:15 2006
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<wsdl:definitions name="CorretorWSDL"
+ targetNamespace="http://services.medial.com.br/echo"
+ xmlns:tns="http://services.medial.com.br/echo"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema
+ targetNamespace="http://services.medial.com.br/echoTypes"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:s1="http://services.medial.com.br/echoTypes" />
+ </wsdl:types>
+
+ <wsdl:message name="EchoOut"/>
+
+ <wsdl:portType name="EchoNotification">
+ <wsdl:operation name="notify">
+ <wsdl:output name="Notification1" message="EchoOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="EchoNotifyBinding" type="EchoNotification">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="notify">
+ <soap:operation style="document" />
+ <wsdl:output name="Notification1">
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="EchoService">
+ <wsdl:port name="EchoNotify" binding="EchoNotifyBinding">
+ <soap:address location="www.exampleLocation.com/Port1" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl/invalid_mep.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml