rdonkin 02/02/09 04:05:23 Modified: betwixt/src/test/org/apache/commons/betwixt TestXMLIntrospector.java Log: Added some testing code for XMLBenInfo caching Revision Changes Path 1.6 +50 -5 jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java Index: TestXMLIntrospector.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestXMLIntrospector.java 31 Jan 2002 19:56:03 -0000 1.5 +++ TestXMLIntrospector.java 9 Feb 2002 12:05:23 -0000 1.6 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java,v 1.5 2002/01/31 19:56:03 jstrachan Exp $ - * $Revision: 1.5 $ - * $Date: 2002/01/31 19:56:03 $ + * $Header: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java,v 1.6 2002/02/09 12:05:23 rdonkin Exp $ + * $Revision: 1.6 $ + * $Date: 2002/02/09 12:05:23 $ * * ==================================================================== * @@ -57,7 +57,7 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * - * $Id: TestXMLIntrospector.java,v 1.5 2002/01/31 19:56:03 jstrachan Exp $ + * $Id: TestXMLIntrospector.java,v 1.6 2002/02/09 12:05:23 rdonkin Exp $ */ package org.apache.commons.betwixt; @@ -72,7 +72,7 @@ /** Test harness for the XMLIntrospector * * @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a> - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public class TestXMLIntrospector extends AbstractTestCase { @@ -104,6 +104,51 @@ 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(); + + assertTrue( "Found root element descriptor", descriptor != null ); + + attributes = descriptor.getAttributeDescriptors(); + + assertTrue( "Found attributes", attributes != null && attributes.length > 0 ); + + + // test introspection with caching off + introspector.setCachingEnabled(false); + info = introspector.introspect( bean ); + + assertTrue( "Found XMLBeanInfo", info != null ); + + descriptor = info.getElementDescriptor(); + + assertTrue( "Found root element descriptor", descriptor != null ); + + attributes = descriptor.getAttributeDescriptors(); + + assertTrue( "Found attributes", attributes != null && attributes.length > 0 ); + + + // test introspection after flushing cache + introspector.setCachingEnabled(true); + introspector.flushCache(); + info = introspector.introspect( bean ); + + assertTrue( "Found XMLBeanInfo", info != null ); + + descriptor = info.getElementDescriptor(); + + assertTrue( "Found root element descriptor", descriptor != null ); + + attributes = descriptor.getAttributeDescriptors(); + + assertTrue( "Found attributes", attributes != null && attributes.length > 0 ); + } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>