Package org.apache.commons.betwixt

Examples of org.apache.commons.betwixt.XMLIntrospector.introspect()


        AttributeDescriptor[] attributes = descriptor.getAttributeDescriptors();
       
        assertTrue( "Found attributes", attributes != null && attributes.length > 0 );
       
        // test second introspection with caching on
        info = introspector.introspect( bean );
       
        assertTrue( "Found XMLBeanInfo", info != null );
       
        descriptor = info.getElementDescriptor();
       
View Full Code Here



        // test introspection with caching off     
        //introspector.setCachingEnabled(false); 
        introspector.setRegistry(new NoCacheRegistry());
        info = introspector.introspect( bean );
       
        assertTrue( "Found XMLBeanInfo", info != null );
       
        descriptor = info.getElementDescriptor();
       
View Full Code Here

        // test introspection after flushing cache
//        introspector.setCachingEnabled(true);
        introspector.setRegistry(new DefaultXMLBeanInfoRegistry());
        //introspector.flushCache();
        info = introspector.introspect( bean );
       
        assertTrue( "Found XMLBeanInfo", info != null );
       
        descriptor = info.getElementDescriptor();
       
View Full Code Here

        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setAttributesForPrimitives(false);
//        introspector.setLog(log);
       
        XMLBeanInfo xmlBeanInfo = introspector.introspect(BeanWithBeanInfoBean.class);
       
        ElementDescriptor[] elementDescriptors = xmlBeanInfo.getElementDescriptor().getElementDescriptors();
       
//        log = new SimpleLog("[testBeanWithBeanInfo]");
//        log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
View Full Code Here

   
    public void testDefaultClassNormalizer() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
       
        FaceImpl face = new FaceImpl();
        XMLBeanInfo info = introspector.introspect( face );
        ElementDescriptor elementDescriptor = info.getElementDescriptor();
   
        AttributeDescriptor[] attributeDescriptor = elementDescriptor.getAttributeDescriptors();     
        ElementDescriptor[] children = elementDescriptor.getElementDescriptors();
       
View Full Code Here

                    return super.normalize( clazz );
               
            });
       
        FaceImpl face = new FaceImpl();
        XMLBeanInfo info = introspector.introspect( face );
        ElementDescriptor elementDescriptor = info.getElementDescriptor();
        assertEquals("Expected only itself", 1, elementDescriptor.getElementDescriptors().length);
   
        AttributeDescriptor[] attributeDescriptor = elementDescriptor.getAttributeDescriptors();     
        ElementDescriptor[] children = elementDescriptor.getElementDescriptors();
View Full Code Here

        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setClassNormalizer(classNormalizer);
       
        FaceImpl face = new FaceImpl();
       
        XMLBeanInfo info = introspector.introspect( face );
        ElementDescriptor elementDescriptor = info.getElementDescriptor();
        AttributeDescriptor[] attributeDescriptor = elementDescriptor.getAttributeDescriptors();     
        ElementDescriptor[] children = elementDescriptor.getElementDescriptors();
       
        assertEquals("Expected no attributes", 0, attributeDescriptor.length);
View Full Code Here

                            true);
   
   
    public void testBetwixtFileType() throws Exception {
      XMLIntrospector introspector = new XMLIntrospector();
      XMLBeanInfo info = introspector.introspect( Channel.class );
     
      ElementDescriptor elementDescriptor = info.getElementDescriptor();
     
    Class clazz = elementDescriptor.getSingularPropertyType();
    assertEquals( "Element type correct", Channel.class , clazz);
View Full Code Here

   
    public void testIgnoreAllBeanInfo() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setIgnoreAllBeanInfo( false );
        introspector.setRegistry(new NoCacheRegistry());
        XMLBeanInfo info = introspector.introspect( BeanWithBeanInfoBean.class );
        ElementDescriptor[] elementDescriptors = info.getElementDescriptor().getElementDescriptors();
        // When BeanInfo is used the properties alpha and gamma will be found
        if ("alpha".equals(elementDescriptors[0].getPropertyName())) {
            assertEquals("Second element name", "gamma" , elementDescriptors[1].getPropertyName());
        } else {
View Full Code Here

            assertEquals("First element name", "gamma" , elementDescriptors[0].getPropertyName());
            assertEquals("Second element name", "alpha" , elementDescriptors[1].getPropertyName());
        }

        introspector.getConfiguration().setIgnoreAllBeanInfo( true );
        info = introspector.introspect( BeanWithBeanInfoBean.class );
        elementDescriptors = info.getElementDescriptor().getElementDescriptors();
        // When BeanInfo is ignored the properties alpha and beta will be found
        if ("alpha".equals(elementDescriptors[0].getPropertyName())) {
            assertEquals("Second element name", "beta" , elementDescriptors[1].getPropertyName());
        } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.