rdonkin     2002/11/27 14:19:13

  Modified:    betwixt/src/java/org/apache/commons/betwixt
                        XMLIntrospector.java
               betwixt/src/test/org/apache/commons/betwixt
                        TestXMLIntrospector.java
               betwixt/src/test/org/apache/commons/betwixt/schema
                        TestSchema.java
  Added:       betwixt/src/java/org/apache/commons/betwixt/registry
                        DefaultXMLBeanInfoRegistry.java
                        NoCacheRegistry.java XMLBeanInfoRegistry.java
                        package.html
               betwixt/src/test/org/apache/commons/betwixt/registry
                        TestXMLBeanInfoRegistry.java
  Log:
  Added XMLBeanInfoRegistry feature. This interface decouples the XMLBeanInfo caching 
implementation. This is a good thing since as well as exotic user defined caches, it 
also allows users to safe add their own XMLBeanInfo classes to the cache 
programatically.
  
  Revision  Changes    Path
  1.11      +24 -14    
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java
  
  Index: XMLIntrospector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XMLIntrospector.java      26 Oct 2002 14:30:54 -0000      1.10
  +++ XMLIntrospector.java      27 Nov 2002 22:19:12 -0000      1.11
  @@ -82,6 +82,8 @@
   import org.apache.commons.betwixt.strategy.DefaultPluralStemmer;
   import org.apache.commons.betwixt.strategy.NameMapper;
   import org.apache.commons.betwixt.strategy.PluralStemmer;
  +import org.apache.commons.betwixt.registry.XMLBeanInfoRegistry;
  +import org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry;
   
   /** 
     * <p><code>XMLIntrospector</code> an introspector of beans to create a 
  @@ -114,11 +116,8 @@
       /** should we wrap collections in an extra element? */
       private boolean wrapCollectionsInElement = true;
       
  -    /** Is <code>XMLBeanInfo</code> caching enabled? */
  -    boolean cachingEnabled = true;
  -    
       /** Maps classes to <code>XMLBeanInfo</code>'s */
  -    protected Map cacheXMLBeanInfos = new HashMap();
  +    private XMLBeanInfoRegistry registry = new DefaultXMLBeanInfoRegistry();
       
       /** Digester used to parse the XML descriptor files */
       private XMLBeanInfoDigester digester;
  @@ -157,26 +156,39 @@
           this.log = log;
       }
       
  +    public XMLBeanInfoRegistry getRegistry() {
  +        return registry;
  +    }
  +    
  +    public void setRegistry(XMLBeanInfoRegistry registry) {
  +        this.registry = registry;
  +    }
  +    
  +    
       /** 
        * Is <code>XMLBeanInfo</code> caching enabled? 
  +     *
  +     * @deprecated replaced by XMlBeanInfoRegistry
        */
       public boolean isCachingEnabled() {
  -        return cachingEnabled;
  +        return true;
       }
   
       /**
        * Set whether <code>XMLBeanInfo</code> caching should be enabled.
  +     *
  +     * @deprecated replaced by XMlBeanInfoRegistry
        */    
       public void setCachingEnabled(boolean cachingEnabled) {
  -        this.cachingEnabled = cachingEnabled;
  +        //
       }
       
       /**
        * Flush existing cached <code>XMLBeanInfo</code>'s.
  +     *
  +     * @deprecated use flushable registry instead
        */
  -    public void flushCache() {
  -        cacheXMLBeanInfos.clear();
  -    }
  +    public void flushCache() {}
       
       /** Create a standard <code>XMLBeanInfo</code> by introspection
           The actual introspection depends only on the <code>BeanInfo</code>
  @@ -204,10 +216,8 @@
           }
           
           XMLBeanInfo xmlInfo = null;
  -        if ( cachingEnabled ) {
  -            // if caching is enabled, try in caching first
  -            xmlInfo = (XMLBeanInfo) cacheXMLBeanInfos.get( aClass );
  -        }
  +        // see if info's in registry
  +        xmlInfo = registry.get( aClass );
           if (xmlInfo == null) {
               // lets see if we can find an XML descriptor first
               if ( log.isDebugEnabled() ) {
  @@ -221,7 +231,7 @@
               }
               
               if (xmlInfo != null) {
  -                cacheXMLBeanInfos.put( aClass, xmlInfo );
  +                registry.put( aClass, xmlInfo );
               }
           } else {
               log.trace("Used cached XMLBeanInfo.");
  
  
  
  1.1                  
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/registry/DefaultXMLBeanInfoRegistry.java
  
  Index: DefaultXMLBeanInfoRegistry.java
  ===================================================================
  package org.apache.commons.betwixt.registry;
  
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Map;
  import java.util.HashMap;
  
  import org.apache.commons.betwixt.XMLBeanInfo;
  
  /** The default caching implementation.
    * A hashmap is used.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Robert Burrell Donkin</a>
    * @version $Id: DefaultXMLBeanInfoRegistry.java,v 1.1 2002/11/27 22:19:12 rdonkin 
Exp $
    */
  public class DefaultXMLBeanInfoRegistry implements XMLBeanInfoRegistry {
  
      /** Used to associated <code>XMLBeanInfo</code>'s to classes */
      private Map xmlBeanInfos = new HashMap();
      
      /**
        * Get from cache. 
        */
      public XMLBeanInfo get(Class forThisClass) {
          return (XMLBeanInfo) xmlBeanInfos.get(forThisClass);
      }
      
      /**
        * Put into cache
        */
      public void put(Class forThisClass, XMLBeanInfo beanInfo) {
          xmlBeanInfos.put(forThisClass, beanInfo);
      }
      
      /**
        * Flush existing cached <code>XMLBeanInfo</code>'s.
        */
      public void flush() {
          xmlBeanInfos.clear();
      }
  }
  
  
  
  1.1                  
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/registry/NoCacheRegistry.java
  
  Index: NoCacheRegistry.java
  ===================================================================
  package org.apache.commons.betwixt.registry;
  
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import org.apache.commons.betwixt.XMLBeanInfo;
  
  /** This plug-in registry does not cache at all.
    * In effect, this turns caching off.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Robert Burrell Donkin</a>
    * @version $Id: NoCacheRegistry.java,v 1.1 2002/11/27 22:19:12 rdonkin Exp $
    */
  public final class NoCacheRegistry implements XMLBeanInfoRegistry {
      
      /** Always return null.
        *
        * return <code>null</code>
        */
      public XMLBeanInfo get(Class forThisClass) {
          return null;
      }
      
      /** Do nothing */
      public void put(Class forThisClass, XMLBeanInfo beanInfo) {}
  }
  
  
  
  1.1                  
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/registry/XMLBeanInfoRegistry.java
  
  Index: XMLBeanInfoRegistry.java
  ===================================================================
  package org.apache.commons.betwixt.registry;
  
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import org.apache.commons.betwixt.XMLBeanInfo;
  
  /** <p>Plug in registry for <code>XMLBeanInfo</code>'s.</p>
    * 
    * <p>This decouples the implementation of the <code>XMLBeanInfo</code> cache.
    * Users can plug in the standard implementations found 
    * in this package to switch caching on and off.
    * Alternatively, they can plug-in an exotic cache of their own devising.</p>
    *
    * <p>Users can also prime a cache with <code>XMLBeanInfo</code>
    * classes created programmatically.</p>
    *
    * <p>To find a <code>XMLBeanInfo</code> for a class,
    * <code>XMLIntrospector</code> checks in the registry first 
    * before starting introspection.
    * If the registry returns an <code>XMLBeanInfo</code>, then that's used.
    * Otherwise, the <code>XMLBeanInfo</code> will be found by standard introspection
    * and then {@link #put} will be called so that the registry 
    * can cache - if it wished - the <code>XMLBeanInfo</code>. 
    * </p>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Robert Burrell Donkin</a>
    * @version $Id: XMLBeanInfoRegistry.java,v 1.1 2002/11/27 22:19:12 rdonkin Exp $
    */
  public interface XMLBeanInfoRegistry {
      
      /** 
        * Get the <code>XMLBeanInfo</code> for the given class.
        *
        * @param forThisClass get <code>XMLBeanInfo</code> for this class
        *
        * @return <code>null</code> if fresh introspection should be used to find the 
<code>XMLBeanInfo</code>
        */
      public XMLBeanInfo get(Class forThisClass);
      
      /**
        * Associate a class with it's <code>XMLBeanInfo</code>.
        */
      public void put(Class forThisClass, XMLBeanInfo beanInfo);
  }
  
  
  
  1.1                  
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/registry/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  </head>
  <body>
  
    <p>This package contains various plugins that can be used with 
