summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/interface-wsdl
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-13 14:12:38 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-13 14:12:38 +0000
commit699653d2ae2df1cec6af2915c90a6a7137a1c077 (patch)
tree86e5639772629c69a4e9637e682ede48b518b70b /sca-java-2.x/trunk/modules/interface-wsdl
parent438fd75ec9cb93740700d9a37c6ea133e1c997ed (diff)
TUSCANY-3890 - separate the request wrapper model from the response wrapper model as per the change in 1.x under TUSCANY-2931.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1213702 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/interface-wsdl')
-rw-r--r--sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java68
-rw-r--r--sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java12
-rw-r--r--sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java14
3 files changed, 33 insertions, 61 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
index 275049c0fe..830258a8c0 100644
--- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
+++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
@@ -219,10 +219,12 @@ public class WSDLOperationIntrospectorImpl {
}
operationModel.setOutputType(getOutputType());
- operationModel.setWrapperStyle(isWrapperStyle());
+ operationModel.setInputWrapperStyle(isWrapperStyle());
+ operationModel.setOutputWrapperStyle(isWrapperStyle());
+
if (isWrapperStyle()) {
- WrapperInfo wrapperInfo = getWrapper().getWrapperInfo();
- operationModel.setWrapper(wrapperInfo);
+ operationModel.setInputWrapper(getWrapper().getInputWrapperInfo());
+ operationModel.setOutputWrapper(getWrapper().getOutputWrapperInfo());
}
}
return operationModel;
@@ -347,11 +349,8 @@ public class WSDLOperationIntrospectorImpl {
private List<XmlSchemaElement> outputElements;
- // private DataType<List<DataType<XMLType>>> unwrappedInputType;
- //
- // private DataType<XMLType> unwrappedOutputType;
-
- private transient WrapperInfo wrapperInfo;
+ private transient WrapperInfo inputWrapperInfo;
+ private transient WrapperInfo outputWrapperInfo;
private List<XmlSchemaElement> getChildElements(XmlSchemaElement element) throws InvalidWSDLException {
if (element == null) {
@@ -519,61 +518,34 @@ public class WSDLOperationIntrospectorImpl {
return outputWrapperElement;
}
- /*
- public DataType<List<DataType<XMLType>>> getUnwrappedInputType() throws InvalidWSDLException {
- if (unwrappedInputType == null) {
- List<DataType<XMLType>> childTypes = new ArrayList<DataType<XMLType>>();
- for (XmlSchemaElement element : getInputChildElements()) {
- DataType<XMLType> type =
- new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
- // type.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
- childTypes.add(type);
- }
- unwrappedInputType =
- new DataType<List<DataType<XMLType>>>("idl:unwrapped.input", Object[].class, childTypes);
- }
- return unwrappedInputType;
- }
-
- public DataType<XMLType> getUnwrappedOutputType() throws InvalidServiceContractException {
- if (unwrappedOutputType == null) {
- List<XmlSchemaElement> elements = getOutputChildElements();
- if (elements != null && elements.size() > 0) {
- if (elements.size() > 1) {
- // We don't support output with multiple parts
- throw new NotSupportedWSDLException("Multi-part output is not supported");
- }
- XmlSchemaElement element = elements.get(0);
- unwrappedOutputType =
- new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
- // unwrappedOutputType.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
- }
- }
- return unwrappedOutputType;
- }
- */
-
- public WrapperInfo getWrapperInfo() throws InvalidWSDLException {
- if (wrapperInfo == null) {
+ public WrapperInfo getInputWrapperInfo() throws InvalidWSDLException {
+ if (inputWrapperInfo == null) {
ElementInfo in = getElementInfo(getInputWrapperElement());
- ElementInfo out = getElementInfo(getOutputWrapperElement());
List<ElementInfo> inChildren = new ArrayList<ElementInfo>();
if (in != null) {
for (XmlSchemaElement e : getInputChildElements()) {
inChildren.add(getElementInfo(e));
}
}
+ inputWrapperInfo = new WrapperInfo(dataBinding, in, inChildren);
+ }
+ return inputWrapperInfo;
+ }
+
+ public WrapperInfo getOutputWrapperInfo() throws InvalidWSDLException {
+ if (outputWrapperInfo == null) {
+ ElementInfo out = getElementInfo(getOutputWrapperElement());
List<ElementInfo> outChildren = new ArrayList<ElementInfo>();
if (out != null) {
for (XmlSchemaElement e : getOutputChildElements()) {
outChildren.add(getElementInfo(e));
}
}
- wrapperInfo = new WrapperInfo(dataBinding, in, out, inChildren, outChildren);
+ outputWrapperInfo = new WrapperInfo(dataBinding, out, outChildren);
}
- return wrapperInfo;
+ return outputWrapperInfo;
}
- }
+ }
private static ElementInfo getElementInfo(XmlSchemaElement element) {
if (element == null) {
diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
index cb0b347ae4..20397b5093 100644
--- a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
+++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
@@ -71,15 +71,15 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase {
DataType<XMLType> logical = outputType.getLogical().get(0);
Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"),
logical.getLogical().getElementName());
- Assert.assertTrue(op.isWrapperStyle());
+ Assert.assertTrue(op.isInputWrapperStyle());
- DataType<List<DataType>> unwrappedInputType = op.getWrapper().getUnwrappedInputType();
+ DataType<List<DataType>> unwrappedInputType = op.getInputWrapper().getUnwrappedType();
List<DataType> childTypes = unwrappedInputType.getLogical();
Assert.assertEquals(1, childTypes.size());
DataType<XMLType> childType = childTypes.get(0);
Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical().getElementName());
- DataType<List<DataType>> unwrappedOutputType = op.getWrapper().getUnwrappedOutputType();
+ DataType<List<DataType>> unwrappedOutputType = op.getOutputWrapper().getUnwrappedType();
childTypes = unwrappedOutputType.getLogical();
Assert.assertEquals(1, childTypes.size());
childType = childTypes.get(0);
@@ -97,11 +97,11 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase {
WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
WSDLOperation op = (WSDLOperation) wi.getOperations().get(1);
- Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertFalse(op.isInputWrapperStyle());
Assert.assertEquals(1, op.getInputType().getLogical().size());
op = (WSDLOperation) wi.getOperations().get(2);
- Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertFalse(op.isInputWrapperStyle());
Assert.assertEquals(2, op.getInputType().getLogical().size());
}
@@ -118,7 +118,7 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase {
WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
WSDLOperation op = (WSDLOperation) wi.getOperations().get(0);
- op.isWrapperStyle();
+ op.isInputWrapperStyle();
fail("InvalidWSDLException should have been thrown");
} catch (InvalidInterfaceException e) {
// Expected
diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
index c2d6f40416..533bb6fe29 100644
--- a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
+++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
@@ -52,9 +52,9 @@ public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase {
PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
WSDLOperation op = (WSDLOperation) wi.getOperations().get(0);
- Assert.assertTrue(op.isWrapperStyle());
- Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
- Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
+ Assert.assertTrue(op.isInputWrapperStyle());
+ Assert.assertEquals(1, op.getInputWrapper().getChildElements().size());
+ Assert.assertEquals(1, op.getOutputWrapper().getChildElements().size());
}
@Test
@@ -67,11 +67,11 @@ public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase {
PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
WSDLOperation op = (WSDLOperation) wi.getOperations().get(0);
- Assert.assertTrue(op.isWrapperStyle());
+ Assert.assertTrue(op.isInputWrapperStyle());
op = (WSDLOperation) wi.getOperations().get(1);
- Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertFalse(op.isInputWrapperStyle());
op = (WSDLOperation) wi.getOperations().get(2);
- Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertFalse(op.isInputWrapperStyle());
}
@@ -86,7 +86,7 @@ public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase {
PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
WSDLOperation op = (WSDLOperation) wi.getOperations().get(0);
- Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertFalse(op.isInputWrapperStyle());
}
}