Package org.apache.commons.betwixt

Examples of org.apache.commons.betwixt.XMLIntrospector$DynaClassBeanType


        assertEquals("beta", attributes[0].getLocalName());
    }
   
    //TODO: complete these tests after refactoring the element descriptors produced is complete
    public void _testAddDefaults() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        XMLBeanInfo beanInfo = introspector.introspect(LibraryBean.class);
        ElementDescriptor libraryDescriptor = beanInfo.getElementDescriptor();
       
        AttributeDescriptor[] libraryAttributeDescriptors = libraryDescriptor.getAttributeDescriptors();
        assertEquals("Only one attribute", 1, libraryAttributeDescriptors.length);
       
View Full Code Here


        super(name);
    }
   
    /** Tests whether a standard property's ElementDescriptor is hollow (as expected) */
    public void testStandardPropertyIsHollow() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setAttributesForPrimitives(true);
        XMLBeanInfo out = introspector.introspect(CompanyBean.class);
       
        ElementDescriptor companyBeanDescriptor = out.getElementDescriptor();
        ElementDescriptor[] childDescriptors = companyBeanDescriptor.getElementDescriptors();
        assertEquals("Correct number of child descriptors", 1, childDescriptors.length);
       
View Full Code Here

    }
   

    /** Tests whether a simple element's ElementDescriptor is hollow */
    public void testSimpleElementIsHollow() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setAttributesForPrimitives(false);
        XMLBeanInfo out = introspector.introspect(CompanyBean.class);
       
        ElementDescriptor companyBeanDescriptor = out.getElementDescriptor();
        ElementDescriptor[] childDescriptors = companyBeanDescriptor.getElementDescriptors();
        assertEquals("Correct number of child descriptors", 2, childDescriptors.length);
       
View Full Code Here

        assertNotNull("Expected to find an element descriptor for 'name'", nameDescriptor);
        assertFalse("Expected simple element not to be hollow", nameDescriptor.isHollow());
    }
   
    public void testWrappedCollective() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setWrapCollectionsInElement(true);
        introspector.getConfiguration().setAttributesForPrimitives(true);
        XMLBeanInfo out = introspector.introspect(PhoneBookBean.class);
       
        // with wrapped collective, we expect a spacer element descriptor
        // (for the collective) containing a single collective descriptor
        ElementDescriptor phoneBookBeanDescriptor = out.getElementDescriptor();
        ElementDescriptor[] phoneBookChildDescriptors = phoneBookBeanDescriptor.getElementDescriptors();
View Full Code Here

        assertEquals("Collective element name should match adder", "number" , hollowPhoneNumberDescriptor.getQualifiedName());

    }
   
    public void testUnwrappedCollective() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setWrapCollectionsInElement(false);
        introspector.getConfiguration().setAttributesForPrimitives(true);
        XMLBeanInfo out = introspector.introspect(PhoneBookBean.class);
       
        // with wrapped collective, we expect a spacer element descriptor
        // (for the collective) containing a single collective descriptor
        ElementDescriptor phoneBookBeanDescriptor = out.getElementDescriptor();
        ElementDescriptor[] phoneBookChildDescriptors = phoneBookBeanDescriptor.getElementDescriptors();
View Full Code Here

                    hollowPhoneNumberDescriptor.getSingularPropertyType());
        assertEquals("Collective element name should match adder", "number" , hollowPhoneNumberDescriptor.getQualifiedName());
    }
   
    public void testUnwrappedMap() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setWrapCollectionsInElement(false);
        introspector.getConfiguration().setAttributesForPrimitives(true);
        XMLBeanInfo out = introspector.introspect(DateFormatterBean.class);
       
        ElementDescriptor formatterDescriptor = out.getElementDescriptor();
        ElementDescriptor[] formatterChildDescriptors = formatterDescriptor.getElementDescriptors();
       
        assertEquals("Only one top level child", 1, formatterChildDescriptors.length);
View Full Code Here

        assertTrue("Is not simple therefore hollow",  valueDescriptor.isHollow());
        assertNotNull("Value should have an updater", valueDescriptor.getUpdater());
    }
   
    public void testWrappedMap() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setWrapCollectionsInElement(true);
        introspector.getConfiguration().setAttributesForPrimitives(true);
        XMLBeanInfo out = introspector.introspect(DateFormatterBean.class);
       
        ElementDescriptor formatterDescriptor = out.getElementDescriptor();
        ElementDescriptor[] formatterChildDescriptors = formatterDescriptor.getElementDescriptors();
       
        assertEquals("Only one top level child", 1, formatterChildDescriptors.length);
View Full Code Here

        assertTrue("Is not simple therefore hollow",  valueDescriptor.isHollow());
        assertNotNull("Value should have an updater", valueDescriptor.getUpdater());
    }
   
    public void testIsSimpleForPrimitives() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setWrapCollectionsInElement(true);
        introspector.getConfiguration().setAttributesForPrimitives(false);
        XMLBeanInfo out = introspector.introspect(PhoneNumberBean.class);
       
        // the bean is mapped to a complex type structure and so should not be simple
        ElementDescriptor phoneNumberDescriptor = out.getElementDescriptor();
       
        assertFalse("Phone number descriptor is complex", phoneNumberDescriptor.isSimple());
View Full Code Here

import org.apache.commons.betwixt.io.read.AddressBean;

public class TestValueSuppressionStrategy extends TestCase {

    public void testALLOW_ALL_VALUESStrategy() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setAttributesForPrimitives(true);
        XMLBeanInfo beanInfo = introspector.introspect(AddressBean.class);
        AttributeDescriptor[] descriptors = beanInfo.getElementDescriptor().getAttributeDescriptors();
        assertTrue(descriptors.length>0);
        for (int i=0;i<descriptors.length;i++)
        {
            assertFalse(ValueSuppressionStrategy.ALLOW_ALL_VALUES.suppressAttribute(descriptors[i], "Arbitrary Value"));
View Full Code Here

        assertTrue("Descriptor " + phoneNumberChildDescriptors[2] + " should be simple",
                    phoneNumberChildDescriptors[2].isSimple());
    }
   
    public void testSimpleForRSS() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setWrapCollectionsInElement(true);
        introspector.getConfiguration().setAttributesForPrimitives(false);
        XMLBeanInfo out = introspector.introspect(Channel.class);
       
        ElementDescriptor channelDescriptor = out.getElementDescriptor();
        ElementDescriptor[] childNodesOfRSS = channelDescriptor.getElementDescriptors();
        assertEquals("RSS has only one child, channel", 1, childNodesOfRSS.length);
        ElementDescriptor[] childNodesOfChannel = childNodesOfRSS[0].getElementDescriptors();
View Full Code Here

TOP

Related Classes of org.apache.commons.betwixt.XMLIntrospector$DynaClassBeanType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.