Repository: cxf Updated Branches: refs/heads/master 390231e77 -> 1876a1fd1
Fix some more XXX comments and TODO comments, move some common type tests up Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1876a1fd Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1876a1fd Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1876a1fd Branch: refs/heads/master Commit: 1876a1fd169d7df2815f8dcc53114f729807007f Parents: 390231e Author: Daniel Kulp <[email protected]> Authored: Mon Aug 14 11:27:49 2017 -0400 Committer: Daniel Kulp <[email protected]> Committed: Mon Aug 14 11:27:49 2017 -0400 ---------------------------------------------------------------------- .../AbstractInDatabindingInterceptor.java | 1 - .../org/apache/cxf/staxutils/StaxUtils.java | 4 +- .../wsdl/interceptors/BareInInterceptor.java | 8 - .../type_test/AbstractTypeTestClient3.java | 19 -- .../type_test/AbstractTypeTestClient4.java | 6 +- .../type_test/AbstractTypeTestClient5.java | 226 +++++++++++++++++++ .../corba/CORBADocLitClientTypeTest.java | 4 + .../soap/SOAPDocLitClientTypeTest.java | 184 --------------- .../soap/SOAPRpcLitClientTypeTest.java | 182 --------------- .../tools/validator/internal/ValidatorUtil.java | 4 +- 10 files changed, 234 insertions(+), 404 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java index b6d99af..e7051f6 100644 --- a/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java +++ b/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java @@ -272,7 +272,6 @@ public abstract class AbstractInDatabindingInterceptor extends AbstractPhaseInte local = local.substring(0, local.length() - 8); } - // TODO: Allow overridden methods. BindingOperationInfo bop = ServiceModelUtil.getOperation(exchange, local); if (bop != null) { http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java index fab8f31..e1e5cf5 100644 --- a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java +++ b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java @@ -712,9 +712,7 @@ public final class StaxUtils { /** * Copies the reader to the writer. The start and end document methods must - * be handled on the writer manually. TODO: if the namespace on the reader - * has been declared previously to where we are in the stream, this probably - * won't work. + * be handled on the writer manually. * * @param reader * @param writer http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java index e20e7c4..d9e0b41 100644 --- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java +++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java @@ -77,9 +77,6 @@ public class BareInInterceptor extends AbstractInDatabindingInterceptor { Endpoint ep = exchange.getEndpoint(); BindingOperationInfo bop = exchange.getBindingOperationInfo(); ServiceInfo si = ep.getEndpointInfo().getService(); - // XXX - Should the BindingMessageInfo.class be put on - // the message? - //MessageInfo msgInfo = message.get(MessageInfo.class); BindingMessageInfo msgInfo = null; boolean client = isRequestor(message); @@ -102,11 +99,6 @@ public class BareInInterceptor extends AbstractInDatabindingInterceptor { } } else { - // XXX - Is the call to - // AbstractInDatabindingInterceptor.getMessageInfo() - // necessary? Should we put the BindingMessageInfo on - // the message instead of the MessageInfo? - // msgInfo = getMessageInfo(message, bop, exchange); getMessageInfo(message, bop); if (client) { msgInfo = bop.getOutput(); http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient3.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient3.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient3.java index 27556b1..ddb0a9c 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient3.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient3.java @@ -75,7 +75,6 @@ import org.apache.type_test.types3.OccuringStruct; import org.apache.type_test.types3.OccuringStruct1; import org.apache.type_test.types3.OccuringStruct2; -import org.junit.Ignore; import org.junit.Test; public abstract class AbstractTypeTestClient3 extends AbstractTypeTestClient2 { @@ -1268,24 +1267,6 @@ public abstract class AbstractTypeTestClient3 extends AbstractTypeTestClient2 { } } - @Test - @Ignore - public void testStructWithAnyStrict() throws Exception { - if (!shouldRunTest("StructWithAnyStrict")) { - return; - } - // XXX - only added to the soap typetest - } - - @Test - @Ignore - public void testStructWithAnyArrayLax() throws Exception { - if (!shouldRunTest("StructWithAnyArrayLax")) { - return; - } - // XXX - only added to the soap typetest - } - //org.apache.type_test.types2.IDTypeAttribute protected boolean equalsIDTypeAttribute(IDTypeAttribute x, IDTypeAttribute y) { http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient4.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient4.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient4.java index d25feaf..936075b 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient4.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient4.java @@ -1128,14 +1128,12 @@ public abstract class AbstractTypeTestClient4 extends AbstractTypeTestClient3 { } } - /* XXX - The DerivedChoiceBaseAll, DerivedStructBaseAll, DerivedAll* types + /* The DerivedChoiceBaseAll, DerivedStructBaseAll, DerivedAll* types * result in an error creating the Schema object: * cos-all-limited.1.2: An 'all' model group must appear in a particle with * {min occurs} = {max occurs} = 1, and that particle must be part of a * pair which constitutes the {content type} of a complex type definition. - * -*/ - //org.apache.type_test.types1.ComplexArray + */ protected boolean equals(ComplexArray x, ComplexArray y) { List<DerivedAllBaseStruct> xx = x.getVarDerivedItem(); http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient5.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient5.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient5.java index cbc7eff..f46ce29 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient5.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient5.java @@ -21,6 +21,8 @@ package org.apache.cxf.systest.type_test; import java.util.Arrays; import java.util.List; +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPFactory; import javax.xml.ws.Holder; import org.apache.type_test.types1.ComplexRestriction; @@ -33,6 +35,8 @@ import org.apache.type_test.types1.MixedArray; import org.apache.type_test.types1.MixedArray.Array10; import org.apache.type_test.types1.MixedArray.Array9; import org.apache.type_test.types1.UnboundedArray; +import org.apache.type_test.types2.StructWithAnyArrayLax; +import org.apache.type_test.types2.StructWithAnyStrict; import org.junit.Test; public abstract class AbstractTypeTestClient5 extends AbstractTypeTestClient4 { @@ -508,5 +512,227 @@ public abstract class AbstractTypeTestClient5 extends AbstractTypeTestClient4 { assertTrue("testMixedArray(): Incorrect return value", equals(x, ret)); } } + public void assertEqualsStructWithAnyStrict(StructWithAnyStrict a, + StructWithAnyStrict b) throws Exception { + assertEquals("StructWithAnyStrict names don't match", a.getName(), b.getName()); + assertEquals("StructWithAnyStrict addresses don't match", a.getAddress(), b.getAddress()); + if (a.getAny() instanceof SOAPElement && b.getAny() instanceof SOAPElement) { + assertEquals((SOAPElement)a.getAny(), (SOAPElement)b.getAny()); + } + } + + public void assertEqualsStructWithAnyArrayLax(StructWithAnyArrayLax a, + StructWithAnyArrayLax b) throws Exception { + assertEquals("StructWithAnyArrayLax names don't match", a.getName(), b.getName()); + assertEquals("StructWithAnyArrayLax addresses don't match", a.getAddress(), b.getAddress()); + + List<Object> ae = a.getAny(); + List<Object> be = b.getAny(); + assertEquals("StructWithAnyArrayLax soap element lengths don't match", ae.size(), be.size()); + for (int i = 0; i < ae.size(); i++) { + if (ae.get(i) instanceof SOAPElement && be.get(i) instanceof SOAPElement) { + assertEquals(ae.get(i), be.get(i)); + } + } + } + @Test + public void testStructWithAnyStrict() throws Exception { + if (!shouldRunTest("StructWithAnyStrict")) { + return; + } + SOAPFactory factory = SOAPFactory.newInstance(); + SOAPElement elem = factory.createElement("StringElementQualified", + "x1", "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + elem.addTextNode("This is the text of the node"); + + StructWithAnyStrict x = new StructWithAnyStrict(); + x.setName("Name x"); + x.setAddress("Some Address x"); + x.setAny(elem); + + elem = factory.createElement("StringElementQualified", + "x1", "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + elem.addTextNode("This is the text of the second node"); + + StructWithAnyStrict yOrig = new StructWithAnyStrict(); + yOrig.setName("Name y"); + yOrig.setAddress("Some Address y"); + yOrig.setAny(elem); + + Holder<StructWithAnyStrict> y = new Holder<StructWithAnyStrict>(yOrig); + Holder<StructWithAnyStrict> z = new Holder<StructWithAnyStrict>(); + StructWithAnyStrict ret; + if (testDocLiteral) { + ret = docClient.testStructWithAnyStrict(x, y, z); + } else if (testXMLBinding) { + ret = xmlClient.testStructWithAnyStrict(x, y, z); + } else { + ret = rpcClient.testStructWithAnyStrict(x, y, z); + } + + if (!perfTestOnly) { + assertEqualsStructWithAnyStrict(x, y.value); + assertEqualsStructWithAnyStrict(yOrig, z.value); + assertEqualsStructWithAnyStrict(x, ret); + } + } + + @Test + public void testStructWithAnyArrayLax() throws Exception { + if (!shouldRunTest("StructWithAnyArrayLax")) { + return; + } + SOAPFactory factory = SOAPFactory.newInstance(); + SOAPElement elem = factory.createElement("StringElementQualified", + "x1", "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + elem.addTextNode("This is the text of the node"); + + StructWithAnyArrayLax x = new StructWithAnyArrayLax(); + x.setName("Name x"); + x.setAddress("Some Address x"); + x.getAny().add(elem); + + elem = factory.createElement("StringElementQualified", "x1", + "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + elem.addTextNode("This is the text of the node for the second struct"); + + StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax(); + yOrig.setName("Name y"); + yOrig.setAddress("Some Other Address y"); + yOrig.getAny().add(elem); + + Holder<StructWithAnyArrayLax> y = new Holder<StructWithAnyArrayLax>(yOrig); + Holder<StructWithAnyArrayLax> z = new Holder<StructWithAnyArrayLax>(); + StructWithAnyArrayLax ret; + if (testDocLiteral) { + ret = docClient.testStructWithAnyArrayLax(x, y, z); + } else if (testXMLBinding) { + ret = xmlClient.testStructWithAnyArrayLax(x, y, z); + } else { + ret = rpcClient.testStructWithAnyArrayLax(x, y, z); + } + if (!perfTestOnly) { + assertEqualsStructWithAnyArrayLax(x, y.value); + assertEqualsStructWithAnyArrayLax(yOrig, z.value); + assertEqualsStructWithAnyArrayLax(x, ret); + } + } + @Test + public void testStructWithAnyStrictComplex() throws Exception { + if (!shouldRunTest("StructWithAnyStrictComplex")) { + return; + } + SOAPFactory factory = SOAPFactory.newInstance(); + SOAPElement elem = factory.createElement("AnonTypeElementQualified", + "x1", "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + SOAPElement floatElem = factory.createElement("varFloat", "x1", + "http://apache.org/type_test/types1"); + floatElem.addTextNode("12.5"); + elem.addChildElement(floatElem); + SOAPElement intElem = factory.createElement("varInt", "x1", + "http://apache.org/type_test/types1"); + intElem.addTextNode("34"); + elem.addChildElement(intElem); + SOAPElement stringElem = factory.createElement("varString", "x1", + "http://apache.org/type_test/types1"); + stringElem.addTextNode("test string within any"); + elem.addChildElement(stringElem); + + StructWithAnyStrict x = new StructWithAnyStrict(); + x.setName("Name x"); + x.setAddress("Some Address x"); + x.setAny(elem); + + elem = factory.createElement("AnonTypeElementQualified", "x1", + "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + floatElem = factory.createElement("varFloat", "x1", + "http://apache.org/type_test/types1"); + floatElem.addTextNode("12.76"); + elem.addChildElement(floatElem); + intElem = factory.createElement("varInt", "x1", + "http://apache.org/type_test/types1"); + intElem.addTextNode("56"); + elem.addChildElement(intElem); + stringElem = factory.createElement("varString", "x1", + "http://apache.org/type_test/types1"); + stringElem.addTextNode("test string"); + elem.addChildElement(stringElem); + + StructWithAnyStrict yOrig = new StructWithAnyStrict(); + yOrig.setName("Name y"); + yOrig.setAddress("Some Address y"); + yOrig.setAny(elem); + + Holder<StructWithAnyStrict> y = new Holder<StructWithAnyStrict>(yOrig); + Holder<StructWithAnyStrict> z = new Holder<StructWithAnyStrict>(); + StructWithAnyStrict ret; + if (testDocLiteral) { + ret = docClient.testStructWithAnyStrict(x, y, z); + } else if (testXMLBinding) { + ret = xmlClient.testStructWithAnyStrict(x, y, z); + } else { + ret = rpcClient.testStructWithAnyStrict(x, y, z); + } + if (!perfTestOnly) { + assertEqualsStructWithAnyStrict(x, y.value); + assertEqualsStructWithAnyStrict(yOrig, z.value); + assertEqualsStructWithAnyStrict(x, ret); + } + } + + + @Test + public void testStructWithAnyArrayLaxComplex() throws Exception { + if (!shouldRunTest("StructWithAnyArrayLaxComplex")) { + return; + } + SOAPFactory factory = SOAPFactory.newInstance(); + SOAPElement elem = factory.createElement("AnonTypeElementQualified", "x1", + "http://apache.org/type_test/types1"); + elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); + SOAPElement floatElem = factory.createElement("varFloat", "x1", + "http://apache.org/type_test/types1"); + floatElem.addTextNode("12.76"); + elem.addChildElement(floatElem); + SOAPElement intElem = factory.createElement("varInt", "x1", + "http://apache.org/type_test/types1"); + intElem.addTextNode("56"); + elem.addChildElement(intElem); + SOAPElement stringElem = factory.createElement("varString", "x1", + "http://apache.org/type_test/types1"); + stringElem.addTextNode("test string"); + elem.addChildElement(stringElem); + + StructWithAnyArrayLax x = new StructWithAnyArrayLax(); + x.setName("Name x"); + x.setAddress("Some Address x"); + x.getAny().add(elem); + StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax(); + yOrig.setName("Name y"); + yOrig.setAddress("Some Other Address y"); + yOrig.getAny().add(elem); + + Holder<StructWithAnyArrayLax> y = new Holder<StructWithAnyArrayLax>(yOrig); + Holder<StructWithAnyArrayLax> z = new Holder<StructWithAnyArrayLax>(); + StructWithAnyArrayLax ret; + if (testDocLiteral) { + ret = docClient.testStructWithAnyArrayLax(x, y, z); + } else if (testXMLBinding) { + ret = xmlClient.testStructWithAnyArrayLax(x, y, z); + } else { + ret = rpcClient.testStructWithAnyArrayLax(x, y, z); + } + if (!perfTestOnly) { + assertEqualsStructWithAnyArrayLax(x, y.value); + assertEqualsStructWithAnyArrayLax(yOrig, z.value); + assertEqualsStructWithAnyArrayLax(x, ret); + } + } } http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java index e202d44..2be271b 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java @@ -145,7 +145,11 @@ public class CORBADocLitClientTypeTest extends AbstractTypeTestClient5 { "StringList", "StructWithAny", "StructWithAnyArray", + "StructWithAnyArrayLax", + "StructWithAnyArrayLaxComplex", "StructWithAnyAttribute", + "StructWithAnyStrict", + "StructWithAnyStrictComplex", "StructWithAnyXsi", "StructWithInvalidAny", "StructWithInvalidAnyArray", http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java index 749442a..8edcf87 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java @@ -19,18 +19,13 @@ package org.apache.cxf.systest.type_test.soap; import java.util.Arrays; -import java.util.List; import javax.xml.namespace.QName; -import javax.xml.soap.SOAPElement; -import javax.xml.soap.SOAPFactory; import javax.xml.ws.Holder; import javax.xml.ws.soap.SOAPFaultException; import org.apache.cxf.systest.type_test.AbstractTypeTestClient5; import org.apache.type_test.types1.FixedArray; -import org.apache.type_test.types2.StructWithAnyArrayLax; -import org.apache.type_test.types2.StructWithAnyStrict; import org.junit.Before; import org.junit.BeforeClass; @@ -73,187 +68,8 @@ public class SOAPDocLitClientTypeTest extends AbstractTypeTestClient5 { } } - @Test - public void testStructWithAnyStrict() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("StringElementQualified", - "x1", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the node"); - - StructWithAnyStrict x = new StructWithAnyStrict(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.setAny(elem); - - elem = factory.createElement("StringElementQualified", - "x1", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the second node"); - - StructWithAnyStrict yOrig = new StructWithAnyStrict(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Address y"); - yOrig.setAny(elem); - - Holder<StructWithAnyStrict> y = new Holder<StructWithAnyStrict>(yOrig); - Holder<StructWithAnyStrict> z = new Holder<StructWithAnyStrict>(); - StructWithAnyStrict ret = docClient.testStructWithAnyStrict(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyStrict(x, y.value); - assertEqualsStructWithAnyStrict(yOrig, z.value); - assertEqualsStructWithAnyStrict(x, ret); - } - } - - @Test - public void testStructWithAnyStrictComplex() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("AnonTypeElementQualified", - "x1", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - SOAPElement floatElem = factory.createElement("varFloat", "x1", - "http://apache.org/type_test/types1"); - floatElem.addTextNode("12.5"); - elem.addChildElement(floatElem); - SOAPElement intElem = factory.createElement("varInt", "x1", - "http://apache.org/type_test/types1"); - intElem.addTextNode("34"); - elem.addChildElement(intElem); - SOAPElement stringElem = factory.createElement("varString", "x1", - "http://apache.org/type_test/types1"); - stringElem.addTextNode("test string within any"); - elem.addChildElement(stringElem); - - StructWithAnyStrict x = new StructWithAnyStrict(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.setAny(elem); - - elem = factory.createElement("AnonTypeElementQualified", "x1", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - floatElem = factory.createElement("varFloat", "x1", - "http://apache.org/type_test/types1"); - floatElem.addTextNode("12.76"); - elem.addChildElement(floatElem); - intElem = factory.createElement("varInt", "x1", - "http://apache.org/type_test/types1"); - intElem.addTextNode("56"); - elem.addChildElement(intElem); - stringElem = factory.createElement("varString", "x1", - "http://apache.org/type_test/types1"); - stringElem.addTextNode("test string"); - elem.addChildElement(stringElem); - - StructWithAnyStrict yOrig = new StructWithAnyStrict(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Address y"); - yOrig.setAny(elem); - - Holder<StructWithAnyStrict> y = new Holder<StructWithAnyStrict>(yOrig); - Holder<StructWithAnyStrict> z = new Holder<StructWithAnyStrict>(); - StructWithAnyStrict ret = docClient.testStructWithAnyStrict(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyStrict(x, y.value); - assertEqualsStructWithAnyStrict(yOrig, z.value); - assertEqualsStructWithAnyStrict(x, ret); - } - } - - @Test - public void testStructWithAnyArrayLax() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("StringElementQualified", - "x1", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the node"); - StructWithAnyArrayLax x = new StructWithAnyArrayLax(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.getAny().add(elem); - elem = factory.createElement("StringElementQualified", "x1", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the node for the second struct"); - StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Other Address y"); - yOrig.getAny().add(elem); - - Holder<StructWithAnyArrayLax> y = new Holder<StructWithAnyArrayLax>(yOrig); - Holder<StructWithAnyArrayLax> z = new Holder<StructWithAnyArrayLax>(); - StructWithAnyArrayLax ret = docClient.testStructWithAnyArrayLax(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyArrayLax(x, y.value); - assertEqualsStructWithAnyArrayLax(yOrig, z.value); - assertEqualsStructWithAnyArrayLax(x, ret); - } - } - - @Test - public void testStructWithAnyArrayLaxComplex() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("AnonTypeElementQualified", "x1", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1"); - SOAPElement floatElem = factory.createElement("varFloat", "x1", - "http://apache.org/type_test/types1"); - floatElem.addTextNode("12.76"); - elem.addChildElement(floatElem); - SOAPElement intElem = factory.createElement("varInt", "x1", - "http://apache.org/type_test/types1"); - intElem.addTextNode("56"); - elem.addChildElement(intElem); - SOAPElement stringElem = factory.createElement("varString", "x1", - "http://apache.org/type_test/types1"); - stringElem.addTextNode("test string"); - elem.addChildElement(stringElem); - - StructWithAnyArrayLax x = new StructWithAnyArrayLax(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.getAny().add(elem); - StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Other Address y"); - yOrig.getAny().add(elem); - - Holder<StructWithAnyArrayLax> y = new Holder<StructWithAnyArrayLax>(yOrig); - Holder<StructWithAnyArrayLax> z = new Holder<StructWithAnyArrayLax>(); - StructWithAnyArrayLax ret = docClient.testStructWithAnyArrayLax(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyArrayLax(x, y.value); - assertEqualsStructWithAnyArrayLax(yOrig, z.value); - assertEqualsStructWithAnyArrayLax(x, ret); - } - } - - public void assertEqualsStructWithAnyStrict(StructWithAnyStrict a, - StructWithAnyStrict b) throws Exception { - assertEquals("StructWithAnyStrict names don't match", a.getName(), b.getName()); - assertEquals("StructWithAnyStrict addresses don't match", a.getAddress(), b.getAddress()); - if (a.getAny() instanceof SOAPElement && b.getAny() instanceof SOAPElement) { - assertEquals((SOAPElement)a.getAny(), (SOAPElement)b.getAny()); - } - } - - public void assertEqualsStructWithAnyArrayLax(StructWithAnyArrayLax a, - StructWithAnyArrayLax b) throws Exception { - assertEquals("StructWithAnyArrayLax names don't match", a.getName(), b.getName()); - assertEquals("StructWithAnyArrayLax addresses don't match", a.getAddress(), b.getAddress()); - - List<Object> ae = a.getAny(); - List<Object> be = b.getAny(); - assertEquals("StructWithAnyArrayLax soap element lengths don't match", ae.size(), be.size()); - for (int i = 0; i < ae.size(); i++) { - if (ae.get(i) instanceof SOAPElement && be.get(i) instanceof SOAPElement) { - assertEquals(ae.get(i), be.get(i)); - } - } - } } http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPRpcLitClientTypeTest.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPRpcLitClientTypeTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPRpcLitClientTypeTest.java index 6afa27d..e526eba 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPRpcLitClientTypeTest.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPRpcLitClientTypeTest.java @@ -18,20 +18,12 @@ */ package org.apache.cxf.systest.type_test.soap; -import java.util.List; - import javax.xml.namespace.QName; -import javax.xml.soap.SOAPElement; -import javax.xml.soap.SOAPFactory; -import javax.xml.ws.Holder; import org.apache.cxf.systest.type_test.AbstractTypeTestClient5; -import org.apache.type_test.types2.StructWithAnyArrayLax; -import org.apache.type_test.types2.StructWithAnyStrict; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Test; public class SOAPRpcLitClientTypeTest extends AbstractTypeTestClient5 { protected static final String WSDL_PATH = "/wsdl/type_test/type_test_rpclit_soap.wsdl"; @@ -53,178 +45,4 @@ public class SOAPRpcLitClientTypeTest extends AbstractTypeTestClient5 { initClient(AbstractTypeTestClient5.class, SERVICE_NAME, PORT_NAME, WSDL_PATH); } - @Test - public void testStructWithAnyStrict() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("StringElementQualified", "tns", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the node"); - - StructWithAnyStrict x = new StructWithAnyStrict(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.setAny(elem); - - elem = factory.createElement("StringElementQualified", "tns", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the second node"); - - StructWithAnyStrict yOrig = new StructWithAnyStrict(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Address y"); - yOrig.setAny(elem); - - Holder<StructWithAnyStrict> y = new Holder<StructWithAnyStrict>(yOrig); - Holder<StructWithAnyStrict> z = new Holder<StructWithAnyStrict>(); - StructWithAnyStrict ret = rpcClient.testStructWithAnyStrict(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyStrict(x, y.value); - assertEqualsStructWithAnyStrict(yOrig, z.value); - assertEqualsStructWithAnyStrict(x, ret); - } - } - - @Test - public void testStructWithAnyStrictComplex() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("AnonTypeElementQualified", "tns", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - SOAPElement floatElem = factory - .createElement("varFloat", "tns", "http://apache.org/type_test/types1"); - floatElem.addTextNode("12.5"); - elem.addChildElement(floatElem); - SOAPElement intElem = factory.createElement("varInt", "tns", "http://apache.org/type_test/types1"); - intElem.addTextNode("34"); - elem.addChildElement(intElem); - SOAPElement stringElem = factory.createElement("varString", "tns", - "http://apache.org/type_test/types1"); - stringElem.addTextNode("test string within any"); - elem.addChildElement(stringElem); - - StructWithAnyStrict x = new StructWithAnyStrict(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.setAny(elem); - - elem = factory.createElement("AnonTypeElementQualified", "tns", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - floatElem = factory.createElement("varFloat", "tns", "http://apache.org/type_test/types1"); - floatElem.addTextNode("12.76"); - elem.addChildElement(floatElem); - intElem = factory.createElement("varInt", "tns", "http://apache.org/type_test/types1"); - intElem.addTextNode("56"); - elem.addChildElement(intElem); - stringElem = factory.createElement("varString", "tns", "http://apache.org/type_test/types1"); - stringElem.addTextNode("test string"); - elem.addChildElement(stringElem); - - StructWithAnyStrict yOrig = new StructWithAnyStrict(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Address y"); - yOrig.setAny(elem); - - Holder<StructWithAnyStrict> y = new Holder<StructWithAnyStrict>(yOrig); - Holder<StructWithAnyStrict> z = new Holder<StructWithAnyStrict>(); - StructWithAnyStrict ret = rpcClient.testStructWithAnyStrict(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyStrict(x, y.value); - assertEqualsStructWithAnyStrict(yOrig, z.value); - assertEqualsStructWithAnyStrict(x, ret); - } - } - - @Test - public void testStructWithAnyArrayLax() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("StringElementQualified", "tns", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the node"); - - StructWithAnyArrayLax x = new StructWithAnyArrayLax(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.getAny().add(elem); - - elem = factory.createElement("StringElementQualified", "tns", "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - elem.addTextNode("This is the text of the node for the second struct"); - - StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Other Address y"); - yOrig.getAny().add(elem); - - Holder<StructWithAnyArrayLax> y = new Holder<StructWithAnyArrayLax>(yOrig); - Holder<StructWithAnyArrayLax> z = new Holder<StructWithAnyArrayLax>(); - StructWithAnyArrayLax ret = rpcClient.testStructWithAnyArrayLax(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyArrayLax(x, y.value); - assertEqualsStructWithAnyArrayLax(yOrig, z.value); - assertEqualsStructWithAnyArrayLax(x, ret); - } - } - - @Test - public void testStructWithAnyArrayLaxComplex() throws Exception { - SOAPFactory factory = SOAPFactory.newInstance(); - SOAPElement elem = factory.createElement("AnonTypeElementQualified", "tns", - "http://apache.org/type_test/types1"); - elem.addNamespaceDeclaration("tns", "http://apache.org/type_test/types1"); - SOAPElement floatElem = factory - .createElement("varFloat", "tns", "http://apache.org/type_test/types1"); - floatElem.addTextNode("12.76"); - elem.addChildElement(floatElem); - SOAPElement intElem = factory.createElement("varInt", "tns", "http://apache.org/type_test/types1"); - intElem.addTextNode("56"); - elem.addChildElement(intElem); - SOAPElement stringElem = factory.createElement("varString", "tns", - "http://apache.org/type_test/types1"); - stringElem.addTextNode("test string"); - elem.addChildElement(stringElem); - - StructWithAnyArrayLax x = new StructWithAnyArrayLax(); - x.setName("Name x"); - x.setAddress("Some Address x"); - x.getAny().add(elem); - StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax(); - yOrig.setName("Name y"); - yOrig.setAddress("Some Other Address y"); - yOrig.getAny().add(elem); - - Holder<StructWithAnyArrayLax> y = new Holder<StructWithAnyArrayLax>(yOrig); - Holder<StructWithAnyArrayLax> z = new Holder<StructWithAnyArrayLax>(); - StructWithAnyArrayLax ret = rpcClient.testStructWithAnyArrayLax(x, y, z); - if (!perfTestOnly) { - assertEqualsStructWithAnyArrayLax(x, y.value); - assertEqualsStructWithAnyArrayLax(yOrig, z.value); - assertEqualsStructWithAnyArrayLax(x, ret); - } - } - - public void assertEqualsStructWithAnyStrict(StructWithAnyStrict a, StructWithAnyStrict b) - throws Exception { - assertEquals("StructWithAnyStrict names don't match", a.getName(), b.getName()); - assertEquals("StructWithAnyStrict addresses don't match", a.getAddress(), b.getAddress()); - if (a.getAny() instanceof SOAPElement && b.getAny() instanceof SOAPElement) { - assertEquals((SOAPElement) a.getAny(), (SOAPElement) b.getAny()); - } - } - - public void assertEqualsStructWithAnyArrayLax(StructWithAnyArrayLax a, StructWithAnyArrayLax b) - throws Exception { - assertEquals("StructWithAnyArrayLax names don't match", a.getName(), b.getName()); - assertEquals("StructWithAnyArrayLax addresses don't match", a.getAddress(), b.getAddress()); - - List<Object> ae = a.getAny(); - List<Object> be = b.getAny(); - assertEquals("StructWithAnyArrayLax soap element lengths don't match", ae.size(), be.size()); - for (int i = 0; i < ae.size(); i++) { - if (ae.get(i) instanceof SOAPElement && be.get(i) instanceof SOAPElement) { - assertEquals(ae.get(i), be.get(i)); - } - } - } } http://git-wip-us.apache.org/repos/asf/cxf/blob/1876a1fd/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java ---------------------------------------------------------------------- diff --git a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java index 364ed8f..2313de9 100644 --- a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java +++ b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java @@ -101,12 +101,10 @@ public final class ValidatorUtil { schemaCol.read(schemaEl, tns); } catch (RuntimeException ex) { LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", tns); - // // Couldn't find schema... check if it's relative to wsdl. - // XXX - Using setBaseUri() on the XmlSchemaCollection, + // Using setBaseUri() on the XmlSchemaCollection, // only seems to work for the first imported xsd... so pass // in the baseURI here. - // try { schemaCol.read(schemaEl, baseURI); } catch (RuntimeException ex2) {