<code>XMLIntrospector</code> 
    to customize it's caching behaviour (or programmatically modify the XmlBeanInfo 
finding).
    </p>
    
  </body>
  </html>
  
  
  
  1.2       +8 -3      
jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java
  
  Index: TestXMLIntrospector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestXMLIntrospector.java  10 Jun 2002 17:53:32 -0000      1.1
  +++ TestXMLIntrospector.java  27 Nov 2002 22:19:12 -0000      1.2
  @@ -68,6 +68,9 @@
   import junit.framework.TestSuite;
   import junit.textui.TestRunner;
   
  +import org.apache.commons.betwixt.registry.NoCacheRegistry;
  +import org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry;
  +
   
   /** Test harness for the XMLIntrospector
     *
  @@ -121,7 +124,8 @@
   
   
           // test introspection with caching off      
  -        introspector.setCachingEnabled(false);  
  +        //introspector.setCachingEnabled(false);  
  +        introspector.setRegistry(new NoCacheRegistry());
           info = introspector.introspect( bean );
           
           assertTrue( "Found XMLBeanInfo", info != null );
  @@ -136,8 +140,9 @@
   
   
           // test introspection after flushing cache
  -        introspector.setCachingEnabled(true); 
  -        introspector.flushCache();
  +//        introspector.setCachingEnabled(true);
  +        introspector.setRegistry(new DefaultXMLBeanInfoRegistry()); 
  +        //introspector.flushCache();
           info = introspector.introspect( bean );
           
           assertTrue( "Found XMLBeanInfo", info != null );
  
  
  
  1.1                  
jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/registry/TestXMLBeanInfoRegistry.java
  
  Index: TestXMLBeanInfoRegistry.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/registry/TestXMLBeanInfoRegistry.java,v
 1.1 2002/11/27 22:19:12 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/11/27 22:19:12 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: TestXMLBeanInfoRegistry.java,v 1.1 2002/11/27 22:19:12 rdonkin Exp $
   */
  package org.apache.commons.betwixt.registry;
  
  import java.io.FileInputStream;
  import java.io.InputStream;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  
  import org.apache.commons.betwixt.XMLBeanInfo;
  import org.apache.commons.betwixt.AbstractTestCase;
  
  /** Test harness for the XMLBeanInfoRegistry
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Robert Burrell Donkin</a>
    * @version $Revision: 1.1 $
    */
  public class TestXMLBeanInfoRegistry extends AbstractTestCase {
      
      public static void main( String[] args ) {
          TestRunner.run( suite() );
      }
      
      public static Test suite() {
          return new TestSuite(TestXMLBeanInfoRegistry.class);
      }
          
      public TestXMLBeanInfoRegistry(String testName) {
          super(testName);
      }
      
      public void testNoCache() throws Exception {
          XMLBeanInfoRegistry registry = new NoCacheRegistry();
          
          XMLBeanInfo xbi = new XMLBeanInfo(Long.class);
          
          assertNull("No cache XML register (1)", registry.get(Long.class));
          
          registry.put(Long.class, xbi);
          
          assertNull("No cache XML register (2)", registry.get(Long.class));
      }
      
      public void testDefault() throws Exception {
          
          XMLBeanInfoRegistry registry = new DefaultXMLBeanInfoRegistry();
          
          XMLBeanInfo xbi = new XMLBeanInfo(Long.class);
          
          assertNull("Default XML register (1)", registry.get(Long.class));
          
          registry.put(Long.class, xbi);
          
          assertEquals("Default XML register (2)", xbi, registry.get(Long.class));
      }   
  }
  
  
  
  
  1.4       +4 -1      
jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/TestSchema.java
  
  Index: TestSchema.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/TestSchema.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestSchema.java   27 Oct 2002 00:39:00 -0000      1.3
  +++ TestSchema.java   27 Nov 2002 22:19:12 -0000      1.4
  @@ -73,6 +73,7 @@
   import org.apache.commons.betwixt.io.BeanWriter;
   import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper;
   import org.apache.commons.betwixt.strategy.HyphenatedNameMapper;
  +import org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry;
   
   
   /**
  @@ -113,13 +114,15 @@
           StringReader in = new StringReader(buffer.getBuffer().toString());
           reader = createBeanReader();
           XMLIntrospector intro = createXMLIntrospector();
  +        DefaultXMLBeanInfoRegistry registry = new DefaultXMLBeanInfoRegistry();
  +        intro.setRegistry(registry);
           // we have written the xml file back with element collections,
           // so we have to say to the reader we want to use that now
           // (the default when creating in this test is not to use them)
           intro.setWrapCollectionsInElement(true);
           // first flush the cash, else setting other options, doesn't
           // end up in rereading / mapping the object model.
  -        intro.flushCache();
  +        registry.flush();
           // set the xmlIntrospector back to the reader
           reader.setXMLIntrospector(intro);
           PhysicalSchema schemaSecond = (PhysicalSchema) reader.parse(in);
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to