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 2009/08/08 03:03:40 UTC
svn commit: r802277 - in /cxf/trunk:
api/src/main/java/org/apache/cxf/annotations/
api/src/main/java/org/apache/cxf/service/model/
rt/core/src/main/java/org/apache/cxf/service/factory/
rt/core/src/main/java/org/apache/cxf/wsdl11/ systests/src/test/java...
Author: dkulp
Date: Sat Aug 8 01:03:40 2009
New Revision: 802277
URL: http://svn.apache.org/viewvc?rev=802277&view=rev
Log:
Wire WSDLDocumentation into many more spots
Added:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentationCollection.java
- copied, changed from r801962, cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java Sat Aug 8 01:03:40 2009
@@ -30,7 +30,44 @@
*
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
+@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER })
public @interface WSDLDocumentation {
String value();
+
+ Placement placement() default Placement.DEFAULT;
+
+ /**
+ * If Placement is FAULT_MESSAGE, PORT_FAULT, or BINDING_FAULT,
+ * return the fault class associated with this documentation
+ * @return the fault class
+ */
+ Class<?> faultClass() default DEFAULT.class;
+
+ enum Placement {
+ DEFAULT,
+ TOP,
+
+ INPUT_MESSAGE,
+ OUTPUT_MESSAGE,
+ FAULT_MESSAGE,
+
+ PORT_TYPE,
+ PORT_TYPE_OPERATION,
+ PORT_TYPE_OPERATION_INPUT,
+ PORT_TYPE_OPERATION_OUTPUT,
+ PORT_TYPE_OPERATION_FAULT,
+
+ BINDING,
+ BINDING_OPERATION,
+ BINDING_OPERATION_INPUT,
+ BINDING_OPERATION_OUTPUT,
+ BINDING_OPERATION_FAULT,
+
+ SERVICE,
+ SERVICE_PORT,
+
+ };
+
+
+ static final class DEFAULT { }
}
Copied: cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentationCollection.java (from r801962, cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentationCollection.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentationCollection.java&p1=cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java&r1=801962&r2=802277&rev=802277&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentationCollection.java Sat Aug 8 01:03:40 2009
@@ -30,7 +30,8 @@
*
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface WSDLDocumentation {
- String value();
+@Target({ ElementType.TYPE, ElementType.METHOD })
+public @interface WSDLDocumentationCollection {
+ WSDLDocumentation[] value();
+
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java Sat Aug 8 01:03:40 2009
@@ -34,6 +34,8 @@
private Map<QName, MessagePartInfo> messageParts
= new LinkedHashMap<QName, MessagePartInfo>(4);
private List<MessagePartInfo> outOfBandParts;
+ private String documentation;
+
/**
* Initializes a new instance of the <code>MessagePartContainer</code>.
@@ -45,6 +47,13 @@
mName = nm;
}
+ public String getMessageDocumentation() {
+ return documentation;
+ }
+ public void setMessageDocumentation(String doc) {
+ documentation = doc;
+ }
+
public QName getName() {
return mName;
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java Sat Aug 8 01:03:40 2009
@@ -48,6 +48,12 @@
}
return propertyMap.get().get(name);
}
+ public Object removeProperty(String name) {
+ if (null == propertyMap.get()) {
+ return null;
+ }
+ return propertyMap.get().remove(name);
+ }
public <T> T getProperty(String name, Class<T> cls) {
return cls.cast(getProperty(name));
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java Sat Aug 8 01:03:40 2009
@@ -40,10 +40,18 @@
Map<QName, MessageInfo> messages;
List<SchemaInfo> schemas = new ArrayList<SchemaInfo>(4);
private SchemaCollection xmlSchemaCollection;
+ private String topLevelDoc;
public ServiceInfo() {
xmlSchemaCollection = new SchemaCollection();
}
+
+ public String getTopLevelDoc() {
+ return topLevelDoc;
+ }
+ public void setTopLevelDoc(String s) {
+ topLevelDoc = s;
+ }
public String getTargetNamespace() {
return targetNamespace;
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java Sat Aug 8 01:03:40 2009
@@ -19,17 +19,31 @@
package org.apache.cxf.service.factory;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.cxf.annotations.SchemaValidation;
import org.apache.cxf.annotations.WSDLDocumentation;
+import org.apache.cxf.annotations.WSDLDocumentation.Placement;
+import org.apache.cxf.annotations.WSDLDocumentationCollection;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.FaultInfo;
import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.OperationInfo;
/**
*
*/
public class AnnotationsFactoryBeanListener implements FactoryBeanListener {
+
+ private static final String EXTRA_DOCUMENTATION
+ = AnnotationsFactoryBeanListener.class.getName() + ".EXTRA_DOCS";
/** {@inheritDoc}*/
public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args) {
@@ -38,8 +52,11 @@
Class<?> cls = (Class<?>)args[1];
WSDLDocumentation doc = cls.getAnnotation(WSDLDocumentation.class);
if (doc != null) {
- InterfaceInfo info = (InterfaceInfo)args[0];
- info.setDocumentation(doc.value());
+ addDocumentation((InterfaceInfo)args[0], WSDLDocumentation.Placement.PORT_TYPE, doc);
+ }
+ WSDLDocumentationCollection col = cls.getAnnotation(WSDLDocumentationCollection.class);
+ if (col != null) {
+ addDocumentation((InterfaceInfo)args[0], WSDLDocumentation.Placement.PORT_TYPE, col.value());
}
break;
}
@@ -59,8 +76,32 @@
}
WSDLDocumentation doc = cls.getAnnotation(WSDLDocumentation.class);
if (doc != null) {
- ((Server)args[0]).getEndpoint().getService().getServiceInfos()
- .get(0).setDocumentation(doc.value());
+ addDocumentation((Server)args[0], WSDLDocumentation.Placement.SERVICE, doc);
+ }
+ WSDLDocumentationCollection col = cls.getAnnotation(WSDLDocumentationCollection.class);
+ if (col != null) {
+ addDocumentation((Server)args[0], WSDLDocumentation.Placement.SERVICE, col.value());
+ }
+ InterfaceInfo i = ((Server)args[0]).getEndpoint().getEndpointInfo().getInterface();
+ List<WSDLDocumentation> docs = CastUtils.cast((List<?>)i.removeProperty(EXTRA_DOCUMENTATION));
+ if (docs != null) {
+ addDocumentation((Server)args[0],
+ WSDLDocumentation.Placement.SERVICE,
+ docs.toArray(new WSDLDocumentation[docs.size()]));
+ }
+ addBindingOperationDocs((Server)args[0]);
+ break;
+ }
+ case INTERFACE_OPERATION_BOUND: {
+ OperationInfo inf = (OperationInfo)args[0];
+ Method m = (Method)args[1];
+ WSDLDocumentation doc = m.getAnnotation(WSDLDocumentation.class);
+ if (doc != null) {
+ addDocumentation(inf, WSDLDocumentation.Placement.PORT_TYPE_OPERATION, doc);
+ }
+ WSDLDocumentationCollection col = m.getAnnotation(WSDLDocumentationCollection.class);
+ if (col != null) {
+ addDocumentation(inf, WSDLDocumentation.Placement.PORT_TYPE_OPERATION, col.value());
}
break;
}
@@ -69,4 +110,153 @@
}
}
+ private void addBindingOperationDocs(Server server) {
+ for (BindingOperationInfo binfo : server.getEndpoint().getBinding()
+ .getBindingInfo().getOperations()) {
+ List<WSDLDocumentation> later = CastUtils.cast((List<?>)binfo.getOperationInfo()
+ .getProperty(EXTRA_DOCUMENTATION));
+ if (later != null) {
+ for (WSDLDocumentation doc : later) {
+ switch (doc.placement()) {
+ case BINDING_OPERATION:
+ binfo.setDocumentation(doc.value());
+ break;
+ case BINDING_OPERATION_INPUT:
+ binfo.getInput().setDocumentation(doc.value());
+ break;
+ case BINDING_OPERATION_OUTPUT:
+ binfo.getOutput().setDocumentation(doc.value());
+ break;
+ case BINDING_OPERATION_FAULT: {
+ for (BindingFaultInfo f : binfo.getFaults()) {
+ if (doc.faultClass().equals(f.getFaultInfo()
+ .getProperty(Class.class.getName()))) {
+ f.setDocumentation(doc.value());
+ }
+ }
+ break;
+ }
+ default:
+ //nothing
+ }
+ }
+ }
+ }
+ }
+
+ private void addDocumentation(OperationInfo inf, Placement defPlace, WSDLDocumentation ... values) {
+ List<WSDLDocumentation> later = new ArrayList<WSDLDocumentation>();
+ for (WSDLDocumentation doc : values) {
+ WSDLDocumentation.Placement p = doc.placement();
+ if (p == WSDLDocumentation.Placement.DEFAULT) {
+ p = defPlace;
+ }
+ switch (p) {
+ case PORT_TYPE_OPERATION:
+ inf.setDocumentation(doc.value());
+ break;
+ case PORT_TYPE_OPERATION_INPUT:
+ inf.getInput().setDocumentation(doc.value());
+ break;
+ case PORT_TYPE_OPERATION_OUTPUT:
+ inf.getOutput().setDocumentation(doc.value());
+ break;
+ case FAULT_MESSAGE:
+ case PORT_TYPE_OPERATION_FAULT: {
+ for (FaultInfo f : inf.getFaults()) {
+ if (doc.faultClass().equals(f.getProperty(Class.class.getName()))) {
+ if (p == Placement.FAULT_MESSAGE) {
+ f.setMessageDocumentation(doc.value());
+ } else {
+ f.setDocumentation(doc.value());
+ }
+ }
+ }
+ break;
+ }
+ case INPUT_MESSAGE:
+ inf.getInput().setMessageDocumentation(doc.value());
+ break;
+ case OUTPUT_MESSAGE:
+ inf.getOutput().setMessageDocumentation(doc.value());
+ break;
+ default:
+ later.add(doc);
+ }
+ }
+ if (!later.isEmpty()) {
+ List<WSDLDocumentation> stuff = CastUtils.cast((List<?>)inf
+ .getProperty(EXTRA_DOCUMENTATION));
+ if (stuff != null) {
+ stuff.addAll(later);
+ } else {
+ inf.setProperty(EXTRA_DOCUMENTATION, later);
+ }
+ }
+ }
+
+ private void addDocumentation(InterfaceInfo interfaceInfo,
+ WSDLDocumentation.Placement defPlace,
+ WSDLDocumentation ... values) {
+ List<WSDLDocumentation> later = new ArrayList<WSDLDocumentation>();
+ for (WSDLDocumentation doc : values) {
+ WSDLDocumentation.Placement p = doc.placement();
+ if (p == WSDLDocumentation.Placement.DEFAULT) {
+ p = defPlace;
+ }
+ switch (p) {
+ case PORT_TYPE:
+ interfaceInfo.setDocumentation(doc.value());
+ break;
+ case SERVICE:
+ interfaceInfo.getService().setDocumentation(doc.value());
+ break;
+ case TOP:
+ interfaceInfo.getService().setTopLevelDoc(doc.value());
+ break;
+ default:
+ later.add(doc);
+ }
+ }
+ if (!later.isEmpty()) {
+ List<WSDLDocumentation> stuff = CastUtils.cast((List<?>)interfaceInfo
+ .getProperty(EXTRA_DOCUMENTATION));
+ if (stuff != null) {
+ stuff.addAll(later);
+ } else {
+ interfaceInfo.setProperty(EXTRA_DOCUMENTATION, later);
+ }
+ }
+ }
+ private void addDocumentation(Server server,
+ WSDLDocumentation.Placement defPlace,
+ WSDLDocumentation ... values) {
+ for (WSDLDocumentation doc : values) {
+ WSDLDocumentation.Placement p = doc.placement();
+ if (p == WSDLDocumentation.Placement.DEFAULT) {
+ p = defPlace;
+ }
+ switch (p) {
+ case PORT_TYPE:
+ server.getEndpoint().getEndpointInfo().getService()
+ .getInterface().setDocumentation(doc.value());
+ break;
+ case TOP:
+ server.getEndpoint().getEndpointInfo().getService().setTopLevelDoc(doc.value());
+ break;
+ case SERVICE:
+ server.getEndpoint().getEndpointInfo().getService().setDocumentation(doc.value());
+ break;
+ case SERVICE_PORT:
+ server.getEndpoint().getEndpointInfo().setDocumentation(doc.value());
+ break;
+ case BINDING:
+ server.getEndpoint().getEndpointInfo().getBinding().setDocumentation(doc.value());
+ break;
+ default:
+ //nothing?
+ }
+ }
+ }
+
}
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Sat Aug 8 01:03:40 2009
@@ -311,6 +311,7 @@
Binding binding = null;
for (BindingInfo bindingInfo : bindingInfos) {
binding = definition.createBinding();
+ addDocumentation(binding, bindingInfo.getDocumentation());
binding.setUndefined(false);
for (PortType portType : portTypes) {
if (portType.getQName().equals(bindingInfo.getInterface().getName())) {
@@ -330,6 +331,7 @@
BindingOperation bindingOperation = null;
for (BindingOperationInfo bindingOperationInfo : bindingOperationInfos) {
bindingOperation = def.createBindingOperation();
+ addDocumentation(bindingOperation, bindingOperationInfo.getDocumentation());
bindingOperation.setName(bindingOperationInfo.getName().getLocalPart());
for (Operation operation
: CastUtils.cast(binding.getPortType().getOperations(), Operation.class)) {
@@ -353,6 +355,7 @@
for (BindingFaultInfo bindingFaultInfo
: bindingFaultInfos) {
bindingFault = def.createBindingFault();
+ addDocumentation(bindingFault, bindingFaultInfo.getDocumentation());
bindingFault.setName(bindingFaultInfo.getFaultInfo().getFaultName().getLocalPart());
bindingOperation.addBindingFault(bindingFault);
addExtensibilityAttributes(bindingFault, bindingFaultInfo.getExtensionAttributes());
@@ -366,6 +369,7 @@
BindingInput bindingInput = null;
if (bindingMessageInfo != null) {
bindingInput = def.createBindingInput();
+ addDocumentation(bindingInput, bindingMessageInfo.getDocumentation());
bindingInput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart());
bindingOperation.setBindingInput(bindingInput);
addExtensibilityAttributes(bindingInput, bindingMessageInfo.getExtensionAttributes());
@@ -378,6 +382,7 @@
BindingOutput bindingOutput = null;
if (bindingMessageInfo != null) {
bindingOutput = def.createBindingOutput();
+ addDocumentation(bindingOutput, bindingMessageInfo.getDocumentation());
bindingOutput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart());
bindingOperation.setBindingOutput(bindingOutput);
addExtensibilityAttributes(bindingOutput, bindingMessageInfo.getExtensionAttributes());
@@ -396,6 +401,7 @@
continue;
}
Message message = definition.createMessage();
+ addDocumentation(message, mie.getValue().getMessageDocumentation());
message.setUndefined(false);
message.setQName(mie.getKey());
for (MessagePartInfo mpi : mie.getValue().getMessageParts()) {
@@ -419,6 +425,7 @@
definition.addMessage(message);
}
+ addDocumentation(definition, serviceInfo.getTopLevelDoc());
Service serv = definition.createService();
addDocumentation(serv, serviceInfo.getDocumentation());
serv.setQName(serviceInfo.getName());
@@ -428,6 +435,7 @@
for (EndpointInfo ei : serviceInfo.getEndpoints()) {
addNamespace(ei.getTransportId());
Port port = definition.createPort();
+ addDocumentation(port, ei.getDocumentation());
port.setName(ei.getName().getLocalPart());
port.setBinding(definition.getBinding(ei.getBinding().getName()));
addExtensibilityElements(port, getWSDL11Extensors(ei));
@@ -502,6 +510,7 @@
if (operation == null) {
operation = def.createOperation();
+ addDocumentation(operation, operationInfo.getDocumentation());
operation.setUndefined(false);
operation.setName(operationInfo.getName().getLocalPart());
addNamespace(operationInfo.getName().getNamespaceURI(), def);
@@ -510,6 +519,7 @@
}
this.addExtensibilityElements(operation, getWSDL11Extensors(operationInfo));
Input input = def.createInput();
+ addDocumentation(input, operationInfo.getInput().getDocumentation());
input.setName(operationInfo.getInputName());
Message message = def.createMessage();
buildMessage(message, operationInfo.getInput(), def);
@@ -520,6 +530,7 @@
if (operationInfo.getOutput() != null) {
Output output = def.createOutput();
+ addDocumentation(output, operationInfo.getOutput().getDocumentation());
output.setName(operationInfo.getOutputName());
message = def.createMessage();
buildMessage(message, operationInfo.getOutput(), def);
@@ -532,6 +543,7 @@
Fault fault = null;
for (FaultInfo faultInfo : faults) {
fault = def.createFault();
+ addDocumentation(fault, faultInfo.getDocumentation());
fault.setName(faultInfo.getFaultName().getLocalPart());
message = def.createMessage();
buildMessage(message, faultInfo, def);
@@ -571,7 +583,7 @@
protected void buildMessage(Message message,
AbstractMessageContainer messageContainer,
final Definition def) {
-
+ addDocumentation(message, messageContainer.getMessageDocumentation());
message.setQName(messageContainer.getName());
message.setUndefined(false);
def.addMessage(message);
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Sat Aug 8 01:03:40 2009
@@ -48,8 +48,8 @@
import org.apache.cxf.anonymous_complex_type.SplitName;
import org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names;
import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.jaxb_element_test.JaxbElementTest;
@@ -77,10 +77,72 @@
@Test
public void testWSDLDocs() throws Exception {
- String s = IOUtils.toString(this.getHttpConnection(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl")
+ Map<String, String> ns = new HashMap<String, String>();
+ ns.put("wsdl", WSDLConstants.NS_WSDL11);
+ XPathUtils xpu = new XPathUtils(ns);
+ Document wsdl = XMLUtils.parse(this.getHttpConnection(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl")
.getInputStream());
- assertTrue(s.contains("DocLitWrappedCodeFirstService impl"));
- assertTrue(s.contains("DocLitWrappedCodeFirstService interface"));
+ XMLUtils.printDOM(wsdl.getDocumentElement());
+ assertEquals("DocLitWrappedCodeFirstService impl",
+ xpu.getValue("/wsdl:definitions/wsdl:service/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService interface",
+ xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService top level doc",
+ xpu.getValue("/wsdl:definitions/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService binding doc",
+ xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService service/port doc",
+ xpu.getValue("/wsdl:definitions/wsdl:service/wsdl:port/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut doc",
+ xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut Input doc",
+ xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:input/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut Output doc",
+ xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:output/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut InputMessage doc",
+ xpu.getValue("/wsdl:definitions/wsdl:message[@name='multiInOut']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut OutputMessage doc",
+ xpu.getValue("/wsdl:definitions/wsdl:message[@name='multiInOutResponse']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut binding doc",
+ xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut binding Input doc",
+ xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:input/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut binding Output doc",
+ xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:output/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
}
@Test
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=802277&r1=802276&r2=802277&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java Sat Aug 8 01:03:40 2009
@@ -39,6 +39,7 @@
import javax.xml.ws.ResponseWrapper;
import org.apache.cxf.annotations.WSDLDocumentation;
+import org.apache.cxf.annotations.WSDLDocumentationCollection;
import org.apache.cxf.feature.Features;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.systest.jaxws.types.Bar;
@@ -50,7 +51,17 @@
//@Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
@Features(features = { "org.apache.cxf.transport.http.gzip.GZIPFeature",
"org.apache.cxf.feature.FastInfosetFeature" })
-@WSDLDocumentation("DocLitWrappedCodeFirstService interface")
+@WSDLDocumentationCollection(
+ {
+ @WSDLDocumentation("DocLitWrappedCodeFirstService interface"),
+ @WSDLDocumentation(value = "DocLitWrappedCodeFirstService top level doc",
+ placement = WSDLDocumentation.Placement.TOP),
+ @WSDLDocumentation(value = "DocLitWrappedCodeFirstService binding doc",
+ placement = WSDLDocumentation.Placement.BINDING),
+ @WSDLDocumentation(value = "DocLitWrappedCodeFirstService service/port doc",
+ placement = WSDLDocumentation.Placement.SERVICE_PORT),
+ }
+)
public interface DocLitWrappedCodeFirstService {
@Oneway
@@ -81,6 +92,25 @@
String multiListInput(List<String> inputs1, List<String> inputs2, String x, int y);
@WebMethod
+ @WSDLDocumentationCollection(
+ {
+ @WSDLDocumentation("multiInOut doc"),
+ @WSDLDocumentation(value = "multiInOut Input doc",
+ placement = WSDLDocumentation.Placement.PORT_TYPE_OPERATION_INPUT),
+ @WSDLDocumentation(value = "multiInOut Output doc",
+ placement = WSDLDocumentation.Placement.PORT_TYPE_OPERATION_OUTPUT),
+ @WSDLDocumentation(value = "multiInOut InputMessage doc",
+ placement = WSDLDocumentation.Placement.INPUT_MESSAGE),
+ @WSDLDocumentation(value = "multiInOut OutputMessage doc",
+ placement = WSDLDocumentation.Placement.OUTPUT_MESSAGE),
+ @WSDLDocumentation(value = "multiInOut binding doc",
+ placement = WSDLDocumentation.Placement.BINDING_OPERATION),
+ @WSDLDocumentation(value = "multiInOut binding Input doc",
+ placement = WSDLDocumentation.Placement.BINDING_OPERATION_INPUT),
+ @WSDLDocumentation(value = "multiInOut binding Output doc",
+ placement = WSDLDocumentation.Placement.BINDING_OPERATION_OUTPUT),
+ }
+ )
String multiInOut(@WebParam(mode = WebParam.Mode.OUT)
Holder<String> a,
@WebParam(mode = WebParam.Mode.INOUT)
@@ -110,7 +140,9 @@
@WebMethod
int throwException(int i)
- throws ServiceTestFault, CustomException, ComplexException;
+ throws ServiceTestFault,
+ CustomException,
+ ComplexException;
@RequestWrapper(localName = "echoIntX")
@ResponseWrapper(localName = "echoIntXResponse")