Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 3774 invoked from network); 19 Feb 2009 14:20:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2009 14:20:03 -0000 Received: (qmail 42210 invoked by uid 500); 19 Feb 2009 14:20:03 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 42163 invoked by uid 500); 19 Feb 2009 14:20:03 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 42154 invoked by uid 99); 19 Feb 2009 14:20:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Feb 2009 06:20:03 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Feb 2009 14:19:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 92ED92388B37; Thu, 19 Feb 2009 14:19:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r745879 [3/4] - in /cxf/branches/2.1.x-fixes: ./ api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/wsdl/ api/src/test/java/org/apache/cxf/ common/common/src/main/java/org/apac... Date: Thu, 19 Feb 2009 14:19:11 -0000 To: commits@cxf.apache.org From: bimargulies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090219141933.92ED92388B37@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java Thu Feb 19 14:18:49 2009 @@ -20,7 +20,9 @@ import javax.xml.namespace.QName; +import org.w3c.dom.Document; import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import org.apache.cxf.aegis.AbstractAegisTest; import org.apache.cxf.aegis.services.ArrayService; @@ -39,11 +41,12 @@ @Before public void setUp() throws Exception { super.setUp(); + setEnableJDOM(true); arrayService = new ArrayService(); createService(BeanService.class, "BeanService"); createService(ArrayService.class, arrayService, "Array", new QName("urn:Array", "Array")); } - + @Test public void testBeanService() throws Exception { Node response = invoke("BeanService", "bean11.xml"); @@ -55,6 +58,13 @@ assertValid("//sb:getSimpleBeanResponse/sb:return/beanz:howdy[text()=\"howdy\"]", response); assertValid("//sb:getSimpleBeanResponse/sb:return/beanz:bleh[text()=\"bleh\"]", response); } + + @Test + public void testArrayWsdl() throws Exception { + Document doc = getWSDLDocument("Array"); + NodeList stuff = assertValid("//xsd:complexType[@name='ArrayOfString-2-50']", doc); + assertEquals(1, stuff.getLength()); + } @Test public void testBeanServiceWSDL() throws Exception { @@ -97,7 +107,8 @@ + "[@type=\"xsd:string\"]", doc); } - + + @org.junit.Ignore // uses Jaxen. @Test public void testSubmitJDOMArray() throws Exception { @@ -133,66 +144,4 @@ assertEquals("after items", arrayService.getAfterValue()); } - // public void testGetArray() - // throws Exception - // { - // Document response = invokeService("Array", - // "/org/codehaus/xfire/message/wrapped/GetStringArray11.xml"); - // - // addNamespace("a", "urn:Array"); - // addNamespace("sb", "http://test.java.xfire.codehaus.org"); - // assertValid("//a:getStringArrayResponse", response); - // assertValid("//a:getStringArrayResponse/a:out/a:string", response); - // } - // - // public void testArrayService() - // throws Exception - // { - // Document response = invokeService("Array", - // "/org/codehaus/xfire/message/wrapped/SubmitStringArray11.xml"); - // - // addNamespace("a", "urn:Array"); - // addNamespace("sb", "http://test.java.xfire.codehaus.org"); - // assertValid("//a:SubmitStringArrayResponse", response); - // assertValid("//a:SubmitStringArrayResponse/a:out[text()='true']", - // response); - // } - // - // public void testArrayServiceNoWhitespace() - // throws Exception - // { - // Document response = invokeService("Array", - // "/org/codehaus/xfire/message/wrapped/SubmitStringArray11NoWS.xml"); - // - // addNamespace("a", "urn:Array"); - // addNamespace("sb", "http://test.java.xfire.codehaus.org"); - // assertValid("//a:SubmitStringArrayResponse", response); - // assertValid("//a:SubmitStringArrayResponse/a:out[text()='true']", - // response); - // } - // - // public void testArrayServiceWSDL() - // throws Exception - // { - // Document doc = getWSDLDocument("Array"); - // - // addNamespace("wsdl", WSDLWriter.WSDL11_NS); - // addNamespace("wsdlsoap", WSDLWriter.WSDL11_SOAP_NS); - // addNamespace("xsd", SoapConstants.XSD); - // - // assertValid("/wsdl:definitions/wsdl:types", doc); - // assertValid("/wsdl:definitions/wsdl:types/xsd:schema", doc); - // assertValid("/wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:Array']", - // doc); - // assertValid("//xsd:schema[@targetNamespace='urn:Array']/xsd:element[@name='SubmitBeanArray']", - // doc); - // assertValid( - // "//xsd:element[@name='SubmitStringArray']/xsd:complexType/xsd:sequence/xsd:element" - // + "[@name='array'][@type='tns:ArrayOfString']", - // doc); - // assertValid( - // "//xsd:element[@name='SubmitBeanArray']/xsd:complexType/xsd:sequence/xsd:element" - // + "[@name='array'][@type='ns1:ArrayOfSimpleBean']", - // doc); - // } } Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml Thu Feb 19 14:18:49 2009 @@ -20,7 +20,7 @@ - + Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java Thu Feb 19 14:18:49 2009 @@ -24,9 +24,10 @@ import java.util.Date; import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamReader; -import org.w3c.dom.Attr; -import org.w3c.dom.NodeList; +import org.w3c.dom.Document; +import org.w3c.dom.Element; import org.apache.cxf.aegis.AbstractAegisTest; import org.apache.cxf.aegis.AegisContext; @@ -35,14 +36,18 @@ import org.apache.cxf.aegis.type.Type; import org.apache.cxf.aegis.type.TypeCreationOptions; import org.apache.cxf.aegis.type.TypeMapping; -import org.apache.cxf.aegis.util.jdom.StaxBuilder; -import org.apache.cxf.aegis.xml.jdom.JDOMReader; -import org.apache.cxf.aegis.xml.jdom.JDOMWriter; import org.apache.cxf.aegis.xml.stax.ElementReader; import org.apache.cxf.aegis.xml.stax.ElementWriter; import org.apache.cxf.common.util.SOAPConstants; -import org.jdom.Document; -import org.jdom.Element; +import org.apache.cxf.common.xmlschema.XmlSchemaConstants; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.staxutils.StaxUtils; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaAttribute; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaObject; +import org.apache.ws.commons.schema.XmlSchemaSequence; import org.junit.Test; public class BeanTest extends AbstractAegisTest { @@ -95,14 +100,12 @@ bean.setBleh("bleh"); // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); + Element element = writeObjectToElement(type, bean, getContext()); assertValid("/b:root/b:bleh[text()='bleh']", element); assertValid("/b:root/b:howdy[text()='howdy']", element); } - + @Test public void testBeanWithXsiType() throws Exception { BeanType type = new BeanType(); @@ -121,10 +124,7 @@ reader.getXMLStreamReader().close(); - // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); + Element element = writeObjectToElement(type, bean, getContext()); assertValid("/b:root/b:bleh[text()='bleh']", element); assertValid("/b:root/b:howdy[text()='howdy']", element); @@ -154,15 +154,12 @@ reader.getXMLStreamReader().close(); - // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); + Element element = writeObjectToElement(type, bean, getContext()); assertInvalid("/b:root/b:bleh", element); assertValid("/b:root/b:howdycustom[text()='howdy']", element); } - + @Test public void testAttributeMap() throws Exception { BeanTypeInfo info = new BeanTypeInfo(SimpleBean.class, "urn:Bean"); @@ -184,23 +181,30 @@ reader.getXMLStreamReader().close(); // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); - + Element element = writeObjectToElement(type, bean, getContext()); assertValid("/b:root[@b:bleh='bleh']", element); assertValid("/b:root[@b:howdy='howdy']", element); - - Element types = new Element("types", "xsd", SOAPConstants.XSD); - Element schema = new Element("schema", "xsd", SOAPConstants.XSD); - types.addContent(schema); - - new Document(types); - + + XmlSchema schema = newXmlSchema("urn:Bean"); type.writeSchema(schema); - - assertValid("//xsd:complexType[@name='bean']/xsd:attribute[@name='howdy']", schema); - assertValid("//xsd:complexType[@name='bean']/xsd:attribute[@name='bleh']", schema); + + XmlSchemaComplexType stype = (XmlSchemaComplexType)schema.getTypeByName("bean"); + boolean howdy = false; + boolean bleh = false; + for (int x = 0; x < stype.getAttributes().getCount(); x++) { + XmlSchemaObject o = stype.getAttributes().getItem(x); + if (o instanceof XmlSchemaAttribute) { + XmlSchemaAttribute a = (XmlSchemaAttribute)o; + if ("howdy".equals(a.getName())) { + howdy = true; + } + if ("bleh".equals(a.getName())) { + bleh = true; + } + } + } + assertTrue(howdy); + assertTrue(bleh); } @Test @@ -233,9 +237,8 @@ bos.close(); - StaxBuilder builder = new StaxBuilder(); - Document doc = builder.build(new ByteArrayInputStream(bos.toByteArray())); - Element element = doc.getRootElement(); + Document doc = DOMUtils.readXml(new ByteArrayInputStream(bos.toByteArray())); + Element element = doc.getDocumentElement(); addNamespace("b2", "urn:Bean2"); assertValid("/b:root[@b2:bleh='bleh']", element); @@ -257,23 +260,42 @@ SimpleBean bean = new SimpleBean(); // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); + + Element element = writeObjectToElement(type, bean, getContext()); assertInvalid("/b:root[@b:howdy]", element); assertValid("/b:root/b:bleh[@xsi:nil='true']", element); - Element types = new Element("types", "xsd", SOAPConstants.XSD); - Element schema = new Element("schema", "xsd", SOAPConstants.XSD); - types.addContent(schema); - - new Document(types); - + XmlSchema schema = newXmlSchema("urn:Bean"); type.writeSchema(schema); + + XmlSchemaComplexType stype = (XmlSchemaComplexType)schema.getTypeByName("bean"); + XmlSchemaSequence seq = (XmlSchemaSequence) stype.getParticle(); + boolean howdy = false; + boolean bleh = false; + + for (int x = 0; x < seq.getItems().getCount(); x++) { + XmlSchemaObject o = seq.getItems().getItem(x); + if (o instanceof XmlSchemaElement) { + XmlSchemaElement a = (XmlSchemaElement)o; + if ("bleh".equals(a.getName())) { + bleh = true; + } + } + } + + for (int x = 0; x < stype.getAttributes().getCount(); x++) { + XmlSchemaObject o = stype.getAttributes().getItem(x); + if (o instanceof XmlSchemaAttribute) { + XmlSchemaAttribute a = (XmlSchemaAttribute)o; + if ("howdy".equals(a.getName())) { + howdy = true; + } + } + } - assertValid("//xsd:complexType[@name='bean']/xsd:attribute[@name='howdy']", schema); - assertValid("//xsd:complexType[@name='bean']/xsd:sequence/xsd:element[@name='bleh']", schema); + assertTrue(howdy); + assertTrue(bleh); } @Test @@ -286,22 +308,30 @@ type.setTypeMapping(mapping); type.setSchemaType(new QName("urn:Bean", "bean")); - Element types = new Element("types", "xsd", SOAPConstants.XSD); - Element schema = new Element("schema", "xsd", SOAPConstants.XSD); - types.addContent(schema); - - new Document(types); - + XmlSchema schema = newXmlSchema("urn:Bean"); type.writeSchema(schema); - - assertValid("//xsd:complexType[@name='bean']/xsd:sequence/xsd:element[@name='int1']" - + "[@nillable='true'][@minOccurs='0']", - schema); - assertValid("//xsd:complexType[@name='bean']/xsd:sequence/xsd:element[@name='int2'][@minOccurs='0']", - schema); - assertInvalid("//xsd:complexType[@name='bean']/xsd:sequence" - + "/xsd:element[@name='int2'][@nillable='true']", - schema); + + XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("bean"); + XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle(); + boolean int1ok = false; + boolean int2ok = false; + for (int x = 0; x < seq.getItems().getCount(); x++) { + XmlSchemaObject o = seq.getItems().getItem(x); + if (o instanceof XmlSchemaElement) { + XmlSchemaElement oe = (XmlSchemaElement) o; + if ("int1".equals(oe.getName())) { + int1ok = true; + assertTrue(oe.isNillable()); + assertEquals(0, oe.getMinOccurs()); + } else if ("int2".equals(oe.getName())) { + int2ok = true; + assertEquals(0, oe.getMinOccurs()); + assertFalse(oe.isNillable()); + } + } + } + assertTrue(int1ok); + assertTrue(int2ok); } @Test public void testNillableIntMinOccurs1() throws Exception { @@ -318,20 +348,24 @@ type.setTypeClass(IntBean.class); type.setTypeMapping(mapping); - Element types = new Element("types", "xsd", SOAPConstants.XSD); - Element schema = new Element("schema", "xsd", SOAPConstants.XSD); - types.addContent(schema); - - new Document(types); - + XmlSchema schema = newXmlSchema("urn:Bean"); type.writeSchema(schema); - - assertValid("//xsd:complexType[@name='IntBean']/xsd:sequence/xsd:element[@name='int1']", schema); - assertInvalid( - "//xsd:complexType[@name='IntBean']/xsd:sequence/xsd:element[@name='int1'][@minOccurs]", - schema); - assertInvalid("//xsd:complexType[@name='IntBean']/xsd:sequence/xsd:element[@name='int1'][@nillable]", - schema); + + XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("IntBean"); + XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle(); + boolean int1ok = false; + for (int x = 0; x < seq.getItems().getCount(); x++) { + XmlSchemaObject o = seq.getItems().getItem(x); + if (o instanceof XmlSchemaElement) { + XmlSchemaElement oe = (XmlSchemaElement) o; + if ("int1".equals(oe.getName())) { + int1ok = true; + assertFalse(oe.isNillable()); + assertEquals(1, oe.getMinOccurs()); + } + } + } + assertTrue(int1ok); } @Test @@ -343,25 +377,28 @@ BeanType type = (BeanType)mapping.getTypeCreator().createType(SimpleBean.class); type.setTypeClass(SimpleBean.class); type.setTypeMapping(mapping); - - Element types = new Element("types", "xsd", SOAPConstants.XSD); - Element schema = new Element("schema", "xsd", SOAPConstants.XSD); - types.addContent(schema); - - new Document(types); - + + XmlSchema schema = newXmlSchema("urn:Bean"); type.writeSchema(schema); - - NodeList typeAttrNode = - assertValid("//xsd:complexType[@name='SimpleBean']/xsd:sequence/xsd:element[@name='character']" - + "/@type", - schema); - assertEquals(1, typeAttrNode.getLength()); - Attr typeAttr = (Attr)typeAttrNode.item(0); - String typeQnameString = typeAttr.getValue(); - String[] pieces = typeQnameString.split(":"); - assertEquals(CharacterAsStringType.CHARACTER_AS_STRING_TYPE_QNAME.getLocalPart(), - pieces[1]); + + XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("SimpleBean"); + XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle(); + boolean charok = false; + + for (int x = 0; x < seq.getItems().getCount(); x++) { + XmlSchemaObject o = seq.getItems().getItem(x); + if (o instanceof XmlSchemaElement) { + XmlSchemaElement oe = (XmlSchemaElement) o; + if ("character".equals(oe.getName())) { + charok = true; + assertNotNull(oe.getSchemaTypeName()); + assertTrue(oe.isNillable()); + assertEquals(CharacterAsStringType.CHARACTER_AS_STRING_TYPE_QNAME, + oe.getSchemaTypeName()); + } + } + } + assertTrue(charok); } @Test @@ -374,42 +411,36 @@ type.setTypeClass(SimpleBean.class); type.setTypeMapping(mapping); - Element types = new Element("types", "xsd", SOAPConstants.XSD); - Element schema = new Element("schema", "xsd", SOAPConstants.XSD); - types.addContent(schema); - - new Document(types); - + XmlSchema schema = newXmlSchema("urn:Bean"); type.writeSchema(schema); - - NodeList typeAttrNode = - assertValid("//xsd:complexType[@name='SimpleBean']/xsd:sequence/xsd:element[@name='littleByte']" - + "/@type", - schema); - assertEquals(1, typeAttrNode.getLength()); - Attr typeAttr = (Attr)typeAttrNode.item(0); - String typeQnameString = typeAttr.getValue(); - String[] pieces = typeQnameString.split(":"); - assertEquals("xsd", pieces[0]); - assertEquals("byte", pieces[1]); - - typeAttrNode = - assertValid("//xsd:complexType[@name='SimpleBean']/xsd:sequence/xsd:element[@name='bigByte']" - + "/@type", - schema); - assertEquals(1, typeAttrNode.getLength()); - typeAttr = (Attr)typeAttrNode.item(0); - typeQnameString = typeAttr.getValue(); - pieces = typeQnameString.split(":"); - assertEquals("xsd", pieces[0]); - assertEquals("byte", pieces[1]); - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); + XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("SimpleBean"); + XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle(); + boolean littleByteOk = false; + boolean bigByteOk = false; + + for (int x = 0; x < seq.getItems().getCount(); x++) { + XmlSchemaObject o = seq.getItems().getItem(x); + if (o instanceof XmlSchemaElement) { + XmlSchemaElement oe = (XmlSchemaElement) o; + if ("littleByte".equals(oe.getName())) { + littleByteOk = true; + assertNotNull(oe.getSchemaTypeName()); + assertEquals(XmlSchemaConstants.BYTE_QNAME, oe.getSchemaTypeName()); + } else if ("bigByte".equals(oe.getName())) { + bigByteOk = true; + assertNotNull(oe.getSchemaTypeName()); + assertEquals(XmlSchemaConstants.BYTE_QNAME, oe.getSchemaTypeName()); + } + } + } + assertTrue(littleByteOk); + assertTrue(bigByteOk); + SimpleBean bean = new SimpleBean(); bean.setBigByte(new Byte((byte)0xfe)); bean.setLittleByte((byte)0xfd); - type.writeObject(bean, new JDOMWriter(element), getContext()); + Element element = writeObjectToElement(type, bean, getContext()); Byte bb = new Byte((byte)0xfe); String bbs = bb.toString(); assertValid("/b:root/bz:bigByte[text()='" + bbs + "']", element); @@ -437,9 +468,7 @@ DateBean bean = new DateBean(); // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); + Element element = writeObjectToElement(type, bean, getContext()); // Make sure the date doesn't have an element. Its non nillable so it // just @@ -463,10 +492,7 @@ ExtendedBean bean = new ExtendedBean(); bean.setHowdy("howdy"); - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); - + Element element = writeObjectToElement(type, bean, getContext()); assertValid("/b:root/b:howdy[text()='howdy']", element); } @Test @@ -488,9 +514,7 @@ ByteBean bean = new ByteBean(); // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - type.writeObject(bean, new JDOMWriter(element), getContext()); + Element element = writeObjectToElement(type, bean, getContext()); // Make sure the date doesn't have an element. Its non nillable so it // just @@ -499,7 +523,8 @@ addNamespace("xsi", SOAPConstants.XSI_NS); assertValid("/b:root/b:data[@xsi:nil='true']", element); - bean = (ByteBean)type.readObject(new JDOMReader(element), getContext()); + XMLStreamReader sreader = StaxUtils.createXMLStreamReader(element); + bean = (ByteBean)type.readObject(new ElementReader(sreader), getContext()); assertNotNull(bean); assertNull(bean.getData()); } @@ -510,21 +535,21 @@ type.setTypeMapping(mapping); type.setSchemaType(new QName("urn:foo", "BadBean")); - assertTrue(type.getTypeInfo().getElements().hasNext()); + assertTrue(type.getTypeInfo().getElements().iterator().hasNext()); type = new BeanType(); type.setTypeClass(BadBean.class); type.setTypeMapping(mapping); type.setSchemaType(new QName("urn:foo", "BadBean")); - assertFalse(type.getTypeInfo().getElements().hasNext()); + assertFalse(type.getTypeInfo().getElements().iterator().hasNext()); type = new BeanType(); type.setTypeClass(BadBean2.class); type.setTypeMapping(mapping); type.setSchemaType(new QName("urn:foo", "BadBean2")); - assertFalse(type.getTypeInfo().getElements().hasNext()); + assertFalse(type.getTypeInfo().getElements().iterator().hasNext()); } public static class DateBean { Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java Thu Feb 19 14:18:49 2009 @@ -20,6 +20,8 @@ import javax.xml.namespace.QName; +import org.w3c.dom.Element; + import org.apache.cxf.aegis.AbstractAegisTest; import org.apache.cxf.aegis.AegisContext; import org.apache.cxf.aegis.Context; @@ -28,10 +30,8 @@ import org.apache.cxf.aegis.type.Type; import org.apache.cxf.aegis.type.TypeCreationOptions; import org.apache.cxf.aegis.type.TypeMapping; -import org.apache.cxf.aegis.xml.jdom.JDOMWriter; import org.apache.cxf.common.util.SOAPConstants; -import org.jdom.Document; -import org.jdom.Element; + import org.junit.Test; public class QualificationTest extends AbstractAegisTest { @@ -55,10 +55,8 @@ type.setSchemaType(new QName("urn:Bean", "bean")); Context messageContext = new Context(context); - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); AttributeBean bean = new AttributeBean(); - type.writeObject(bean, new JDOMWriter(element), messageContext); + Element element = writeObjectToElement(type, bean, messageContext); assertValid("/b:root[@xyzzy:attrExplicitString]", element); assertXPathEquals("/b:root/@xyzzy:attrExplicitString", "attrExplicit", element); assertValid("/b:root[@attrPlainString]", element); @@ -79,10 +77,8 @@ type.setSchemaType(new QName("urn:Bean", "bean")); Context messageContext = new Context(context); - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); AttributeBean bean = new AttributeBean(); - type.writeObject(bean, new JDOMWriter(element), messageContext); + Element element = writeObjectToElement(type, bean, messageContext); assertValid("/b:root[@xyzzy:attrExplicitString]", element); assertXPathEquals("/b:root/@xyzzy:attrExplicitString", "attrExplicit", element); assertValid("/b:root[@pkg:attrPlainString]", element); @@ -98,10 +94,9 @@ type.setSchemaType(new QName("urn:Bean", "bean")); Context messageContext = new Context(context); - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); XmlMappedAttributeBean bean = new XmlMappedAttributeBean(); - type.writeObject(bean, new JDOMWriter(element), messageContext); + + Element element = writeObjectToElement(type, bean, messageContext); assertValid("/b:root[@attrXmlString]", element); assertXPathEquals("/b:root/@attrXmlString", "attrXml", element); } @@ -120,10 +115,9 @@ type.setSchemaType(new QName("urn:Bean", "bean")); Context messageContext = new Context(context); - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); XmlMappedAttributeBean bean = new XmlMappedAttributeBean(); - type.writeObject(bean, new JDOMWriter(element), messageContext); + + Element element = writeObjectToElement(type, bean, messageContext); assertValid("/b:root[@pkg:attrXmlString]", element); assertXPathEquals("/b:root/@pkg:attrXmlString", "attrXml", element); } Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/AbstractEncodedTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/AbstractEncodedTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/AbstractEncodedTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/AbstractEncodedTest.java Thu Feb 19 14:18:49 2009 @@ -19,10 +19,13 @@ package org.apache.cxf.aegis.type.encoded; import java.io.ByteArrayInputStream; +import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; import javax.xml.stream.XMLStreamException; +import org.w3c.dom.Element; + import org.apache.cxf.aegis.AbstractAegisTest; import org.apache.cxf.aegis.AegisContext; import org.apache.cxf.aegis.Context; @@ -32,15 +35,13 @@ import org.apache.cxf.aegis.type.TypeMapping; import org.apache.cxf.aegis.xml.MessageReader; import org.apache.cxf.aegis.xml.MessageWriter; -import org.apache.cxf.aegis.xml.jdom.JDOMWriter; import org.apache.cxf.aegis.xml.stax.ElementReader; +import org.apache.cxf.aegis.xml.stax.ElementWriter; import org.apache.cxf.binding.soap.Soap11; import org.apache.cxf.common.util.SOAPConstants; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.Namespace; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; +import org.apache.cxf.helpers.MapNamespaceContext; +import org.apache.cxf.helpers.XMLUtils; + import org.junit.Before; public abstract class AbstractEncodedTest extends AbstractAegisTest { @@ -58,7 +59,7 @@ AegisContext context = new AegisContext(); // create a different mapping than the context creates. - TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false); + TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false); mapping = new DefaultTypeMapping(SOAPConstants.XSD, baseMapping); mapping.setTypeCreator(context.createTypeCreator()); context.setTypeMapping(mapping); @@ -100,10 +101,14 @@ } public Object readRef(Element element) throws XMLStreamException { - XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); - String xml = xmlOutputter.outputString(element); - ElementReader root = new ElementReader(new ByteArrayInputStream(xml.getBytes())); - return readRef(root); + String xml = XMLUtils.toString(element); + ElementReader root; + try { + root = new ElementReader(new ByteArrayInputStream(xml.getBytes("utf-8"))); + return readRef(root); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } } public Object readRef(ElementReader root) throws XMLStreamException { @@ -135,12 +140,12 @@ assertNotNull("no type found for " + instance.getClass().getName()); // create the document - Element element = new Element("root", "b", "urn:Bean"); + Element element = createElement("urn:Bean", "root", "b"); + MapNamespaceContext namespaces = new MapNamespaceContext(); for (Map.Entry entry : getNamespaces().entrySet()) { - element.addNamespaceDeclaration(Namespace.getNamespace(entry.getKey(), entry.getValue())); + namespaces.addNamespace(entry.getKey(), entry.getValue()); } - new Document(element); - JDOMWriter rootWriter = new JDOMWriter(element); + ElementWriter rootWriter = getElementWriter(element, namespaces); Context context = getContext(); // get Type based on the object instance Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/ArrayTypeInfoTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/ArrayTypeInfoTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/ArrayTypeInfoTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/ArrayTypeInfoTest.java Thu Feb 19 14:18:49 2009 @@ -88,7 +88,7 @@ } public void assertEquals(ArrayTypeInfo expected, String actualString) throws Exception { - ArrayTypeInfo actual = new ArrayTypeInfo(actualString); + ArrayTypeInfo actual = new ArrayTypeInfo(getNamespaceContext(), actualString); // only compare local part because prefix is only resolved when using the MessageReader constructor assertEquals(expected.getRanks(), actual.getRanks()); @@ -128,7 +128,7 @@ public void assertInvalid(String actualString) { try { - new ArrayTypeInfo(actualString); + new ArrayTypeInfo(getNamespaceContext(), actualString); fail("Expected a DatabindingException from invalid arrayType " + actualString); } catch (Exception expected) { // expected Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/SoapArrayTypeTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/SoapArrayTypeTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/SoapArrayTypeTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/SoapArrayTypeTest.java Thu Feb 19 14:18:49 2009 @@ -125,12 +125,23 @@ assertArrayEquals(Arrays.asList(objects).toString(), new Object[]{42, new BigDecimal("42.42"), "Forty Two"}, objects); - + } + + @Test + public void testUrTypeArrayReadWriteRef1() throws Exception { + Object[] objects; // round trip tests objects = readWriteReadRef("arrayUrType1.xml", Object[].class); assertArrayEquals(new Object[]{42, new Float(42.42f), "Forty Two"}, objects); + } + + @Test + public void testUrTypeArrayReadWriteRef2() throws Exception { + Object[] objects; + // round trip tests objects = readWriteReadRef("arrayUrType2.xml", Object[].class); assertArrayEquals(new Object[]{42, new BigDecimal("42.42"), "Forty Two"}, objects); + } @Test Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java Thu Feb 19 14:18:49 2009 @@ -22,17 +22,16 @@ import java.util.TreeMap; import javax.xml.namespace.QName; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + import org.apache.cxf.aegis.AegisContext; import org.apache.cxf.aegis.Context; import org.apache.cxf.aegis.type.basic.BeanTypeInfo; -import org.apache.cxf.aegis.xml.jdom.JDOMWriter; import org.apache.cxf.aegis.xml.stax.ElementReader; -import org.apache.cxf.helpers.CastUtils; -import org.jdom.Attribute; -import org.jdom.Content; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.output.XMLOutputter; +import org.apache.cxf.helpers.DOMUtils; + import org.junit.Test; public class StructTypeTest extends AbstractEncodedTest { @@ -82,9 +81,7 @@ reader.getXMLStreamReader().close(); // Test writing - Element element = new Element("root", "b", "urn:Bean"); - new Document(element); - addressType.writeObject(address, new JDOMWriter(element), getLocalContext()); + Element element = writeObjectToElement(addressType, address, getLocalContext()); validateShippingAddress(element); } @@ -162,9 +159,9 @@ private void validatePurchaseOrder(Element element) throws Exception { Element poRefElement = null; Map blocks = new TreeMap(); - for (Content content : CastUtils.cast(element.getContent())) { - if (content instanceof Element) { - Element child = (Element) content; + for (Node n = element.getFirstChild(); n != null; n = n.getNextSibling()) { + if (n instanceof Element) { + Element child = (Element) n; if (poRefElement == null) { poRefElement = child; } else { @@ -176,11 +173,11 @@ Element po = getReferencedElement("poRef", poRefElement, blocks); - Element shippingRef = po.getChild("shipping"); + Element shippingRef = (Element)DOMUtils.getChild(po, "shipping"); Element shipping = getReferencedElement("shipping", shippingRef, blocks); validateShippingAddress(shipping); - Element billingRef = po.getChild("billing"); + Element billingRef = (Element)DOMUtils.getChild(po, "billing"); Element billing = getReferencedElement("billing", billingRef, blocks); validateBillingAddress(billing); } @@ -197,26 +194,22 @@ } private static void assertChildEquals(String expected, Element element, String childName) { - assertEquals(expected, element.getChild(childName).getText()); + assertEquals(expected, DOMUtils.getChild(element, childName).getTextContent()); } private String getId(String childName, Element child) { assertNotNull(childName + " is null", child); - Attribute idAttribute = child.getAttribute("id"); - XMLOutputter xmlOutputter = new XMLOutputter(); - assertNotNull(childName + " id is null \n" + xmlOutputter.outputString(child), idAttribute); + Attr idAttribute = child.getAttributeNode("id"); + assertNotNull(childName + " id is null \n", idAttribute); String id = idAttribute.getValue(); - assertNotNull(childName + " id is null \n" + xmlOutputter.outputString(child), id); + assertNotNull(childName + " id is null \n", id); return id; } private String getRef(String childName, Element child) { assertNotNull(childName + " is null", child); - Attribute hrefAttribute = child.getAttribute("href"); - XMLOutputter xmlOutputter = new XMLOutputter(); - assertNotNull(childName + " href is null \n" + xmlOutputter.outputString(child), hrefAttribute); - String href = hrefAttribute.getValue(); - assertNotNull(childName + " href is null \n" + xmlOutputter.outputString(child), href); - return href; + String hrefAttribute = child.getAttribute("href"); + assertNotSame("", childName + " href is null \n", hrefAttribute); + return hrefAttribute; } } Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeTest.java Thu Feb 19 14:18:49 2009 @@ -64,7 +64,7 @@ AnnotatedTypeInfo info = new AnnotatedTypeInfo(tm, AnnotatedBean1.class, "urn:foo", new TypeCreationOptions()); - Iterator elements = info.getElements(); + Iterator elements = info.getElements().iterator(); assertTrue(elements.hasNext()); QName element = (QName)elements.next(); assertTrue(elements.hasNext()); @@ -91,7 +91,7 @@ fail("Unexpected element name: " + element.getLocalPart()); } - Iterator atts = info.getAttributes(); + Iterator atts = info.getAttributes().iterator(); assertTrue(atts.hasNext()); atts.next(); assertFalse(atts.hasNext()); @@ -108,9 +108,9 @@ public void testAegisType() { BeanType type = (BeanType)tm.getTypeCreator().createType(AnnotatedBean3.class); - assertFalse(type.getTypeInfo().getAttributes().hasNext()); + assertEquals(0, type.getTypeInfo().getAttributes().size()); - Iterator itr = type.getTypeInfo().getElements(); + Iterator itr = type.getTypeInfo().getElements().iterator(); assertTrue(itr.hasNext()); QName q = (QName)itr.next(); assertEquals("attProp", q.getLocalPart()); @@ -128,7 +128,7 @@ public void testNillableAndMinOccurs() { BeanType type = (BeanType)tm.getTypeCreator().createType(AnnotatedBean4.class); AnnotatedTypeInfo info = (AnnotatedTypeInfo)type.getTypeInfo(); - Iterator elements = info.getElements(); + Iterator elements = info.getElements().iterator(); assertTrue(elements.hasNext()); // nillable first QName element = (QName)elements.next(); @@ -181,7 +181,7 @@ new TypeCreationOptions())); type.setSchemaType(new QName("urn:foo", "BadBean")); - assertFalse(type.getTypeInfo().getElements().hasNext()); + assertFalse(type.getTypeInfo().getElements().iterator().hasNext()); } public static class BadBean { Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java Thu Feb 19 14:18:49 2009 @@ -19,19 +19,22 @@ package org.apache.cxf.aegis.type.java5; import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamReader; import org.w3c.dom.Document; +import org.w3c.dom.Element; import org.apache.cxf.aegis.AbstractAegisTest; import org.apache.cxf.aegis.type.DefaultTypeMapping; import org.apache.cxf.aegis.type.Type; import org.apache.cxf.aegis.type.TypeCreationOptions; import org.apache.cxf.aegis.type.java5.CurrencyService.Currency; -import org.apache.cxf.aegis.xml.jdom.JDOMReader; -import org.apache.cxf.aegis.xml.jdom.JDOMWriter; +import org.apache.cxf.aegis.xml.stax.ElementReader; import org.apache.cxf.common.util.SOAPConstants; -import org.jdom.Element; -import org.jdom.output.DOMOutputter; +import org.apache.cxf.staxutils.StaxUtils; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaSerializer; + import org.junit.Before; import org.junit.Test; @@ -66,14 +69,12 @@ tm.register(type); - Element root = new Element("root"); - JDOMWriter writer = new JDOMWriter(root); - - type.writeObject(smallEnum.VALUE1, writer, getContext()); + Element element = writeObjectToElement(type, smallEnum.VALUE1, getContext()); - assertEquals("VALUE1", root.getValue()); - - JDOMReader reader = new JDOMReader(root); + assertEquals("VALUE1", element.getTextContent()); + + XMLStreamReader xreader = StaxUtils.createXMLStreamReader(element); + ElementReader reader = new ElementReader(xreader); Object value = type.readObject(reader, getContext()); assertEquals(smallEnum.VALUE1, value); @@ -118,12 +119,11 @@ EnumType type = new EnumType(); type.setTypeClass(smallEnum.class); type.setSchemaType(new QName("urn:test", "test")); + XmlSchema schema = newXmlSchema("urn:test"); + type.writeSchema(schema); - Element root = new Element("root"); - org.jdom.Document wsdl = new org.jdom.Document(root); - type.writeSchema(root); - - Document doc = new DOMOutputter().output(wsdl); + XmlSchemaSerializer ser = new XmlSchemaSerializer(); + Document doc = ser.serializeSchema(schema, false)[0]; addNamespace("xsd", SOAPConstants.XSD); assertValid("//xsd:simpleType[@name='test']/xsd:restriction[@base='xsd:string']", doc); assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='VALUE1']", doc); @@ -149,12 +149,8 @@ tm.register(type); - Element root = new Element("root"); - JDOMWriter writer = new JDOMWriter(root); - - type.writeObject(new EnumBean(), writer, getContext()); - - JDOMReader reader = new JDOMReader(root); + Element root = writeObjectToElement(type, new EnumBean(), getContext()); + ElementReader reader = new ElementReader(StaxUtils.createXMLStreamReader(root)); Object value = type.readObject(reader, getContext()); assertTrue(value instanceof EnumBean); Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java Thu Feb 19 14:18:49 2009 @@ -64,7 +64,7 @@ AnnotatedTypeInfo info = new AnnotatedTypeInfo(tm, JaxbBean1.class, "urn:foo", new TypeCreationOptions()); - Iterator elements = info.getElements(); + Iterator elements = info.getElements().iterator(); assertTrue(elements.hasNext()); QName element = (QName)elements.next(); assertTrue(elements.hasNext()); @@ -91,7 +91,7 @@ fail("Unexpected element name: " + element.getLocalPart()); } - Iterator atts = info.getAttributes(); + Iterator atts = info.getAttributes().iterator(); assertTrue(atts.hasNext()); atts.next(); assertFalse(atts.hasNext()); @@ -108,9 +108,9 @@ public void testAegisType() { BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean3.class); - assertFalse(type.getTypeInfo().getAttributes().hasNext()); + assertEquals(0, type.getTypeInfo().getAttributes().size()); - Iterator itr = type.getTypeInfo().getElements(); + Iterator itr = type.getTypeInfo().getElements().iterator(); assertTrue(itr.hasNext()); QName q = (QName)itr.next(); assertEquals("attProp", q.getLocalPart()); @@ -128,7 +128,7 @@ public void testNillableAndMinOccurs() { BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean4.class); AnnotatedTypeInfo info = (AnnotatedTypeInfo)type.getTypeInfo(); - Iterator elements = info.getElements(); + Iterator elements = info.getElements().iterator(); assertTrue(elements.hasNext()); // nillable first QName element = (QName)elements.next(); @@ -181,7 +181,7 @@ new TypeCreationOptions())); type.setSchemaType(new QName("urn:foo", "BadBean")); - assertFalse(type.getTypeInfo().getElements().hasNext()); + assertEquals(0, type.getTypeInfo().getElements().size()); } public static class BadBean { Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTypeTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTypeTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTypeTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTypeTest.java Thu Feb 19 14:18:49 2009 @@ -64,7 +64,7 @@ AnnotatedTypeInfo info = new AnnotatedTypeInfo(tm, XFireBean1.class, "urn:foo", new TypeCreationOptions()); - Iterator elements = info.getElements(); + Iterator elements = info.getElements().iterator(); assertTrue(elements.hasNext()); QName element = (QName)elements.next(); assertTrue(elements.hasNext()); @@ -91,7 +91,7 @@ fail("Unexpected element name: " + element.getLocalPart()); } - Iterator atts = info.getAttributes(); + Iterator atts = info.getAttributes().iterator(); assertTrue(atts.hasNext()); atts.next(); assertFalse(atts.hasNext()); @@ -108,9 +108,9 @@ public void testAegisType() { BeanType type = (BeanType)tm.getTypeCreator().createType(XFireBean3.class); - assertFalse(type.getTypeInfo().getAttributes().hasNext()); + assertEquals(0, type.getTypeInfo().getAttributes().size()); - Iterator itr = type.getTypeInfo().getElements(); + Iterator itr = type.getTypeInfo().getElements().iterator(); assertTrue(itr.hasNext()); QName q = (QName)itr.next(); assertEquals("attProp", q.getLocalPart()); @@ -128,7 +128,7 @@ public void testNillableAndMinOccurs() { BeanType type = (BeanType)tm.getTypeCreator().createType(XFireBean4.class); AnnotatedTypeInfo info = (AnnotatedTypeInfo)type.getTypeInfo(); - Iterator elements = info.getElements(); + Iterator elements = info.getElements().iterator(); assertTrue(elements.hasNext()); // nillable first QName element = (QName)elements.next(); @@ -181,7 +181,7 @@ new TypeCreationOptions())); type.setSchemaType(new QName("urn:foo", "BadBean")); - assertFalse(type.getTypeInfo().getElements().hasNext()); + assertEquals(0, type.getTypeInfo().getElements().size()); } public static class BadBean { Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/streams/XMLStreamReaderMappingTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/streams/XMLStreamReaderMappingTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/streams/XMLStreamReaderMappingTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/streams/XMLStreamReaderMappingTest.java Thu Feb 19 14:18:49 2009 @@ -48,7 +48,7 @@ context = new AegisContext(); // create a different mapping than the context creates. - TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false); + TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false); mapping = new DefaultTypeMapping(SOAPConstants.XSD, baseMapping); mapping.register(XMLStreamReader.class, new QName("urn:Bean", "SimpleBean"), new XMLStreamReaderType()); Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml Thu Feb 19 14:18:49 2009 @@ -35,11 +35,17 @@ - - - - - + + + + + + + + + + + Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Thu Feb 19 14:18:49 2009 @@ -36,18 +36,18 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.namespace.QName; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.ReflectionInvokationHandler; import org.apache.cxf.common.xmlschema.SchemaCollection; -import org.apache.cxf.common.xmlschema.XmlSchemaTools; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.service.ServiceModelVisitor; import org.apache.cxf.service.model.FaultInfo; import org.apache.cxf.service.model.MessagePartInfo; import org.apache.cxf.service.model.SchemaInfo; import org.apache.cxf.service.model.ServiceInfo; -import org.apache.cxf.wsdl.WSDLConstants; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; @@ -326,7 +326,7 @@ private XmlSchemaElement createXsElement(MessagePartInfo part, QName typeName, SchemaInfo schemaInfo) { XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, part.getElementQName()); + XmlSchemaUtils.setElementQName(el, part.getElementQName()); el.setNillable(true); el.setSchemaTypeName(typeName); part.setXmlSchema(el); @@ -349,7 +349,7 @@ && !isExistSchemaElement(schemaInfo.getSchema(), part.getElementQName())) { XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, part.getElementQName()); + XmlSchemaUtils.setElementQName(el, part.getElementQName()); el.setNillable(true); schemaInfo.getSchema().getItems().add(el); @@ -382,7 +382,7 @@ } XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, part.getElementQName()); + XmlSchemaUtils.setElementQName(el, part.getElementQName()); schemaInfo.getSchema().getItems().add(el); schemaInfo.getSchema().getElements().add(el.getQName(), el); @@ -411,7 +411,7 @@ String ns = schemaInfo.getSchema().getElementFormDefault() .getValue().equals(XmlSchemaForm.UNQUALIFIED) ? "" : part.getElementQName().getLocalPart(); - XmlSchemaTools.setElementQName(el, + XmlSchemaUtils.setElementQName(el, new QName(ns, m.getName().substring(beginIdx))); Iterator itr = beanInfo.getTypeNames().iterator(); if (!itr.hasNext()) { @@ -470,7 +470,7 @@ } XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, part.getElementQName()); + XmlSchemaUtils.setElementQName(el, part.getElementQName()); schema.getItems().add(el); schema.getElements().add(el.getQName(), el); part.setXmlSchema(el); @@ -531,7 +531,7 @@ QName name, boolean isArray) { XmlSchemaElement el = new XmlSchemaElement(); el.setName(name.getLocalPart()); - XmlSchemaTools.setElementQName(el, name); + XmlSchemaUtils.setElementQName(el, name); if (isArray) { el.setMinOccurs(0); @@ -546,8 +546,8 @@ QName ename = new QName(beanInfo.getElementNamespaceURI(null), beanInfo.getElementLocalName(null)); XmlSchemaElement el2 = schemas.getElementByQName(ename); - XmlSchemaTools.setElementQName(el, null); - XmlSchemaTools.setElementRefName(el, el2.getRefName()); + XmlSchemaUtils.setElementQName(el, null); + XmlSchemaUtils.setElementRefName(el, el2.getRefName()); } else { Iterator itr = beanInfo.getTypeNames().iterator(); if (!itr.hasNext()) { Modified: cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java Thu Feb 19 14:18:49 2009 @@ -21,8 +21,8 @@ import org.w3c.dom.Node; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.util.SOAPConstants; -import org.apache.cxf.wsdl.WSDLConstants; import org.junit.Before; import org.junit.Test; Modified: cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java Thu Feb 19 14:18:49 2009 @@ -22,8 +22,8 @@ import org.w3c.dom.Node; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.util.SOAPConstants; -import org.apache.cxf.wsdl.WSDLConstants; import org.junit.Before; import org.junit.Test; Modified: cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/WeatherServiceRPCLitTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/WeatherServiceRPCLitTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/WeatherServiceRPCLitTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/WeatherServiceRPCLitTest.java Thu Feb 19 14:18:49 2009 @@ -28,8 +28,8 @@ import net.webservicex.WeatherData; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.util.SOAPConstants; -import org.apache.cxf.wsdl.WSDLConstants; import org.apache.cxf.xmlbeans.AbstractXmlBeansTest; import org.junit.Before; import org.junit.Test; Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/pom.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/pom.xml?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/pom.xml (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/pom.xml Thu Feb 19 14:18:49 2009 @@ -87,10 +87,6 @@ - jaxen - jaxen - - org.apache.abdera abdera-core ${abdera.version} Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java Thu Feb 19 14:18:49 2009 @@ -47,6 +47,7 @@ import org.w3c.dom.Node; import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.helpers.XMLUtils; import org.apache.cxf.interceptor.Fault; @@ -55,7 +56,6 @@ import org.apache.cxf.message.XMLMessage; import org.apache.cxf.staxutils.StaxUtils; import org.apache.cxf.staxutils.W3CDOMStreamWriter; -import org.apache.cxf.wsdl.WSDLConstants; public class LogicalMessageImpl implements LogicalMessage { Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutDatabindingInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutDatabindingInterceptor.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutDatabindingInterceptor.java (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutDatabindingInterceptor.java Thu Feb 19 14:18:49 2009 @@ -55,6 +55,7 @@ import org.apache.cxf.binding.soap.Soap12; import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.binding.soap.SoapVersion; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.databinding.DataWriter; import org.apache.cxf.databinding.source.NodeDataWriter; @@ -72,7 +73,6 @@ import org.apache.cxf.message.XMLMessage; import org.apache.cxf.phase.Phase; import org.apache.cxf.staxutils.W3CDOMStreamWriter; -import org.apache.cxf.wsdl.WSDLConstants; public class DispatchOutDatabindingInterceptor extends AbstractOutDatabindingInterceptor { private static final Logger LOG = LogUtils.getL7dLogger(DispatchOutDatabindingInterceptor.class); Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java Thu Feb 19 14:18:49 2009 @@ -43,6 +43,7 @@ import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.io.CachedOutputStream; @@ -51,7 +52,6 @@ import org.apache.cxf.jaxws.ServiceImpl; import org.apache.cxf.staxutils.StaxUtils; import org.apache.cxf.ws.addressing.JAXWSAConstants; -import org.apache.cxf.wsdl.WSDLConstants; import org.apache.cxf.wsdl.WSDLManager; public class ProviderImpl extends javax.xml.ws.spi.Provider { Modified: cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Thu Feb 19 14:18:49 2009 @@ -55,11 +55,12 @@ import org.apache.cxf.binding.BindingFactoryManager; import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver; import org.apache.cxf.clustering.FailoverFeature; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; -import org.apache.cxf.common.xmlschema.XmlSchemaTools; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.databinding.source.mime.MimeAttribute; import org.apache.cxf.databinding.source.mime.MimeSerializer; @@ -95,7 +96,6 @@ import org.apache.cxf.service.model.SchemaInfo; import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.service.model.UnwrappedOperationInfo; -import org.apache.cxf.wsdl.WSDLConstants; import org.apache.cxf.wsdl11.WSDLServiceBuilder; import org.apache.cxf.wsdl11.WSDLServiceFactory; import org.apache.ws.commons.schema.XmlSchema; @@ -897,7 +897,7 @@ XmlSchema schema = si.getSchema(); XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, mpi.getElementQName()); + XmlSchemaUtils.setElementQName(el, mpi.getElementQName()); if (!isExistSchemaElement(schema, mpi.getElementQName())) { SchemaCollection.addGlobalElementToSchema(schema, el); } @@ -1004,7 +1004,7 @@ } XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, qname); + XmlSchemaUtils.setElementQName(el, qname); el.setNillable(true); if (!isExistSchemaElement(schema, qname)) { @@ -1098,7 +1098,7 @@ QName wrapperName) { XmlSchemaElement el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, wrapperName); + XmlSchemaUtils.setElementQName(el, wrapperName); SchemaCollection.addGlobalElementToSchema(schema, el); wrappedMessage.getMessageParts().get(0).setXmlSchema(el); @@ -1117,12 +1117,12 @@ for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) { el = new XmlSchemaElement(); - XmlSchemaTools.setElementQName(el, mpi.getName()); + XmlSchemaUtils.setElementQName(el, mpi.getName()); Map jaxbAnnoMap = getJaxbAnnoMap(mpi); if (mpi.isElement()) { addImport(schema, mpi.getElementQName().getNamespaceURI()); - XmlSchemaTools.setElementQName(el, null); - XmlSchemaTools.setElementRefName(el, mpi.getElementQName()); + XmlSchemaUtils.setElementQName(el, null); + XmlSchemaUtils.setElementRefName(el, mpi.getElementQName()); } else { if (mpi.getTypeQName() != null && !jaxbAnnoMap.containsKey(XmlList.class)) { el.setSchemaTypeName(mpi.getTypeQName()); @@ -1166,7 +1166,7 @@ mpi.setElement(true); mpi.setElementQName(newName); mpi.setConcreteName(newName); - XmlSchemaTools.setElementQName(el, newName); + XmlSchemaUtils.setElementQName(el, newName); } if (Collection.class.isAssignableFrom(mpi.getTypeClass()) @@ -1190,7 +1190,7 @@ if (Boolean.TRUE.equals(mpi.getProperty(HEADER))) { QName qn = (QName)mpi.getProperty(ELEMENT_NAME); - XmlSchemaTools.setElementQName(el, qn); + XmlSchemaUtils.setElementQName(el, qn); SchemaInfo headerSchemaInfo = getOrCreateSchema(serviceInfo, qn.getNamespaceURI(), getQualifyWrapperSchema()); Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java Thu Feb 19 14:18:49 2009 @@ -26,6 +26,7 @@ import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; import org.apache.cxf.common.xmlschema.XmlSchemaConstants; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaAnnotated; import org.apache.ws.commons.schema.XmlSchemaAnyAttribute; Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java Thu Feb 19 14:18:49 2009 @@ -30,10 +30,11 @@ import org.w3c.dom.Attr; import org.apache.cxf.aegis.type.mtom.AbstractXOPType; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.xmlschema.SchemaCollection; import org.apache.cxf.common.xmlschema.XmlSchemaConstants; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.cxf.databinding.source.mime.MimeAttribute; -import org.apache.cxf.wsdl.WSDLConstants; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaObject; Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/NamespacePrefixAccumulator.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/NamespacePrefixAccumulator.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/NamespacePrefixAccumulator.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/NamespacePrefixAccumulator.java Thu Feb 19 14:18:49 2009 @@ -28,7 +28,6 @@ import org.apache.cxf.common.xmlschema.SchemaCollection; import org.apache.ws.commons.schema.XmlSchemaAttribute; -import org.apache.ws.commons.schema.XmlSchemaElement; public class NamespacePrefixAccumulator { private StringBuffer attributes; @@ -76,19 +75,19 @@ /** * This function obtains a name, perhaps namespace-qualified, for an element. - * @param element the element. + * @param elementQName the element. * @param qualified whether to qualify. * @return */ - public String xmlElementString(XmlSchemaElement element, boolean qualified) { + public String xmlElementString(QName elementQName, boolean qualified) { if (qualified) { // What if there were a prefix in the element's qname? This is not apparently // something that happens in this environment. - String prefix = getPrefix(element.getQName().getNamespaceURI()); - collect(prefix, element.getQName().getNamespaceURI()); - return prefix + ":" + element.getName(); + String prefix = getPrefix(elementQName.getNamespaceURI()); + collect(prefix, elementQName.getNamespaceURI()); + return prefix + ":" + elementQName.getLocalPart(); } - return element.getName(); // use the non-qualified name. + return elementQName.getLocalPart(); // use the non-qualified name. } /** Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java Thu Feb 19 14:18:49 2009 @@ -27,6 +27,7 @@ import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; import org.apache.cxf.common.xmlschema.XmlSchemaConstants; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaObject; @@ -167,7 +168,9 @@ if (particle instanceof XmlSchemaElement) { XmlSchemaElement element = (XmlSchemaElement)particle; - String elementNamespaceURI = element.getQName().getNamespaceURI(); + QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, currentSchema); + String elementNamespaceURI = elementQName.getNamespaceURI(); + boolean elementNoNamespace = "".equals(elementNamespaceURI); XmlSchema elementSchema = null; @@ -181,11 +184,11 @@ boolean qualified = !elementNoNamespace && XmlSchemaUtils.isElementQualified(element, true, currentSchema, elementSchema); - elementInfo.xmlName = prefixAccumulator.xmlElementString(element, qualified); + elementInfo.xmlName = prefixAccumulator.xmlElementString(elementQName, qualified); // we are assuming here that we are not dealing, in close proximity, // with elements with identical local names and different // namespaces. - elementInfo.javascriptName = element.getQName().getLocalPart(); + elementInfo.javascriptName = elementQName.getLocalPart(); elementInfo.defaultValue = element.getDefaultValue(); factorySetupType(element, schemaCollection, elementInfo); } else { // any Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java Thu Feb 19 14:18:49 2009 @@ -34,16 +34,17 @@ import org.apache.cxf.binding.soap.SoapBindingFactory; import org.apache.cxf.binding.soap.SoapVersion; import org.apache.cxf.binding.soap.model.SoapBindingInfo; +import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.cxf.javascript.JavascriptUtils; import org.apache.cxf.javascript.NameManager; import org.apache.cxf.javascript.NamespacePrefixAccumulator; import org.apache.cxf.javascript.ParticleInfo; import org.apache.cxf.javascript.UnsupportedConstruct; -import org.apache.cxf.javascript.XmlSchemaUtils; import org.apache.cxf.service.ServiceModelVisitor; import org.apache.cxf.service.model.BindingInfo; import org.apache.cxf.service.model.EndpointInfo; @@ -54,7 +55,6 @@ import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.transport.local.LocalTransportFactory; -import org.apache.cxf.wsdl.WSDLConstants; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaAny; import org.apache.ws.commons.schema.XmlSchemaComplexType; Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java Thu Feb 19 14:18:49 2009 @@ -29,7 +29,7 @@ import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; -import org.apache.cxf.common.xmlschema.XmlSchemaTools; +import org.apache.cxf.common.xmlschema.XmlSchemaUtils; import org.apache.cxf.javascript.AttributeInfo; import org.apache.cxf.javascript.ItemInfo; import org.apache.cxf.javascript.JavascriptUtils; @@ -37,7 +37,6 @@ import org.apache.cxf.javascript.NamespacePrefixAccumulator; import org.apache.cxf.javascript.ParticleInfo; import org.apache.cxf.javascript.UnsupportedConstruct; -import org.apache.cxf.javascript.XmlSchemaUtils; import org.apache.cxf.service.model.SchemaInfo; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaAnnotated; @@ -111,8 +110,8 @@ } } else if (xmlSchemaObject instanceof XmlSchemaSimpleType) { XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)xmlSchemaObject; - if (XmlSchemaTools.isEumeration(simpleType)) { - List values = XmlSchemaTools.enumeratorValues(simpleType); + if (XmlSchemaUtils.isEumeration(simpleType)) { + List values = XmlSchemaUtils.enumeratorValues(simpleType); code.append("//\n"); code.append("// Simple type (enumeration) " + simpleType.getQName() + "\n"); code.append("//\n"); @@ -579,7 +578,8 @@ String accessorName = "set" + StringUtils.capitalize(itemInfo.getJavascriptName()); utils.appendLine("cxfjsutils.trace('processing " + itemInfo.getJavascriptName() + "');"); XmlSchemaElement element = (XmlSchemaElement) itemInfo.getParticle(); - String elementNamespaceURI = element.getQName().getNamespaceURI(); + QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, schemaInfo.getSchema()); + String elementNamespaceURI = elementQName.getNamespaceURI(); boolean elementNoNamespace = "".equals(elementNamespaceURI); XmlSchema elementSchema = null; if (!elementNoNamespace) { @@ -595,7 +595,7 @@ elementNamespaceURI = ""; } - String localName = element.getQName().getLocalPart(); + String localName = elementQName.getLocalPart(); String valueTarget = "item"; if (itemInfo.isOptional() || itemInfo.isArray()) { Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java Thu Feb 19 14:18:49 2009 @@ -22,8 +22,9 @@ import java.util.Collection; import java.util.logging.Logger; +import org.w3c.dom.Document; + import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.interceptor.LoggingInInterceptor; import org.apache.cxf.javascript.JavascriptTestUtilities.JSRunnable; import org.apache.cxf.javascript.JavascriptTestUtilities.Notifier; import org.apache.cxf.javascript.fortest.AegisServiceImpl; @@ -62,7 +63,6 @@ true); implementor = (AegisServiceImpl)rawImplementor; implementor.reset(); - serverFactoryBean.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor()); } private Void acceptAny(Context context) { @@ -72,7 +72,7 @@ testUtilities.javaToJS(getAddress())); implementor.waitForOneWay(); assertEquals("before items", implementor.getAcceptedString()); - Collection something = implementor.getAcceptedCollection(); + Collection something = implementor.getAcceptedCollection(); assertNotNull(something); return null; } @@ -106,6 +106,7 @@ }); } + private Void returnBeanWithAnyTypeArray(Context context) { Notifier notifier = testUtilities.rhinoCallConvert("testReturningBeanWithAnyTypeArray", Notifier.class, @@ -133,7 +134,7 @@ assertEquals(new Float(42), new Float(intValue.toString())); return null; } - + @Test public void callReturnBeanWithAnyTypeArray() { testUtilities.runInsideContext(Void.class, new JSRunnable() { Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java Thu Feb 19 14:18:49 2009 @@ -21,10 +21,12 @@ import java.util.Collection; +import org.w3c.dom.Document; + import org.apache.cxf.javascript.fortest.aegis.BeanWithAnyTypeArray; public interface AegisService { - void acceptAny(String before, Collection anything); + void acceptAny(String before, Collection anything); void acceptObjects(Collection anything); void acceptStrings(Collection someStrings); BeanWithAnyTypeArray returnBeanWithAnyTypeArray(); Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java?rev=745879&r1=745878&r2=745879&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java (original) +++ cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java Thu Feb 19 14:18:49 2009 @@ -22,6 +22,8 @@ import java.util.Collection; import java.util.concurrent.CountDownLatch; +import org.w3c.dom.Document; + import org.apache.cxf.javascript.fortest.aegis.BeanWithAnyTypeArray; import org.apache.cxf.javascript.fortest.aegis.Mammal; import org.apache.cxf.javascript.fortest.aegis.Vegetable; @@ -31,7 +33,7 @@ */ public class AegisServiceImpl implements AegisService { private String acceptedString; - private Collection acceptedCollection; + private Collection acceptedCollection; private Collection acceptedStrings; private Collection acceptedObjects; private CountDownLatch oneWayLatch; @@ -46,7 +48,7 @@ } /** {@inheritDoc}*/ - public void acceptAny(String before, Collection anything) { + public void acceptAny(String before, Collection anything) { acceptedString = before; acceptedCollection = anything; if (oneWayLatch != null) { @@ -57,7 +59,7 @@ /** * @return Returns the acceptedCollection. */ - public Collection getAcceptedCollection() { + public Collection getAcceptedCollection() { return acceptedCollection; }