Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 99006 invoked from network); 7 Mar 2007 20:21:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Mar 2007 20:21:17 -0000 Received: (qmail 13045 invoked by uid 500); 7 Mar 2007 20:21:25 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 12965 invoked by uid 500); 7 Mar 2007 20:21:25 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 12859 invoked by uid 99); 7 Mar 2007 20:21:25 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2007 12:21:24 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2007 12:21:08 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AC15B1A985D; Wed, 7 Mar 2007 12:20:21 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r515734 [10/11] - in /incubator/cxf/trunk/rt: ./ core/src/main/java/org/apache/cxf/endpoint/ databinding/aegis/ databinding/aegis/src/ databinding/aegis/src/main/ databinding/aegis/src/main/java/ databinding/aegis/src/main/java/org/ databin... Date: Wed, 07 Mar 2007 20:20:15 -0000 To: cxf-commits@incubator.apache.org From: dandiep@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070307202021.AC15B1A985D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,100 @@ +package org.apache.cxf.aegis.type.java5; + +import javax.xml.namespace.QName; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.type.Configuration; +import org.apache.cxf.aegis.type.CustomTypeMapping; +import org.apache.cxf.aegis.type.DefaultTypeMappingRegistry; +import org.apache.cxf.aegis.type.Type; +import org.apache.cxf.aegis.type.XMLTypeCreator; +import org.apache.cxf.aegis.type.basic.BeanType; +import org.apache.cxf.aegis.type.basic.BeanTypeInfo; + +/** + * @author adam + * + */ +public class ConfigurationTest + extends AbstractAegisTest +{ + + CustomTypeMapping tm; + + Configuration config = null; + + public void setUp() + throws Exception + { + super.setUp(); + + DefaultTypeMappingRegistry reg = new DefaultTypeMappingRegistry(); + config = reg.getConfiguration(); + XMLTypeCreator creator = new XMLTypeCreator(); + creator.setConfiguration(reg.getConfiguration()); + Java5TypeCreator next = new Java5TypeCreator(); + next.setConfiguration(reg.getConfiguration()); + creator.setNextCreator(next); + reg.createDefaultMappings(); + tm = (CustomTypeMapping) reg.getDefaultTypeMapping(); + tm.setTypeCreator(creator); + } + + public void testNillableDefaultTrue() throws Exception + { + config.setDefaultNillable( true ); + + Type type = tm.getTypeCreator().createType(AnnotatedBean1.class); + BeanTypeInfo info = ((BeanType) type).getTypeInfo(); + + assertTrue(info.isNillable(new QName(info.getDefaultNamespace(), "bogusProperty"))); + } + + public void testNillableDefaultFalse() throws Exception + { + config.setDefaultNillable( false ); + Type type = tm.getTypeCreator().createType(AnnotatedBean1.class); + BeanTypeInfo info = ((BeanType) type).getTypeInfo(); + + assertFalse(info.isNillable(new QName(info.getDefaultNamespace(), "bogusProperty"))); + } + + public void testMinOccursDefault0() throws Exception + { + config.setDefaultMinOccurs( 0 ); + Type type = tm.getTypeCreator().createType(AnnotatedBean1.class); + BeanTypeInfo info = ((BeanType) type).getTypeInfo(); + + assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 0); + } + + public void testMinOccursDefault1() throws Exception + { + config.setDefaultMinOccurs( 1 ); + Type type = tm.getTypeCreator().createType(AnnotatedBean1.class); + BeanTypeInfo info = ((BeanType) type).getTypeInfo(); + + assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 1); + } + + public void testExtensibleDefaultTrue() throws Exception + { + config.setDefaultExtensibleElements( true ); + config.setDefaultExtensibleAttributes( true ); + Type type = tm.getTypeCreator().createType(AnnotatedBean1.class); + BeanTypeInfo info = ((BeanType) type).getTypeInfo(); + assertTrue(info.isExtensibleElements()); + assertTrue(info.isExtensibleAttributes()); + } + + public void testExtensibleDefaultFalse() throws Exception + { + config.setDefaultExtensibleElements( false ); + config.setDefaultExtensibleAttributes( false ); + Type type = tm.getTypeCreator().createType(AnnotatedBean1.class); + BeanTypeInfo info = ((BeanType) type).getTypeInfo(); + assertFalse(info.isExtensibleElements()); + assertFalse(info.isExtensibleAttributes()); + } + +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,16 @@ +package org.apache.cxf.aegis.type.java5; + +public class CurrencyService +{ + public enum Currency + { + USD, + POUNDS, + EURO + } + + public int convert(int input, Currency inputCurrency, Currency outputCurrency) + { + return input; + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CurrencyService.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,8 @@ +package org.apache.cxf.aegis.type.java5; + +import org.apache.cxf.aegis.type.basic.StringType; + +public class CustomStringType extends StringType +{ + +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CustomStringType.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.aegis.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,26 @@ +package org.apache.cxf.aegis.type.java5; + +import java.util.ArrayList; +import java.util.Collection; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.ws.Holder; + +@WebService(serviceName="DualOutService") +public class DualOutService +{ + @WebMethod + public String getValues(@WebParam(mode=WebParam.Mode.OUT) Holder out2) + { + out2.value = "hi"; + return "hi"; + } + + @WebMethod + public Collection getStrings() + { + return new ArrayList(); + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutService.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,28 @@ +package org.apache.cxf.aegis.type.java5; + +import org.w3c.dom.Document; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.util.XmlConstants; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; + +public class DualOutServiceTest + extends AbstractAegisTest +{ + public void testWSDL() throws Exception + { + JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); + sf.setServiceClass(DualOutService.class); + sf.setAddress("DualOutService"); + sf.setBus(getBus()); + setupAegis(sf); + sf.create(); + + Document wsdl = getWSDLDocument("DualOutService"); + assertNotNull(wsdl); + + addNamespace("xsd", XmlConstants.XSD); + assertValid("//xsd:element[@name='getValuesResponse']//xsd:element[@name='return'][@type='xsd:string']", wsdl); + assertValid("//xsd:element[@name='getValuesResponse']//xsd:element[@name='out2'][@type='xsd:string']", wsdl); + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/DualOutServiceTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,148 @@ +package org.apache.cxf.aegis.type.java5; + +import javax.mail.MessageContext; +import javax.xml.namespace.QName; + +import org.w3c.dom.Document; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.Context; +import org.apache.cxf.aegis.type.Configuration; +import org.apache.cxf.aegis.type.CustomTypeMapping; +import org.apache.cxf.aegis.type.Type; +import org.apache.cxf.aegis.type.java5.CurrencyService.Currency; +import org.apache.cxf.aegis.util.XmlConstants; +import org.apache.cxf.aegis.xml.jdom.JDOMReader; +import org.apache.cxf.aegis.xml.jdom.JDOMWriter; +import org.apache.cxf.binding.soap.SoapConstants; +import org.jdom.Element; +import org.jdom.output.DOMOutputter; + +public class EnumTypeTest + extends AbstractAegisTest +{ + private CustomTypeMapping tm; + + private enum smallEnum { VALUE1, VALUE2 }; + + public void setUp() throws Exception + { + super.setUp(); + + tm = new CustomTypeMapping(); + Java5TypeCreator creator = new Java5TypeCreator(); + creator.setConfiguration(new Configuration()); + tm.setTypeCreator(creator); + } + + public void testType() throws Exception + { + EnumType type = new EnumType(); + type.setTypeClass(smallEnum.class); + type.setSchemaType(new QName("urn:test", "test")); + + tm.register(type); + + Element root = new Element("root"); + JDOMWriter writer = new JDOMWriter(root); + + type.writeObject(smallEnum.VALUE1, writer, new Context()); + + assertEquals("VALUE1", root.getValue()); + + JDOMReader reader = new JDOMReader(root); + Object value = type.readObject(reader, new Context()); + + assertEquals(smallEnum.VALUE1, value); + } + + public void testAutoCreation() throws Exception + { + Type type = (Type) tm.getTypeCreator().createType(smallEnum.class); + + assertTrue( type instanceof EnumType ); + } + + public void testTypeAttributeOnEnum() throws Exception + { + Type type = (Type) tm.getTypeCreator().createType(TestEnum.class); + + assertEquals("urn:xfire:foo", type.getSchemaType().getNamespaceURI()); + + assertTrue( type instanceof EnumType ); + } + + public void testWSDL() throws Exception + { + EnumType type = new EnumType(); + type.setTypeClass(smallEnum.class); + type.setSchemaType(new QName("urn:test", "test")); + + Element root = new Element("root"); + org.jdom.Document wsdl = new org.jdom.Document(root); + type.writeSchema(root); + + Document doc = new DOMOutputter().output(wsdl); + addNamespace("xsd", XmlConstants.XSD); + assertValid("//xsd:simpleType[@name='test']/xsd:restriction[@base='xsd:string']", doc); + assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='VALUE1']", doc); + assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='VALUE2']", doc); + } + + public void testCurrencyService() throws Exception + { + createService(CurrencyService.class, null); + + Document wsdl = getWSDLDocument("CurrencyService"); + + assertValid("//xsd:element[@name='inputCurrency'][@nillable='true']", wsdl); + assertValid("//xsd:simpleType[@name='Currency']/xsd:restriction[@base='xsd:string']", wsdl); + assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='USD']", wsdl); + assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='EURO']", wsdl); + assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='POUNDS']", wsdl); + } + + + public void testNillable() throws Exception + { + Type type = tm.getTypeCreator().createType(EnumBean.class); + + tm.register(type); + + Element root = new Element("root"); + JDOMWriter writer = new JDOMWriter(root); + + type.writeObject(new EnumBean(), writer, new Context()); + + JDOMReader reader = new JDOMReader(root); + Object value = type.readObject(reader, new Context()); + + assertTrue(value instanceof EnumBean); + EnumBean bean = (EnumBean) value; + assertNull(bean.getCurrency()); + } + + public static class EnumBean { + private Currency currency; + + public Currency getCurrency() + { + return currency; + } + + public void setCurrency(Currency currency) + { + this.currency = currency; + } + + public Currency[] getSomeCurrencies() + { + return new Currency[] { Currency.EURO, null }; + } + + public void setSomeCurrencies(Currency[] currencies) + { + + } + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,164 @@ +package org.apache.cxf.aegis.type.java5; + +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import javax.xml.namespace.QName; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.type.Configuration; +import org.apache.cxf.aegis.type.CustomTypeMapping; +import org.apache.cxf.aegis.type.Type; +import org.apache.cxf.aegis.type.collection.CollectionType; +import org.apache.cxf.aegis.type.collection.MapType; +import org.apache.cxf.aegis.type.java5.dto.MapDTO; +import org.apache.cxf.aegis.type.java5.dto.MapDTOService; + +public class MapTest + extends AbstractAegisTest +{ + private CustomTypeMapping tm; + private Java5TypeCreator creator; + + public void setUp() throws Exception + { + super.setUp(); + + tm = new CustomTypeMapping(); + creator = new Java5TypeCreator(); + creator.setConfiguration(new Configuration()); + tm.setTypeCreator(creator); + } + + @SuppressWarnings("unchecked") + public void testType() throws Exception + { + Method m = MapService.class.getMethod("getMap", new Class[0]); + + Type type = creator.createType(m, -1); + tm.register(type); + assertTrue( type instanceof MapType ); + + MapType mapType = (MapType) type; + QName keyName = mapType.getKeyName(); + assertNotNull(keyName); + + type = mapType.getKeyType(); + assertNotNull(type); + assertTrue(type.getTypeClass().isAssignableFrom(String.class)); + + type = mapType.getValueType(); + assertNotNull(type); + assertTrue(type.getTypeClass().isAssignableFrom(Integer.class)); + } + + public void testRecursiveType() throws Exception + { + Method m = MapService.class.getMethod("getMapOfCollections", new Class[0]); + + Type type = creator.createType(m, -1); + tm.register(type); + assertTrue( type instanceof MapType ); + + MapType mapType = (MapType) type; + QName keyName = mapType.getKeyName(); + assertNotNull(keyName); + + type = mapType.getKeyType(); + assertNotNull(type); + assertTrue(type instanceof CollectionType); + assertEquals(String.class, ((CollectionType) type).getComponentType().getTypeClass()); + + type = mapType.getValueType(); + assertNotNull(type); + assertTrue(type instanceof CollectionType); + assertEquals(Double.class, ((CollectionType) type).getComponentType().getTypeClass()); + } + + @SuppressWarnings("unchecked") + public void testPDType() throws Exception + { + PropertyDescriptor pd = + Introspector.getBeanInfo(MapDTO.class, Object.class).getPropertyDescriptors()[0]; + Type type = creator.createType(pd); + tm.register(type); + assertTrue( type instanceof MapType ); + + MapType mapType = (MapType) type; + QName keyName = mapType.getKeyName(); + assertNotNull(keyName); + + type = mapType.getKeyType(); + assertNotNull(type); + assertTrue(type.getTypeClass().isAssignableFrom(String.class)); + + type = mapType.getValueType(); + assertNotNull(type); + assertTrue(type.getTypeClass().isAssignableFrom(Integer.class)); + } + + @SuppressWarnings("unchecked") + public void testMapDTO() + { + CustomTypeMapping tm = new CustomTypeMapping(); + Java5TypeCreator creator = new Java5TypeCreator(); + creator.setConfiguration(new Configuration()); + tm.setTypeCreator(creator); + + Type dto = creator.createType(MapDTO.class); + Set deps = dto.getDependencies(); + + Type type = (Type) deps.iterator().next(); + assertTrue( type instanceof MapType ); + + MapType mapType = (MapType) type; + + deps = dto.getDependencies(); + assertEquals(1, deps.size()); + + type = mapType.getKeyType(); + assertNotNull(type); + assertTrue(type.getTypeClass().isAssignableFrom(String.class)); + + type = mapType.getValueType(); + assertNotNull(type); + assertTrue(type.getTypeClass().isAssignableFrom(Integer.class)); + } + + public void testMapDTOService() throws Exception + { + createService(MapDTOService.class, null); + + invoke("MapDTOService", + "/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml"); + } + + + public void testMapServiceWSDL() throws Exception + { + createService(MapDTOService.class, null); + + getWSDLDocument("MapDTOService"); + } + + public class MapService + { + public Map getMap() + { + return null; + } + + public void setMap(Map strings) { + + } + + public Map,Collection> getMapOfCollections() + { + return null; + } + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,74 @@ +package org.apache.cxf.aegis.type.java5; + +import java.util.List; + +import javax.jws.Oneway; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; + +import org.w3c.dom.Document; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.databinding.AegisDatabinding; +import org.apache.cxf.aegis.util.XmlConstants; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; +import org.apache.cxf.service.Service; + +public class OperationNSTest extends AbstractAegisTest { + + public void setUp() throws Exception { + super.setUp(); + + JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); + sf.setServiceClass(NotificationLogImpl.class); + sf.setAddress("NotificationLogImpl"); + sf.getServiceFactory().setDataBinding(new AegisDatabinding()); + + sf.create(); + } + + public void testWSDL() throws Exception { + Document wsdl = getWSDLDocument("NotificationService"); + + addNamespace("xsd", XmlConstants.XSD); + assertValid("//xsd:element[@name='Notify']", wsdl); + } + + @WebService(name = "NotificationLog", targetNamespace = "http://www.sics.se/NotificationLog") + public static interface NotificationLog { + + @WebMethod(operationName = "Notify", action = "") + @Oneway + public void Notify(@WebParam(name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/b-2") + Document Notify); + + @WebMethod(operationName = "query", action = "") + @WebResult(name = "queryResponse", targetNamespace = "http://www.sics.se/NotificationLog") + public List query( + @WebParam(name = "xpath", targetNamespace = "http://www.sics.se/NotificationLog") + String xpath); + + @WebMethod(operationName = "Notify2", action = "") + @Oneway + public void Notify2( + @WebParam(name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd") + Document Notify); + } + + @WebService(endpointInterface = "org.apache.cxf.aegis.type.java5.OperationNSTest$NotificationLog", + serviceName="NotificationService") + public static class NotificationLogImpl implements NotificationLog { + + public void Notify(Document Notify) { + } + + public void Notify2(Document Notify) { + } + + public List query(String xpath) { + return null; + } + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/OperationNSTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,8 @@ +package org.apache.cxf.aegis.type.java5; + +@XmlType(namespace="urn:xfire:foo") +public enum TestEnum +{ + VALUE1, + VALUE2 +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/TestEnum.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,67 @@ +package org.apache.cxf.aegis.type.java5; + +import java.lang.reflect.Method; + +import javax.xml.namespace.QName; + +import org.w3c.dom.Document; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.type.Configuration; +import org.apache.cxf.aegis.type.CustomTypeMapping; +import org.apache.cxf.aegis.type.DefaultTypeCreator; +import org.apache.cxf.aegis.type.Type; + +public class XmlParamTypeTest + extends AbstractAegisTest +{ + private CustomTypeMapping tm; + private Java5TypeCreator creator; + + public void setUp() throws Exception + { + super.setUp(); + + tm = new CustomTypeMapping(); + creator = new Java5TypeCreator(); + creator.setNextCreator(new DefaultTypeCreator()); + creator.setConfiguration(new Configuration()); + tm.setTypeCreator(creator); + } + + public void testType() throws Exception + { + Method m = CustomTypeService.class.getMethod("doFoo", new Class[] { String.class }); + + Type type = creator.createType(m, 0); + tm.register(type); + assertTrue( type instanceof CustomStringType ); + assertEquals( new QName("urn:xfire:foo", "custom"), type.getSchemaType()); + + type = creator.createType(m, -1); + tm.register(type); + assertTrue( type instanceof CustomStringType ); + assertEquals( new QName("urn:xfire:foo", "custom"), type.getSchemaType()); + } + + public void testMapServiceWSDL() throws Exception + { + createService(CustomTypeService.class, null); + + Document wsdl = getWSDLDocument("CustomTypeService"); + assertValid("//xsd:element[@name='s'][@type='ns0:custom']", wsdl); + } + + public class CustomTypeService + { + + @XmlReturnType(type=CustomStringType.class, + namespace="urn:xfire:foo", + name="custom") + public String doFoo(@XmlParamType(type=CustomStringType.class, + namespace="urn:xfire:foo", + name="custom") String s) { + return null; + } + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,18 @@ +package org.apache.cxf.aegis.type.java5.dto; + +import java.util.List; + +public class CollectionDTO +{ + List strings; + + public List getStrings() + { + return strings; + } + + public void setStrings(List strings) + { + this.strings = strings; + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/CollectionDTO.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,17 @@ +package org.apache.cxf.aegis.type.java5.dto; + +import java.util.ArrayList; + +public class DTOService +{ + public CollectionDTO getDTO() + { + CollectionDTO dto = new CollectionDTO(); + + ArrayList strings = new ArrayList(); + strings.add("hi"); + dto.setStrings(strings); + + return dto; + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/DTOService.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/GetDTO.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,18 @@ +package org.apache.cxf.aegis.type.java5.dto; + +import java.util.Map; + +public class MapDTO +{ + Map strings; + + public Map getStrings() + { + return strings; + } + + public void setStrings(Map strings) + { + this.strings = strings; + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTO.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,17 @@ +package org.apache.cxf.aegis.type.java5.dto; + +import java.util.HashMap; + +public class MapDTOService +{ + public MapDTO getDTO() + { + MapDTO dto = new MapDTO(); + + HashMap strings = new HashMap(); + strings.put("hi", 4); + dto.setStrings(strings); + + return dto; + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/MapDTOService.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,18 @@ +package org.apache.cxf.aegis.type.java5.dto; + +import java.util.List; + +public class ObjectDTO +{ + List objects; + + public List getObjects() + { + return objects; + } + + public void setObjects(List objects) + { + this.objects = objects; + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/dto/ObjectDTO.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,8 @@ + + + + + Yo Yo + + + \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/echo11.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,120 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.aegis.xml.stax; + +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.cxf.aegis.util.STAXUtils; +import org.apache.cxf.aegis.util.jdom.StaxBuilder; +import org.apache.cxf.aegis.xml.MessageReader; +import org.apache.cxf.aegis.xml.jdom.JDOMReader; +import org.apache.cxf.aegis.xml.stax.ElementReader; +import org.apache.cxf.binding.soap.Soap11; +import org.apache.cxf.test.AbstractCXFTest; +import org.jdom.Document; + +/** + * @author Dan Diephouse + * @since Nov 4, 2004 + */ +public class ReaderTest + extends AbstractCXFTest +{ + public void testLiteralReader() + throws Exception + { + ElementReader lr = getStreamReader("bean11.xml"); + testReading(lr); + + lr = getStreamReader("read1.xml"); + testReading2(lr); + } + + private ElementReader getStreamReader(String resource) + throws FactoryConfigurationError, XMLStreamException + { + /*XMLInputFactory factory = XMLInputFactory.newInstance(); + XMLStreamReader reader = factory.createXMLStreamReader( + getResourceAsStream(resource));*/ + XMLStreamReader reader = STAXUtils.createXMLStreamReader(getResourceAsStream(resource),null,null); + + while ( reader.getEventType() != XMLStreamReader.START_ELEMENT ) + reader.next(); + + return new ElementReader(reader); + } + + public void testJDOMReader() + throws Exception + { + StaxBuilder builder = new StaxBuilder(); + Document doc = builder.build(getResourceAsReader("bean11.xml")); + + testReading(new JDOMReader(doc.getRootElement())); + } + + public void testReading(MessageReader reader) + { + assertTrue(reader.getLocalName().equals("Envelope")); + + // make sure we can repeat this + assertTrue(reader.hasMoreElementReaders()); + assertTrue(reader.hasMoreElementReaders()); + assertTrue(reader.hasMoreElementReaders()); + + MessageReader header = reader.getNextElementReader(); + assertEquals("Header", header.getLocalName()); + assertEquals(Soap11.getInstance().getNamespace(), header.getNamespace()); + assertFalse(header.hasMoreElementReaders()); + + MessageReader body = reader.getNextElementReader(); + assertEquals("Body", body.getLocalName()); + assertFalse(body.hasMoreElementReaders()); + } + + public void testReading2(MessageReader reader) + throws Exception + { + assertEquals("test", reader.getLocalName()); + assertEquals("urn:test", reader.getNamespace()); + + // make sure we can repeat this + assertTrue(reader.hasMoreAttributeReaders()); + assertTrue(reader.hasMoreAttributeReaders()); + assertTrue(reader.hasMoreAttributeReaders()); + + MessageReader one = reader.getNextAttributeReader(); + assertEquals("one", one.getValue()); + + MessageReader two = reader.getNextAttributeReader(); + assertEquals("two", two.getValue()); + + assertFalse(reader.hasMoreAttributeReaders()); + + assertTrue(reader.hasMoreElementReaders()); + assertTrue(reader.hasMoreElementReaders()); + assertTrue(reader.hasMoreElementReaders()); + + MessageReader child = reader.getNextElementReader(); + assertEquals("child", child.getLocalName()); + assertTrue(child.hasMoreElementReaders()); + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,131 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.aegis.xml.stax; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.StringReader; + +import org.apache.cxf.aegis.util.jdom.StaxBuilder; +import org.apache.cxf.aegis.xml.MessageWriter; +import org.apache.cxf.aegis.xml.jdom.JDOMWriter; +import org.apache.cxf.aegis.xml.stax.ElementWriter; +import org.apache.cxf.test.AbstractCXFTest; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.output.DOMOutputter; + +/** + * @author Dan Diephouse + * @since Nov 4, 2004 + */ +public class WriterTest + extends AbstractCXFTest +{ + File output; + + public void setUp() + throws Exception + { + super.setUp(); + + output = File.createTempFile("writetest", ".xml"); + } + + public void tearDown() + { + if (output.exists()) + output.delete(); + + super.tearDown(); + } + + public void testLiteral() + throws Exception + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ElementWriter writer = new ElementWriter(bos, "root", "urn:test"); + + write(writer); + + writer.flush(); + bos.close(); + + System.out.println(bos.toString()); + StaxBuilder builder = new StaxBuilder(); + Document doc = builder.build(new StringReader(bos.toString())); + + testWrite(doc); + } + + public void testJDOM() + throws Exception + { + Document doc = new Document(new Element("root", "urn:test")); + + write(new JDOMWriter(doc.getRootElement())); + + testWrite(doc); + } + + public void write(MessageWriter writer) + { + MessageWriter nons = writer.getElementWriter("nons"); + nons.writeValue("nons"); + nons.close(); + + MessageWriter intval = writer.getElementWriter("int"); + intval.writeValueAsInt(new Integer(10000)); + intval.close(); + + MessageWriter child1 = writer.getElementWriter("child1", "urn:child1"); + MessageWriter att1 = child1.getAttributeWriter("att1"); + att1.writeValue("att1"); + att1.close(); + MessageWriter att2 = child1.getAttributeWriter("att2", ""); + att2.writeValue("att2"); + att2.close(); + MessageWriter att3 = child1.getAttributeWriter("att3", "urn:att3"); + att3.writeValue("att3"); + att3.close(); + MessageWriter att4 = child1.getAttributeWriter("att4", null); + att4.writeValue("att4"); + att4.close(); + + child1.close(); + + writer.close(); + } + + public void testWrite(Document jdoc) throws Exception + { + org.w3c.dom.Document doc = new DOMOutputter().output(jdoc); + addNamespace("t", "urn:test"); + addNamespace("c", "urn:child1"); + addNamespace("a", "urn:att3"); + + assertValid("/t:root/t:nons[text()='nons']", doc); + assertValid("/t:root/t:int[text()='10000']", doc); + assertValid("/t:root/c:child1", doc); + assertValid("/t:root/c:child1[@c:att1]", doc); + assertValid("/t:root/c:child1[@att2]", doc); + assertValid("/t:root/c:child1[@a:att3]", doc); + assertValid("/t:root/c:child1[@att4]", doc); + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/bean11.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/read1.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/BaseUser.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/BaseUser.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/BaseUser.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/BaseUser.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * + */ +package org.codehaus.xfire.aegis.inheritance; + +// @XmlType(namespace="urn:xfire:inheritance") +public abstract class BaseUser +{ + private String name; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/BaseUser.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/BaseUser.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/Employee.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/Employee.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/Employee.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/Employee.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * + */ +package org.codehaus.xfire.aegis.inheritance; + +// @XmlType(namespace="urn:xfire:inheritance") +public class Employee + extends BaseUser +{ + private String division; + + public String getDivision() + { + return division; + } + + public void setDivision(String division) + { + this.division = division; + } + +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/Employee.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/Employee.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ExceptionInheritanceTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ExceptionInheritanceTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ExceptionInheritanceTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ExceptionInheritanceTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.xfire.aegis.inheritance; + +import org.apache.cxf.aegis.AbstractAegisTest; + +public class ExceptionInheritanceTest extends AbstractAegisTest +{ +// private Service service; +// +// public void setUp() throws Exception +// { +// super.setUp(); +// +// HashMap props = new HashMap(); +// props.put(AegisBindingProvider.WRITE_XSI_TYPE_KEY, Boolean.TRUE); +// ArrayList l = new ArrayList(); +// l.add(SimpleBean.class.getName()); +// l.add(WS1ExtendedException.class.getName()); +// +// props.put(AegisBindingProvider.OVERRIDE_TYPES_KEY, l); +// +// createService(WS1.class, null); +// +// service = getServiceFactory().create(WS1.class, props); +// service.setInvoker(new BeanInvoker(new WS1Impl())); +// getServiceRegistry().register(service); +// } +// +// public void testClient() throws Exception +// { +// WS1 client = (WS1) new XFireProxyFactory(getXFire()).create(service, "xfire.local://WS1"); +// +// try +// { +// client.throwException(true); +// } +// catch (WS1ExtendedException ex) +// { +// Object sb = ex.getSimpleBean(); +// assertTrue(sb instanceof SimpleBean); +// } +// } + + public void testNothing() { + + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ExceptionInheritanceTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ExceptionInheritanceTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,5 @@ + + + + + Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/GetEmployee.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritancePOJOTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritancePOJOTest.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritancePOJOTest.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritancePOJOTest.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,110 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.xfire.aegis.inheritance; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.Aegis; +import org.apache.cxf.aegis.util.XmlConstants; +import org.apache.cxf.frontend.ServerFactoryBean; +import org.apache.cxf.transport.local.LocalTransportFactory; + +/** + * @author Dan Diephouse + */ +public class InheritancePOJOTest + extends AbstractAegisTest +{ + + public void setUp() + throws Exception + { + super.setUp(); + + ServerFactoryBean sf = createServiceFactory(InheritanceService.class, + "InheritanceService", + new QName("urn:xfire:inheritance", + "InheritanceService")); + + Map props = new HashMap(); + props.put(Aegis.WRITE_XSI_TYPE_KEY, "true"); + + List l = new ArrayList(); + l.add(Employee.class.getName()); + + props.put(Aegis.OVERRIDE_TYPES_KEY, l); + + sf.getServiceFactory().setProperties(props); + sf.create(); + } + + public void testGenerateWsdl() + throws Exception + { + Document d = getWSDLDocument("InheritanceService"); + + String types = "//wsdl:types/xsd:schema/"; + + // check for Employee as extension + String employeeType = types + "xsd:complexType[@name='Employee']"; + assertValid(employeeType, d); + String extension = "/xsd:complexContent/xsd:extension[@base='ns1:BaseUser']"; + assertValid(employeeType + extension, d); + assertValid(employeeType + extension + "/xsd:sequence/xsd:element[@name='division']", d); + //assertValid("count(" + employeeType + extension + "/xsd:sequence/*)=1", d); + + // check for BaseUser as abstract + String baseUserType = types + "xsd:complexType[(@name='BaseUser') and (@abstract='true')]"; + assertValid(baseUserType, d); + assertValid(baseUserType + "/xsd:sequence/xsd:element[@name='name']", d); + // assertValid("count(" + baseUserType + "/xsd:sequence/*)=1", d); + } + + public void testLocalReceiveEmployee() + throws Exception + { + Node response = invoke("InheritanceService", + LocalTransportFactory.TRANSPORT_ID, + "ReceiveEmployee.xml"); + addNamespace("w", "urn:xfire:inheritance"); + assertValid("//s:Body/w:receiveUserResponse", response); + } + + public void testLocalGetEmployee() + throws Exception + { + Node response = invoke("InheritanceService", + LocalTransportFactory.TRANSPORT_ID, + "GetEmployee.xml"); + addNamespace("xsi", XmlConstants.XSI_NS); + addNamespace("w", "urn:xfire:inheritance"); + addNamespace("p", "http://inheritance.aegis.xfire.codehaus.org"); + assertValid("//s:Body/w:getEmployeeResponse/w:return/p:division", response); + assertValid("//s:Body/w:getEmployeeResponse/w:return[@xsi:type]", response); + } +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritancePOJOTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritancePOJOTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritanceService.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritanceService.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritanceService.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritanceService.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * + */ +package org.codehaus.xfire.aegis.inheritance; + +public class InheritanceService +{ + public BaseUser getEmployee() + { + Employee e = new Employee(); + e.setDivision("foo"); + e.setName("Dan D. Man"); + return e; + } + + public void receiveUser(BaseUser user) + { + InheritancePOJOTest.assertTrue(user instanceof Employee); + } +} \ No newline at end of file Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritanceService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/InheritanceService.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml Wed Mar 7 12:20:07 2007 @@ -0,0 +1,12 @@ + + + + + foo + bar + + + + Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/ReceiveEmployee.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/ChildImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/ChildImpl.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/ChildImpl.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/ChildImpl.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.xfire.aegis.inheritance.intf; + +public class ChildImpl implements IChild { + + public String getChildName() { + return "child"; + } + + public String getParentName() { + return "parent"; + } + +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/ChildImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/ChildImpl.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/GrandChildImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/GrandChildImpl.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/GrandChildImpl.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/GrandChildImpl.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.xfire.aegis.inheritance.intf; + +public class GrandChildImpl + implements IGrandChild +{ + + public String getChildName() + { + return "child"; + } + + public String getParentName() + { + return "parent"; + } + + public String getGrandChildName() + { + return "grandchild"; + } + +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/GrandChildImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/GrandChildImpl.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IChild.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IChild.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IChild.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IChild.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.xfire.aegis.inheritance.intf; + +public interface IChild extends IParent { + String getChildName(); +} Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IChild.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IChild.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IGrandChild.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IGrandChild.java?view=auto&rev=515734 ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IGrandChild.java (added) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/codehaus/xfire/aegis/inheritance/intf/IGrandChild.java Wed Mar 7 12:20:07 2007 @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.xfire.aegis.inheritance.intf; + +public interface IGrandChild extends IChild { + String getGrandChildName(); + + // make sure we don't get two getChildName props + String getChildName(); +}