You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2004/01/03 00:32:39 UTC

cvs commit: incubator-geronimo/modules/core/src/test-data/xml/deployment resolver-catalog.xml

djencks     2004/01/02 15:32:39

  Modified:    modules/core project.xml
               modules/core/src/conf boot-service.xml
               modules/core/src/java/org/apache/geronimo/xml/deployment
                        AppClientLoader.java LoaderUtil.java
                        LocalEntityResolver.java StorerUtil.java
               modules/core/src/test/org/apache/geronimo/security
                        EjbModuleConfigurationTest.java
                        WebModuleConfigurationTest.java
               modules/core/src/test/org/apache/geronimo/xml/deployment
                        AppClientLoaderTest.java ConnectorLoaderTest.java
                        EjbJarLoaderTest.java EjbJarStorerTest.java
                        EntityResolverTest.java
                        GeronimoAppClientLoaderTest.java
                        GeronimoConnectorLoaderTest.java
                        GeronimoEjbJarLoaderTest.java
                        GeronimoEjbJarStorerTest.java
  Added:       modules/core/src/conf resolver-catalog.xml
               modules/core/src/test/org/apache/geronimo/xml/deployment
                        AbstractLoaderUtilTest.java
               modules/core/src/test-data/xml/deployment
                        resolver-catalog.xml
  Log:
  Most of Geronimo-133. We will see if it is sufficient
  
  Revision  Changes    Path
  1.31      +13 -2     incubator-geronimo/modules/core/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/project.xml,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- project.xml	10 Dec 2003 10:54:07 -0000	1.30
  +++ project.xml	2 Jan 2004 23:32:38 -0000	1.31
  @@ -150,7 +150,7 @@
                   <module>true</module>
               </properties>
           </dependency>
  -        
  +
           <dependency>
               <groupId>geronimo-spec</groupId>
               <artifactId>geronimo-spec-servlet</artifactId>
  @@ -326,6 +326,17 @@
                   <runtime>true</runtime>
               </properties>
           </dependency>
  +
  +        <dependency>
  +            <id>xml-commons-resolver</id>
  +            <artifactId>xml-commons-resolver</artifactId>
  +            <version>1.1</version>
  +            <url>http://xml.apache.org/commons</url>
  +            <properties>
  +                <runtime>true</runtime>
  +            </properties>
  +        </dependency>
  +
   
       </dependencies>
   
  
  
  
  1.25      +25 -8     incubator-geronimo/modules/core/src/conf/boot-service.xml
  
  Index: boot-service.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/conf/boot-service.xml,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- boot-service.xml	9 Dec 2003 04:20:48 -0000	1.24
  +++ boot-service.xml	2 Jan 2004 23:32:38 -0000	1.25
  @@ -9,16 +9,33 @@
           </codebase>
       </class-space>
   
  +	<!-- Entity Resolver -->
  +    <mbean descriptor="org.apache.geronimo.xml.deployment.LocalEntityResolver"
  +           name="geronimo.xml:role=EntityResolver">
   
  -    <mbean code="org.apache.geronimo.xml.deployment.LocalEntityResolver" name="geronimo.xml:role=LocalEntityResolver">
           <constructor>
  -            <arg type="java.io.File">
  -                src/schema
  -            </arg>
  +        	<!--
  +             CatalogFile:
  +             Name of the catalog file to use.
  +             The catalog resolving is based on the OASIS XML Catalog Standard.
  +            -->
  +            <arg type="java.lang.String">${geronimo.home}/etc/resolver-catalog.xml</arg>
  +
  +            <!--
  +             LocalRepository:
  +             Directory containing dtd and xsd files for entity resolving
  +            -->
  +            <arg type="java.lang.String">${geronimo.home}/etc/xml</arg>
  +
  +            <!--
  +             FailOnUnresolvable:
  +             Flag indicating if the resolver may return null to signal
  +		     the parser to open a regular URI connection to the (given)
  +		     system identifier. Otherwise an exception is thrown.
  +		    -->
  +            <arg type="boolean">false</arg>
           </constructor>
  -        <attribute name="ConfigFile">
  -            ${geronimo.home}/etc/resolver.properties
  -        </attribute>
  +
       </mbean>
   
       <!-- Log4j Logging Service -->
  
  
  
  1.1                  incubator-geronimo/modules/core/src/conf/resolver-catalog.xml
  
  Index: resolver-catalog.xml
  ===================================================================
  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  
      <!--public publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
              uri="xml/web-app_2_3.dtd"/>
  
      <public publicId="http://java.sun.com/xml/ns/j2ee"
              uri="j2ee_1_4.xsd"/-->
  
  </catalog>
  
  
  1.6       +2 -2      incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/AppClientLoader.java
  
  Index: AppClientLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/AppClientLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AppClientLoader.java	7 Dec 2003 03:39:05 -0000	1.5
  +++ AppClientLoader.java	2 Jan 2004 23:32:38 -0000	1.6
  @@ -65,7 +65,7 @@
    * @version $Revision$ $Date$
    */
   public class AppClientLoader {
  -    public ApplicationClient load(Document doc) {
  +    public static ApplicationClient load(Document doc) {
           Element root = doc.getDocumentElement();
           if (!"application-client".equals(root.getLocalName())) {
               throw new IllegalArgumentException("Document is not an application-client instance");
  
  
  
  1.11      +78 -8     incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/LoaderUtil.java
  
  Index: LoaderUtil.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/LoaderUtil.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LoaderUtil.java	1 Jan 2004 22:42:48 -0000	1.10
  +++ LoaderUtil.java	2 Jan 2004 23:32:38 -0000	1.11
  @@ -64,12 +64,19 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  +import org.xml.sax.ErrorHandler;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
  +import org.xml.sax.EntityResolver;
  +
  +import org.apache.xerces.parsers.DOMParser;
   
   /**
    * Holds utility methods for parsing a DOM tree.
  @@ -78,6 +85,14 @@
    */
   public final class LoaderUtil {
   
  +    private static final Log log = LogFactory.getLog(LoaderUtil.class);
  +
  +    private static EntityResolver entityResolver;
  +
  +    public static void setEntityResolver(EntityResolver entityResolver) {
  +        LoaderUtil.entityResolver = entityResolver;
  +    }
  +
       public static String getContent(Element element) {
           if (element == null) {
               return null;
  @@ -89,7 +104,9 @@
               Node node = (Node) nodes.removeFirst();
               switch (node.getNodeType()) {
                   case Node.ELEMENT_NODE:
  -                    for (Node child = node.getLastChild(); child != null; child = child.getPreviousSibling()) {
  +                    for (Node child = node.getLastChild();
  +                         child != null;
  +                         child = child.getPreviousSibling()) {
                           nodes.addFirst(child);
                       }
                       break;
  @@ -118,7 +135,9 @@
           if (element == null || child == null) {
               return null;
           }
  -        for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) {
  +        for (Node node = element.getFirstChild();
  +             node != null;
  +             node = node.getNextSibling()) {
               if (node instanceof Element == false) {
                   continue;
               }
  @@ -143,7 +162,8 @@
           LinkedList list = new LinkedList();
           for (int i = 0; i < max; i++) {
               Node n = nl.item(i);
  -            if (n.getNodeType() == Node.ELEMENT_NODE && n.getLocalName().equals(childName)) {
  +            if (n.getNodeType() == Node.ELEMENT_NODE
  +                    && n.getLocalName().equals(childName)) {
                   list.add(n);
               }
           }
  @@ -189,19 +209,69 @@
        * @throws SAXException if there was a parsing problem
        * @throws IOException if there was a problem reading the input
        */
  -    public static Document parseXML(Reader reader) throws SAXException, IOException {
  +    public static Document parseXML2(Reader reader)
  +            throws SAXException, IOException {
  +        DOMParser parser = new DOMParser();
  +        parser.setFeature("http://xml.org/sax/features/validation", true);
  +        parser.setFeature(
  +                "http://apache.org/xml/features/validation/schema",
  +                true);
  +        parser.setEntityResolver(entityResolver);
  +        parser.setErrorHandler(new ErrorHandler() {
  +            public void error(SAXParseException exception)
  +                    throws SAXException {
  +                log.warn("SAX parse error (ignored)", exception);
  +                //throw exception;
  +            }
  +
  +            public void fatalError(SAXParseException exception)
  +                    throws SAXException {
  +                log.warn("Fatal SAX parse error (ignored)", exception);
  +                //throw exception;
  +            }
  +
  +            public void warning(SAXParseException exception)
  +                    throws SAXException {
  +                log.warn("SAX parse warning", exception);
  +            }
  +        });
  +        parser.parse(new InputSource(new BufferedReader(reader)));
  +        return parser.getDocument();
  +    }
  +
  +    //It looks to me as if this does the same things, but with jaxp.
  +    public static Document parseXML(Reader reader)
  +            throws SAXException, IOException {
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setNamespaceAware(true);
           factory.setValidating(true);
  -        factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
  +        factory.setAttribute(
  +                "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
                   "http://www.w3.org/2001/XMLSchema");
           try {
               DocumentBuilder builder = factory.newDocumentBuilder();
  -            builder.setEntityResolver(new LocalEntityResolver());
  +            builder.setEntityResolver(entityResolver);
  +            builder.setErrorHandler(new ErrorHandler() {
  +                public void error(SAXParseException exception)
  +                        throws SAXException {
  +                    log.warn("SAX parse error (ignored)", exception);
  +                    //throw exception;
  +                }
  +
  +                public void fatalError(SAXParseException exception)
  +                        throws SAXException {
  +                    log.warn("Fatal SAX parse error (ignored)", exception);
  +                    //throw exception;
  +                }
  +
  +                public void warning(SAXParseException exception)
  +                        throws SAXException {
  +                    log.warn("SAX parse warning", exception);
  +                }
  +            });
               return builder.parse(new InputSource(new BufferedReader(reader)));
           } catch (ParserConfigurationException e) {
               throw new AssertionError("Unable to obtain suitable DocumentBuilder");
           }
       }
   }
  -
  
  
  
  1.6       +341 -120  incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/LocalEntityResolver.java
  
  Index: LocalEntityResolver.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/LocalEntityResolver.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LocalEntityResolver.java	9 Dec 2003 04:19:38 -0000	1.5
  +++ LocalEntityResolver.java	2 Jan 2004 23:32:38 -0000	1.6
  @@ -57,14 +57,24 @@
   
   import java.io.BufferedInputStream;
   import java.io.File;
  -import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.InputStream;
  -import java.util.Hashtable;
  -import java.util.Properties;
  +import java.net.MalformedURLException;
  +import java.net.URI;
  +import java.net.URISyntaxException;
  +import java.net.URL;
  +import java.util.Vector;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.xml.resolver.Catalog;
  +import org.apache.xml.resolver.CatalogEntry;
  +import org.apache.xml.resolver.CatalogException;
  +import org.apache.xml.resolver.CatalogManager;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
  +import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
  +import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
   import org.xml.sax.EntityResolver;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  @@ -72,171 +82,382 @@
   /**
    * Implementation of EntityResolver that looks to the local filesystem.
    *
  - * @jmx:mbean
  + * The implementation tries to resolve an entity via the following steps:
  + *
  + * <ul>
  + *   <li>using a catalog file</li>
  + *   <li>using a local repository</li>
  + *   <li>using JAR files in Classpath</li>
  + * </ul>
  + *
  + * The catalog resolving is based on the OASIS XML Catalog Standard.
  + * (see http://www.oasis-open.org/committees/entity/spec-2001-08-01.html
  + * and http://www.oasis-open.org/html/a401.htm)
    *
    * @version $Revision$ $Date$
    */
  -public class LocalEntityResolver implements EntityResolver, LocalEntityResolverMBean {
  +public class LocalEntityResolver implements EntityResolver {
  +
  +    /**
  +     * used Logger
  +     */
       private static final Log log = LogFactory.getLog(LocalEntityResolver.class);
  -    private File root;
  -    private String configFile;
  -    private Properties mappings = new Properties();
   
       /**
  -     * @jmx:managed-constructor
  +     * The used Catalog Manager
  +     */
  +    private final CatalogManager manager = new CatalogManager();
  +
  +    /**
  +     * the XML Catalog
  +     */
  +    private Catalog catalog = null;
  +
  +    /**
  +     * the URI of the catalog file
  +     */
  +    private URI catalogFileURI = null;
  +
  +    /**
  +     * Local Repository where DTDs and Schemas are located
  +     */
  +    private String localRepository = null;
  +
  +    /**
  +     * Flag indicating if this resolver may return null to signal
  +     * the parser to open a regular URI connection to the system
  +     * identifier. Otherwise an exception is thrown.
  +     */
  +    private boolean failOnUnresolvable = false;
  +
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
  +        mbeanInfo.setTargetClass(LocalEntityResolver.class);
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("FailOnUnresolvable", true, true, "Should null be returned or an exception thrown when an entity cannot be resolved"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("LocalRepository", true, true, "Location of dtds and schemas"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("CatalogFile", true, true, "Location of xml catalog file"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("resolveEntity", new GeronimoParameterInfo[]{
  +            new GeronimoParameterInfo("PublicID", String.class, "PublicID of entity to resolve"),
  +            new GeronimoParameterInfo("SystemID", String.class, "SystemID of entity to resolve")},
  +                GeronimoOperationInfo.ACTION,
  +                "resolve supplied entity"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("addPublicMapping", new GeronimoParameterInfo[]{
  +            new GeronimoParameterInfo("PublicID", String.class, "PublicID to map"),
  +            new GeronimoParameterInfo("URI", String.class, "Actual location of dtd/schema")},
  +                GeronimoOperationInfo.ACTION,
  +                "resolve supplied entity"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("addSystemMapping", new GeronimoParameterInfo[]{
  +            new GeronimoParameterInfo("SystemID", String.class, "SystemID to map"),
  +            new GeronimoParameterInfo("URI", String.class, "Actual location of dtd/schema")},
  +                GeronimoOperationInfo.ACTION,
  +                "resolve supplied entity"));
  +        mbeanInfo.setAutostart(true);
  +        return mbeanInfo;
  +    }
  +
  +    public LocalEntityResolver(String catalogFile, String localRepository, boolean failOnUnresolvable) {
  +        setLocalRepository(localRepository);
  +        setFailOnUnresolvable(failOnUnresolvable);
  +        setCatalogFile(catalogFile);
  +        LoaderUtil.setEntityResolver(this);
  +        StorerUtil.setEntityResolver(this);
  +    }
  +
  +    /**
  +     * Sets the setFailOnUnresolvable flag.
  +     *
  +     * @param b value (true means that a SAXException is thrown
  +     * if the entity could not be resolved)
        */
  -    public LocalEntityResolver(File root) {
  -        this.root = root;
  -        log.info("root=" + root);
  +    public void setFailOnUnresolvable(final boolean b) {
  +        failOnUnresolvable = b;
  +    }
  +
  +    public boolean isFailOnUnresolvable() {
  +        return failOnUnresolvable;
       }
   
  -    public LocalEntityResolver() {
  -        root = null;
  +    public void setCatalogFile(final String catalogFile) {
  +
  +        try {
  +            URL url = new URL(catalogFile);
  +            this.catalogFileURI = new URI(url.toExternalForm());
  +        } catch (MalformedURLException e) {
  +            throw new IllegalArgumentException("could not parse url: " + catalogFile);
  +        } catch (URISyntaxException e) {
  +            throw new IllegalArgumentException("could not parse url: " + catalogFile);
  +        }
  +
           init();
       }
   
  -    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
  -        InputSource is = null;
  +    public String getCatalogFile() {
  +        if (catalogFileURI != null) {
  +            return this.catalogFileURI.toString();
  +        }
  +        return null;
  +    }
  +
  +    public String getLocalRepository() {
  +        return localRepository;
  +    }
  +
  +    public void setLocalRepository(String string) {
  +        localRepository = string;
  +    }
  +
  +    public void addPublicMapping(final String publicId, final String uri) {
  +
  +        Vector args = new Vector();
  +        args.add(publicId);
  +        args.add(uri);
  +
  +        addEntry("PUBLIC", args);
  +
  +    }
  +
  +    public void addSystemMapping(final String systemId, final String uri) {
  +
  +        Vector args = new Vector();
  +        args.add(systemId);
  +        args.add(uri);
  +
  +        addEntry("SYSTEM", args);
  +
  +    }
  +
  +    /**
  +     * Attempt to resolve the entity based on the supplied publicId and systemId.
  +     * First the catalog is queried with both publicId and systemId.
  +     * Then the local repository is queried with the file name part of the systemId
  +     * Then the classpath is queried with  the file name part of the systemId.
  +     *
  +     * Then, if failOnUnresolvable is true, an exception is thrown: otherwise null is returned.
  +     * @param publicId
  +     * @param systemId
  +     * @return
  +     * @throws SAXException
  +     * @throws IOException
  +     */
  +    public InputSource resolveEntity(
  +            final String publicId,
  +            final String systemId)
  +            throws SAXException, IOException {
  +
  +        if (log.isTraceEnabled()) {
  +            log.trace(
  +                    "start resolving for "
  +                    + entityMessageString(publicId, systemId));
  +        }
  +
  +        InputSource source = resolveWithCatalog(publicId, systemId);
  +        if (source != null) {
  +            return source;
  +        }
  +
  +        source = resolveWithRepository(publicId, systemId);
  +        if (source != null) {
  +            return source;
  +        }
  +
  +        source = resolveWithClasspath(publicId, systemId);
  +        if (source != null) {
  +            return source;
  +        }
  +
  +        String message =
  +                "could not resolve " + entityMessageString(publicId, systemId);
  +
  +        if (failOnUnresolvable) {
  +            throw new SAXException(message);
  +        } else {
  +            log.debug(message);
  +        }
   
  -                is = resolveEntityLocally(publicId, systemId);
  -                if (is != null) {
  -                        return is;
  -                }
  -        if (publicId != null || systemId == null) {
  -            if (log.isDebugEnabled()) {
  -                log.debug("Not attempting to locally resolve entity S=" + systemId + " P=" + publicId);
  +        return null;
  +    }
  +
  +    /**
  +     * Try to resolve using the catalog file
  +     *
  +     * @param publicId the PublicId
  +     * @param systemId the SystemId
  +     * @return InputSource if the entity could be resolved. null otherwise
  +     * @throws MalformedURLException
  +     * @throws IOException
  +     */
  +    private InputSource resolveWithCatalog(
  +            final String publicId,
  +            final String systemId)
  +            throws MalformedURLException, IOException {
  +
  +        if (catalogFileURI == null) {
  +            return null;
  +        }
  +
  +        String resolvedSystemId =
  +                catalog.resolvePublic(guaranteeNotNull(publicId), systemId);
  +
  +        if (resolvedSystemId != null) {
  +            if (log.isTraceEnabled()) {
  +                log.trace(
  +                        "resolved "
  +                        + entityMessageString(publicId, systemId)
  +                        + " using the catalog file. result: "
  +                        + resolvedSystemId);
               }
  +            return new InputSource(resolvedSystemId);
  +        }
  +
  +        return null;
  +    }
  +
  +    /**
  +     * Try to resolve using the local repository and only the supplied systemID filename.
  +     * Any path in the systemID will be removed.
  +     *
  +     * @param publicId the PublicId
  +     * @param systemId the SystemId
  +     * @return InputSource if the entity could be resolved. null otherwise
  +     */
  +    private InputSource resolveWithRepository(
  +            final String publicId,
  +            final String systemId) {
  +
  +        if (localRepository == null) {
               return null;
           }
  -        String message = null;
  -        if (log.isDebugEnabled()) {
  -            message = "Resolving entity S=" + systemId + " P=" + publicId + ": ";
  +
  +        String fileName = getSystemIdFileName(systemId);
  +
  +        if (fileName == null) {
  +            return null;
           }
  -        int index = systemId.lastIndexOf("/");
  -        String fileName = systemId.substring(index + 1);
  -        if (root != null) {
  -            File file = new File(root, fileName);
  -            if (file.exists()) {
  -                if (log.isDebugEnabled()) {
  -                    log.debug(message + "found file relative to " + root);
  -                }
  -                is = new InputSource(new BufferedInputStream(new FileInputStream(file)));
  -                is.setSystemId(systemId);
  -                return is;
  +
  +        String resolvedSystemId = null;
  +
  +        File file = new File(localRepository, fileName);
  +        if (file.exists()) {
  +            resolvedSystemId = file.getAbsolutePath();
  +            if (log.isTraceEnabled()) {
  +                log.trace(
  +                        "resolved "
  +                        + entityMessageString(publicId, systemId)
  +                        + "with file relative to "
  +                        + localRepository
  +                        + resolvedSystemId);
               }
  +            return new InputSource(resolvedSystemId);
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Try to resolve using the the classpath and only the supplied systemID.
  +     * Any path in the systemID will be removed.
  +     *
  +     * @param publicId the PublicId
  +     * @param systemId the SystemId
  +     * @return InputSource if the entity could be resolved. null otherwise
  +     */
  +    private InputSource resolveWithClasspath(
  +            final String publicId,
  +            final String systemId) {
  +
  +        String fileName = getSystemIdFileName(systemId);
  +
  +        if (fileName == null) {
  +            return null;
           }
  -        InputStream in = getClass().getClassLoader().getResourceAsStream(fileName);
  +
  +        InputStream in =
  +                getClass().getClassLoader().getResourceAsStream(fileName);
           if (in != null) {
  -            if (log.isDebugEnabled()) {
  -                log.debug(message + "found file on classpath");
  +            if (log.isTraceEnabled()) {
  +                log.trace(
  +                        "resolved "
  +                        + entityMessageString(publicId, systemId)
  +                        + " via file found file on classpath: "
  +                        + fileName);
               }
  -            is = new InputSource(new BufferedInputStream(in));
  +            InputSource is = new InputSource(new BufferedInputStream(in));
               is.setSystemId(systemId);
               return is;
           }
  -        if (log.isDebugEnabled()) {
  -            log.debug(message + "not found");
  -        }
  +
           return null;
       }
   
       /**
  -     * @jmx:managed-attribute
  +     * Guarantees a not null value
        */
  -    public void setConfigFile(String configFile) {
  -        this.configFile = configFile;
  -        init();
  +    private String guaranteeNotNull(final String string) {
  +        return string != null ? string : "";
       }
   
       /**
  -     * @jmx:managed-attribute
  +     * Returns the SystemIds filename
  +     *
  +     * @param systemId SystemId
  +     * @return filename
        */
  -    public String getConfigFile() {
  -        return this.configFile;
  +    private String getSystemIdFileName(final String systemId) {
  +
  +        if (systemId == null) {
  +            return null;
  +        }
  +
  +        int indexBackSlash = systemId.lastIndexOf(File.separator);
  +        int indexSlash = systemId.lastIndexOf("/");
  +
  +        int index = Math.max(indexBackSlash, indexSlash);
  +
  +        String fileName = systemId.substring(index + 1);
  +        return fileName;
       }
   
       /**
  -     * @jmx:managed-operation
  +     * Constructs a debugging message string
        */
  -    public void addMapping(String publicId, String systemId) {
  -        if ( publicId == null || systemId == null )
  -        {
  -                        if (log.isDebugEnabled()) {
  -                                log.debug("publicId or systemId are null");
  -                        }
  -                        return;
  -        }
  -        if (log.isDebugEnabled()) {
  -            log.debug("Adding entity P=" + publicId + " and its S=" + systemId);
  -        }
  -        mappings.put(publicId, systemId);
  +    private String entityMessageString(
  +            final String publicId,
  +            final String systemId) {
  +
  +        StringBuffer buffer = new StringBuffer("entity with publicId '");
  +        buffer.append(publicId);
  +        buffer.append("' and systemId '");
  +        buffer.append(systemId);
  +        buffer.append("'");
  +        return buffer.toString();
  +
       }
   
       /**
  -     * Resolve entities locally.
  -     *
  -     * TODO: Look for the systemIds in jar(s) beside their file representatives
  -     *
  -     * @param publicId
  -     * @param systemId
  -     * @return input source of the local representative of systemId
  -     * @throws SAXException
  -     * @throws IOException
  +     * Adds a new Entry to the catalog
        */
  -    private InputSource resolveEntityLocally(String publicId, String systemId) throws SAXException, IOException {
  -        System.out.println("publicId: " + publicId + ", systemId: " + systemId);
  -                if ( publicId == null || publicId.length() == 0)
  -                {
  -                        if (log.isDebugEnabled()) {
  -                                log.debug("publicId is null or empty; skipping resolving");
  -                        }
  -                        return null;
  -                }
  -        if (log.isDebugEnabled()) {
  -            log.debug("Resolving entity locally S=" + systemId + " P=" + publicId);
  -        }
  -        String publicIdPath = (String) mappings.get(publicId);
  -        if (publicIdPath != null && publicIdPath.length() != 0) {
  -            File file = new File(publicIdPath);
  -            if (file.exists()) {
  -                if (log.isDebugEnabled()) {
  -                    log.debug("found file: " + publicIdPath);
  -                }
  -                InputSource is = new InputSource(new BufferedInputStream(new FileInputStream(file)));
  -                is.setSystemId(systemId);
  -                return is;
  -            }
  +    private void addEntry(String type, Vector args) {
  +        try {
  +            CatalogEntry entry = new CatalogEntry(type, args);
  +            catalog.addEntry(entry);
  +        } catch (CatalogException e) {
  +            throw new RuntimeException(e);
           }
  -        return null;
       }
   
       /**
        * Loads mappings from configuration file
        */
       private void init() {
  -        mappings.clear();
  -        try {
  -            if (this.configFile == null || this.configFile.length() == 0) {
  -                if (log.isDebugEnabled()) {
  -                    log.debug("No configuration file provided");
  -                }
  -                return;
  -            }
  -            if (log.isDebugEnabled()) {
  -                log.debug("Loading configuration file=" + this.configFile);
  -            }
  -            mappings.load(new BufferedInputStream(new FileInputStream(this.configFile)));
  -        } catch (IOException ioe) {
  -            if (log.isDebugEnabled()) {
  -                log.debug("Exception occured: " + ioe.getMessage() + "; ignore it");
  -            }
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug("init catalog file " + this.catalogFileURI);
           }
  -    }
   
  -    /**
  -     * @jmx:managed-operation
  -     */
  -    public Hashtable showMappings() {
  -        return mappings;
  +        manager.setUseStaticCatalog(false);
  +        manager.setCatalogFiles(this.catalogFileURI.toString());
  +        manager.setIgnoreMissingProperties(true);
  +        catalog = manager.getCatalog();
  +
       }
  +
   }
  
  
  
  1.2       +27 -18    incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/StorerUtil.java
  
  Index: StorerUtil.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/StorerUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StorerUtil.java	1 Oct 2003 19:03:40 -0000	1.1
  +++ StorerUtil.java	2 Jan 2004 23:32:38 -0000	1.2
  @@ -57,6 +57,7 @@
   
   import java.io.Writer;
   import java.util.Properties;
  +
   import javax.xml.transform.TransformerException;
   import javax.xml.transform.TransformerFactory;
   import javax.xml.transform.Transformer;
  @@ -66,10 +67,12 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.ParserConfigurationException;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.Document;
   import org.w3c.dom.NodeList;
   import org.w3c.dom.Node;
  +import org.xml.sax.EntityResolver;
   
   /**
    * Holds utility methods for writing to a DOM tree
  @@ -77,6 +80,8 @@
    * @version $Revision$ $Date$
    */
   public class StorerUtil {
  +    private static EntityResolver entityResolver;
  +
       /**
        * Creates a new child of the specified element, adds it as a child, and
        * returns it.
  @@ -114,9 +119,9 @@
        * @param parent  The parent element for the new child
        * @param name  The name of the new child element
        * @param value The text to set on the new element
  -     */ 
  +     */
       public static void createOptionalChildText(Element parent, String name, String value) {
  -        if(value == null || value.equals(""))
  +        if (value == null || value.equals(""))
               return;
           Element child = parent.getOwnerDocument().createElement(name);
           parent.appendChild(child);
  @@ -153,7 +158,7 @@
           fac.setNamespaceAware(true);
           fac.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
           DocumentBuilder builder = fac.newDocumentBuilder();
  -        builder.setEntityResolver(new LocalEntityResolver());
  +        builder.setEntityResolver(entityResolver);
           return builder.newDocument();
       }
   
  @@ -162,18 +167,18 @@
        */
       public static void setText(Element e, String s) {
           boolean cdata = s != null && (s.indexOf('>') > -1 ||
  -                                      s.indexOf('<') > -1 ||
  -                                      s.indexOf('&') > -1);
  +                s.indexOf('<') > -1 ||
  +                s.indexOf('&') > -1);
           NodeList nl = e.getChildNodes();
           boolean found = false;
           int max = nl.getLength();
  -        if(cdata) {
  -            for(int i=0; i<max; i++) {
  +        if (cdata) {
  +            for (int i = 0; i < max; i++) {
                   Node n = nl.item(i);
  -                if(n.getNodeType() == Node.TEXT_NODE) {
  +                if (n.getNodeType() == Node.TEXT_NODE) {
                       e.removeChild(n);
  -                } else if(n.getNodeType() == Node.CDATA_SECTION_NODE) {
  -                    if(!found) {
  +                } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
  +                    if (!found) {
                           n.setNodeValue(s);
                           found = true;
                       } else {
  @@ -181,24 +186,24 @@
                       }
                   }
               }
  -            if(!found) {
  +            if (!found) {
                   e.appendChild(e.getOwnerDocument().createCDATASection(s));
               }
           } else {
  -            for(int i=0; i<max; i++) {
  +            for (int i = 0; i < max; i++) {
                   Node n = nl.item(i);
  -                if(n.getNodeType() == Node.TEXT_NODE) {
  -                    if(!found) {
  +                if (n.getNodeType() == Node.TEXT_NODE) {
  +                    if (!found) {
                           n.setNodeValue(s);
                           found = true;
                       } else {
                           e.removeChild(n);
                       }
  -                } else if(n.getNodeType() == Node.CDATA_SECTION_NODE) {
  +                } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
                       e.removeChild(n);
                   }
               }
  -            if(!found) {
  +            if (!found) {
                   e.appendChild(e.getOwnerDocument().createTextNode(s == null ? "" : s));
               }
           }
  @@ -233,10 +238,14 @@
        * @param value         The text value to use as the content of the new element
        */
       public static void createOptionalChildTextWithNS(Element elem, String qualifiedName, String namespace, String value) {
  -        if(value == null || value.equals(""))
  +        if (value == null || value.equals(""))
               return;
           Element child = elem.getOwnerDocument().createElementNS(namespace, qualifiedName);
           elem.appendChild(child);
           setText(child, value);
  +    }
  +
  +    public static void setEntityResolver(LocalEntityResolver entityResolver) {
  +        StorerUtil.entityResolver = entityResolver;
       }
   }
  
  
  
  1.3       +8 -10     incubator-geronimo/modules/core/src/test/org/apache/geronimo/security/EjbModuleConfigurationTest.java
  
  Index: EjbModuleConfigurationTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/security/EjbModuleConfigurationTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EjbModuleConfigurationTest.java	28 Dec 2003 19:34:05 -0000	1.2
  +++ EjbModuleConfigurationTest.java	2 Jan 2004 23:32:39 -0000	1.3
  @@ -56,16 +56,15 @@
   
   package org.apache.geronimo.security;
   
  -import junit.framework.TestCase;
  -
   import java.io.File;
   import java.io.FileReader;
   
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbJar;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
  +import org.apache.geronimo.deployment.model.geronimo.web.WebApp;
  +import org.apache.geronimo.xml.deployment.AbstractLoaderUtilTest;
   import org.apache.geronimo.xml.deployment.GeronimoEjbJarLoader;
   import org.apache.geronimo.xml.deployment.LoaderUtil;
  -import org.apache.geronimo.deployment.model.geronimo.web.WebApp;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.EjbJar;
   import org.w3c.dom.Document;
   
   
  @@ -74,24 +73,23 @@
    *
    * @version $Revision$ $Date$
    */
  -public class EjbModuleConfigurationTest extends TestCase {
  +public class EjbModuleConfigurationTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private GeronimoEjbJarLoader loader;
       EJBModuleConfiguration module;
       WebApp client;
   
       public void setUp() throws Exception {
  +        super.setUp();
           System.setProperty("javax.security.jacc.PolicyConfigurationFactory.provider", "org.apache.geronimo.security.GeronimoPolicyConfigurationFactory");
   
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new GeronimoEjbJarLoader();
       }
   
       public void testRead() throws Exception {
   
           File f = new File(docDir, "geronimo-ejb-jar-testRead.xml");
           Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        GeronimoEjbJarDocument doc = loader.load(xmlDoc);
  +        GeronimoEjbJarDocument doc = GeronimoEjbJarLoader.load(xmlDoc);
           EjbJar jar = doc.getEjbJar();
   
           module = new EJBModuleConfiguration("pookie test", jar);
  
  
  
  1.3       +6 -6      incubator-geronimo/modules/core/src/test/org/apache/geronimo/security/WebModuleConfigurationTest.java
  
  Index: WebModuleConfigurationTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/security/WebModuleConfigurationTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebModuleConfigurationTest.java	28 Dec 2003 19:34:05 -0000	1.2
  +++ WebModuleConfigurationTest.java	2 Jan 2004 23:32:39 -0000	1.3
  @@ -59,9 +59,9 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import junit.framework.TestCase;
   import org.apache.geronimo.deployment.model.geronimo.web.GeronimoWebAppDocument;
   import org.apache.geronimo.deployment.model.geronimo.web.WebApp;
  +import org.apache.geronimo.xml.deployment.AbstractLoaderUtilTest;
   import org.apache.geronimo.xml.deployment.GeronimoWebAppLoader;
   import org.apache.geronimo.xml.deployment.LoaderUtil;
   import org.w3c.dom.Document;
  @@ -72,17 +72,17 @@
    *
    * @version $Revision$ $Date$
    */
  -public class WebModuleConfigurationTest extends TestCase {
  +public class WebModuleConfigurationTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private GeronimoWebAppLoader loader;
       WebModuleConfiguration module;
       WebApp client;
   
       public void setUp() throws Exception {
  +        super.setUp();
  +
           System.setProperty("javax.security.jacc.PolicyConfigurationFactory.provider", "org.apache.geronimo.security.GeronimoPolicyConfigurationFactory");
   
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new GeronimoWebAppLoader();
       }
   
       public void testRead() throws Exception {
  @@ -90,7 +90,7 @@
   
           File f = new File(docDir, "geronimo-web-app-testRead.xml");
           Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        GeronimoWebAppDocument doc = loader.load(xmlDoc);
  +        GeronimoWebAppDocument doc = GeronimoWebAppLoader.load(xmlDoc);
           client = doc.getWebApp();
   
           module = new WebModuleConfiguration("pookie /test", client);
  
  
  
  1.3       +4 -6      incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/AppClientLoaderTest.java
  
  Index: AppClientLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/AppClientLoaderTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AppClientLoaderTest.java	5 Sep 2003 20:18:03 -0000	1.2
  +++ AppClientLoaderTest.java	2 Jan 2004 23:32:39 -0000	1.3
  @@ -58,7 +58,6 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import junit.framework.TestCase;
   import org.apache.geronimo.deployment.model.appclient.ApplicationClient;
   import org.apache.geronimo.deployment.model.j2ee.EJBRef;
   import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
  @@ -74,14 +73,13 @@
    *
    * @version $Revision$ $Date$
    */
  -public class AppClientLoaderTest extends TestCase {
  +public class AppClientLoaderTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private AppClientLoader loader;
   
       public void testSimpleLoad() throws Exception {
           File f = new File(docDir, "simple-app-client.xml");
           Document doc = LoaderUtil.parseXML(new FileReader(f));
  -        ApplicationClient client = loader.load(doc);
  +        ApplicationClient client = AppClientLoader.load(doc);
   
           EnvEntry[] envEntries = client.getEnvEntry();
           assertEquals(1, envEntries.length);
  @@ -134,7 +132,7 @@
       }
   
       protected void setUp() throws Exception {
  +        super.setUp();
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new AppClientLoader();
       }
   }
  
  
  
  1.3       +68 -69    incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/ConnectorLoaderTest.java
  
  Index: ConnectorLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/ConnectorLoaderTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectorLoaderTest.java	13 Nov 2003 22:22:31 -0000	1.2
  +++ ConnectorLoaderTest.java	2 Jan 2004 23:32:39 -0000	1.3
  @@ -59,14 +59,12 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import junit.framework.TestCase;
  -
  +import org.apache.geronimo.deployment.model.connector.ConfigProperty;
   import org.apache.geronimo.deployment.model.connector.Connector;
   import org.apache.geronimo.deployment.model.connector.ConnectorDocument;
   import org.apache.geronimo.deployment.model.connector.InboundResourceAdapter;
   import org.apache.geronimo.deployment.model.connector.OutboundResourceAdapter;
   import org.apache.geronimo.deployment.model.connector.ResourceAdapter;
  -import org.apache.geronimo.deployment.model.connector.ConfigProperty;
   import org.w3c.dom.Document;
   
   /**
  @@ -74,77 +72,78 @@
    *
    * @version $Revision$ $Date$
    */
  -public class ConnectorLoaderTest extends TestCase {
  -	private File docDir_1_5;
  -	private File docDir_1_0;
  -
  -	public void testSimpleLoad_1_5() throws Exception {
  -		File f = new File(docDir_1_5, "ra.xml");
  -		Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -		ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  -		Connector connector = doc.getConnector();
  -		checkResourceAdapter_1_5(connector.getResourceAdapter());
  -	}
  -	
  -	protected static void checkResourceAdapter_1_5(ResourceAdapter resourceAdapter) throws Exception {
  -	    assertTrue("Expected a ResourceAdapter object", resourceAdapter != null);
  -	    assertTrue("Expected a ResourceAdapter class", resourceAdapter.getResourceAdapterClass() != null);
  -	    assertEquals("Expected 1 ConfigProperty", 1, resourceAdapter.getConfigProperty().length);
  -	    checkOutboundResourceAdapter_1_5(resourceAdapter.getOutboundResourceAdapter());
  -	    checkInboundResourceAdapter(resourceAdapter.getInboundResourceAdapter());
  -	    assertEquals("Expected 1 adminobject", 1, resourceAdapter.getAdminObject().length);
  -	    assertEquals("Expected admin object to have one config property", 1, resourceAdapter.getAdminObject()[0].getConfigProperty().length);
  -	}
  -	
  -	protected static void checkOutboundResourceAdapter_1_5(OutboundResourceAdapter outboundResourceAdapter) throws Exception {
  -	    assertTrue("Expected an OutboundResourceAdapter object", outboundResourceAdapter != null);
  -		assertEquals("Expected 2 ConnectionDefinition objects", 2, outboundResourceAdapter.getConnectionDefinition().length);
  +public class ConnectorLoaderTest extends AbstractLoaderUtilTest {
  +    private File docDir_1_5;
  +    private File docDir_1_0;
  +
  +    public void testSimpleLoad_1_5() throws Exception {
  +        File f = new File(docDir_1_5, "ra.xml");
  +        Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  +        ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  +        Connector connector = doc.getConnector();
  +        checkResourceAdapter_1_5(connector.getResourceAdapter());
  +    }
  +
  +    protected static void checkResourceAdapter_1_5(ResourceAdapter resourceAdapter) throws Exception {
  +        assertTrue("Expected a ResourceAdapter object", resourceAdapter != null);
  +        assertTrue("Expected a ResourceAdapter class", resourceAdapter.getResourceAdapterClass() != null);
  +        assertEquals("Expected 1 ConfigProperty", 1, resourceAdapter.getConfigProperty().length);
  +        checkOutboundResourceAdapter_1_5(resourceAdapter.getOutboundResourceAdapter());
  +        checkInboundResourceAdapter(resourceAdapter.getInboundResourceAdapter());
  +        assertEquals("Expected 1 adminobject", 1, resourceAdapter.getAdminObject().length);
  +        assertEquals("Expected admin object to have one config property", 1, resourceAdapter.getAdminObject()[0].getConfigProperty().length);
  +    }
  +
  +    protected static void checkOutboundResourceAdapter_1_5(OutboundResourceAdapter outboundResourceAdapter) throws Exception {
  +        assertTrue("Expected an OutboundResourceAdapter object", outboundResourceAdapter != null);
  +        assertEquals("Expected 2 ConnectionDefinition objects", 2, outboundResourceAdapter.getConnectionDefinition().length);
           ConfigProperty[] configProperty = outboundResourceAdapter.getConnectionDefinition()[0].getConfigProperty();
           assertEquals("Examining first ConnectionDefinition ConfigProperty count", 4,
  -		        configProperty.length);
  +                configProperty.length);
           assertEquals("ConnectionDefinition 1, ConfigProperty 1", "originalvalue1", configProperty[0].getConfigPropertyValue());
           assertEquals("ConnectionDefinition 1, ConfigProperty 2", "originalvalue2", configProperty[1].getConfigPropertyValue());
           assertEquals("ConnectionDefinition 1, ConfigProperty 3", null, configProperty[2].getConfigPropertyValue());
           assertEquals("ConnectionDefinition 1, ConfigProperty 4", null, configProperty[3].getConfigPropertyValue());
   
  -	}
  -	
  -	protected static void checkInboundResourceAdapter(InboundResourceAdapter inboundResourceAdapter) throws Exception {
  -		assertTrue("Expected an InboundResourceAdapter object", inboundResourceAdapter != null);
  -		assertEquals("Expected 1 MessageListener object", 1, inboundResourceAdapter.getMessageAdapter().getMessageListener().length);
  -		assertEquals("Expected 1 required config property", 1,
  -		inboundResourceAdapter.getMessageAdapter().getMessageListener()[0].getActivationSpec().getRequiredConfigProperty().length);
  -
  -	}
  -
  -	public void testSimpleLoad_1_0() throws Exception {
  -		File f = new File(docDir_1_0, "ra.xml");
  -		Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -		ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  -		Connector connector = doc.getConnector();
  -		checkResourceAdapter_1_0(connector.getResourceAdapter());
  -	}
  -	
  -	protected static void checkResourceAdapter_1_0(ResourceAdapter resourceAdapter) throws Exception {
  -		assertTrue("Expected a ResourceAdapter object", resourceAdapter != null);
  -		assertTrue("Expected no ResourceAdapter class", resourceAdapter.getResourceAdapterClass() == null);
  -		assertEquals("Expected 0 ConfigProperty", 0, resourceAdapter.getConfigProperty().length);
  -		checkOutboundResourceAdapter_1_0(resourceAdapter.getOutboundResourceAdapter());
  -		assertTrue("Expected no inboundResourceAdapter", null == resourceAdapter.getInboundResourceAdapter());
  -		assertEquals("Expected 0 adminobject", 0, resourceAdapter.getAdminObject().length);
  -	}
  -
  -	protected static void checkOutboundResourceAdapter_1_0(OutboundResourceAdapter outboundResourceAdapter) throws Exception {
  -		assertTrue("Expected an OutboundResourceAdapter object", outboundResourceAdapter != null);
  -		assertEquals("Expected 1 ConnectionDefinition objects", 1, outboundResourceAdapter.getConnectionDefinition().length);
  -		assertEquals("Expected first ConnectionDefinition to have 1 ConfigProperty", 1, 
  -				outboundResourceAdapter.getConnectionDefinition()[0].getConfigProperty().length);
  -
  -	}
  -	
  -	protected void setUp() throws Exception {
  -		docDir_1_5 = new File("src/test-data/xml/deployment/connector_1_5");
  -		docDir_1_0 = new File("src/test-data/xml/deployment/connector_1_0");
  -	}
  +    }
  +
  +    protected static void checkInboundResourceAdapter(InboundResourceAdapter inboundResourceAdapter) throws Exception {
  +        assertTrue("Expected an InboundResourceAdapter object", inboundResourceAdapter != null);
  +        assertEquals("Expected 1 MessageListener object", 1, inboundResourceAdapter.getMessageAdapter().getMessageListener().length);
  +        assertEquals("Expected 1 required config property", 1,
  +                inboundResourceAdapter.getMessageAdapter().getMessageListener()[0].getActivationSpec().getRequiredConfigProperty().length);
  +
  +    }
  +
  +    public void testSimpleLoad_1_0() throws Exception {
  +        File f = new File(docDir_1_0, "ra.xml");
  +        Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  +        ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  +        Connector connector = doc.getConnector();
  +        checkResourceAdapter_1_0(connector.getResourceAdapter());
  +    }
  +
  +    protected static void checkResourceAdapter_1_0(ResourceAdapter resourceAdapter) throws Exception {
  +        assertTrue("Expected a ResourceAdapter object", resourceAdapter != null);
  +        assertTrue("Expected no ResourceAdapter class", resourceAdapter.getResourceAdapterClass() == null);
  +        assertEquals("Expected 0 ConfigProperty", 0, resourceAdapter.getConfigProperty().length);
  +        checkOutboundResourceAdapter_1_0(resourceAdapter.getOutboundResourceAdapter());
  +        assertTrue("Expected no inboundResourceAdapter", null == resourceAdapter.getInboundResourceAdapter());
  +        assertEquals("Expected 0 adminobject", 0, resourceAdapter.getAdminObject().length);
  +    }
  +
  +    protected static void checkOutboundResourceAdapter_1_0(OutboundResourceAdapter outboundResourceAdapter) throws Exception {
  +        assertTrue("Expected an OutboundResourceAdapter object", outboundResourceAdapter != null);
  +        assertEquals("Expected 1 ConnectionDefinition objects", 1, outboundResourceAdapter.getConnectionDefinition().length);
  +        assertEquals("Expected first ConnectionDefinition to have 1 ConfigProperty", 1,
  +                outboundResourceAdapter.getConnectionDefinition()[0].getConfigProperty().length);
  +
  +    }
  +
  +    protected void setUp() throws Exception {
  +        super.setUp();
  +        docDir_1_5 = new File("src/test-data/xml/deployment/connector_1_5");
  +        docDir_1_0 = new File("src/test-data/xml/deployment/connector_1_0");
  +    }
   
   }
  
  
  
  1.3       +10 -10    incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/EjbJarLoaderTest.java
  
  Index: EjbJarLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/EjbJarLoaderTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EjbJarLoaderTest.java	7 Nov 2003 03:49:43 -0000	1.2
  +++ EjbJarLoaderTest.java	2 Jan 2004 23:32:39 -0000	1.3
  @@ -58,16 +58,15 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import junit.framework.TestCase;
  -import org.apache.geronimo.deployment.model.j2ee.EJBRef;
  -import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
  -import org.apache.geronimo.deployment.model.j2ee.ResourceEnvRef;
  -import org.apache.geronimo.deployment.model.j2ee.Description;
  -import org.apache.geronimo.deployment.model.j2ee.DisplayName;
   import org.apache.geronimo.deployment.model.ejb.EjbJar;
   import org.apache.geronimo.deployment.model.ejb.EjbJarDocument;
   import org.apache.geronimo.deployment.model.ejb.EnterpriseBeans;
   import org.apache.geronimo.deployment.model.ejb.Session;
  +import org.apache.geronimo.deployment.model.j2ee.Description;
  +import org.apache.geronimo.deployment.model.j2ee.DisplayName;
  +import org.apache.geronimo.deployment.model.j2ee.EJBRef;
  +import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
  +import org.apache.geronimo.deployment.model.j2ee.ResourceEnvRef;
   import org.w3c.dom.Document;
   
   /**
  @@ -75,7 +74,7 @@
    *
    * @version $Revision$ $Date$
    */
  -public class EjbJarLoaderTest extends TestCase {
  +public class EjbJarLoaderTest extends AbstractLoaderUtilTest {
       private File docDir;
   
       public void testSimpleLoad() throws Exception {
  @@ -88,8 +87,8 @@
   
       static void checkEjbJar(EjbJar jar, String expectedEnvValue) {
           assertEquals("2.1", jar.getVersion());
  -        checkDescription("This is a test EJB JAR DD for JSR-88 purposes",jar.getDescription());
  -        checkDisplayName("Test EJB JAR",jar.getDisplayName());
  +        checkDescription("This is a test EJB JAR DD for JSR-88 purposes", jar.getDescription());
  +        checkDisplayName("Test EJB JAR", jar.getDisplayName());
           EnterpriseBeans beans = jar.getEnterpriseBeans();
           Session[] session = beans.getSession();
           assertEquals(2, session.length);
  @@ -158,6 +157,7 @@
       }
   
       protected void setUp() throws Exception {
  +        super.setUp();
           docDir = new File("src/test-data/xml/deployment");
       }
   }
  
  
  
  1.2       +9 -12     incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/EjbJarStorerTest.java
  
  Index: EjbJarStorerTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/EjbJarStorerTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EjbJarStorerTest.java	1 Oct 2003 19:03:40 -0000	1.1
  +++ EjbJarStorerTest.java	2 Jan 2004 23:32:39 -0000	1.2
  @@ -58,43 +58,40 @@
   import java.io.File;
   import java.io.FileReader;
   import java.io.FileWriter;
  -import org.w3c.dom.Document;
  -import org.apache.geronimo.deployment.model.ejb.EjbJarDocument;
  +
   import org.apache.geronimo.deployment.model.ejb.EjbJar;
  -import junit.framework.TestCase;
  +import org.apache.geronimo.deployment.model.ejb.EjbJarDocument;
  +import org.w3c.dom.Document;
   
   /**
    * Tests for storing an EJB JAR
    *
    * @version $Revision$ $Date$
    */
  -public class EjbJarStorerTest extends TestCase {
  +public class EjbJarStorerTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private EjbJarLoader loader;
  -    private EjbJarStorer storer;
   
       protected void setUp() throws Exception {
  +        super.setUp();
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new EjbJarLoader();
  -        storer = new EjbJarStorer();
       }
   
       public void testLoadStoreLoad() throws Exception {
           File f = new File(docDir, "simple-ejb-jar.xml");
           Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        EjbJarDocument doc = loader.load(xmlDoc);
  +        EjbJarDocument doc = EjbJarLoader.load(xmlDoc);
           EjbJar jar = doc.getEjbJar();
           EjbJarLoaderTest.checkEjbJar(jar, "example");
   
           File of = new File(docDir, "test-copy-ejb-jar.xml");
           FileWriter out = new FileWriter(of);
  -        storer.store(doc, out);
  +        EjbJarStorer.store(doc, out);
           out.flush();
           out.close();
   
           f = new File(docDir, "test-copy-ejb-jar.xml");
           xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        doc = loader.load(xmlDoc);
  +        doc = EjbJarLoader.load(xmlDoc);
           jar = doc.getEjbJar();
           EjbJarLoaderTest.checkEjbJar(jar, "example");
       }
  
  
  
  1.2       +4 -13     incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/EntityResolverTest.java
  
  Index: EntityResolverTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/EntityResolverTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EntityResolverTest.java	5 Sep 2003 20:18:03 -0000	1.1
  +++ EntityResolverTest.java	2 Jan 2004 23:32:39 -0000	1.2
  @@ -55,23 +55,14 @@
    */
   package org.apache.geronimo.xml.deployment;
   
  -import java.io.File;
  -
  -import junit.framework.TestCase;
  -import org.xml.sax.EntityResolver;
  -
   /**
    * 
  - * 
    * @version $Revision$ $Date$
    */
  -public class EntityResolverTest extends TestCase {
  -    private EntityResolver resolver;
  -    protected void setUp() throws Exception {
  -        resolver = new LocalEntityResolver(new File("src/schema"));
  -    }
  -
  +public class EntityResolverTest extends AbstractLoaderUtilTest {
  +    
       public void testEntityResolver() throws Exception {
  +        resolver.setFailOnUnresolvable(false);
           assertNull(resolver.resolveEntity(null, null));
           assertNull(resolver.resolveEntity(null, "no such file"));
           assertNotNull(resolver.resolveEntity(null, "http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"));
  
  
  
  1.6       +8 -10     incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoAppClientLoaderTest.java
  
  Index: GeronimoAppClientLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoAppClientLoaderTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GeronimoAppClientLoaderTest.java	19 Oct 2003 01:56:15 -0000	1.5
  +++ GeronimoAppClientLoaderTest.java	2 Jan 2004 23:32:39 -0000	1.6
  @@ -58,15 +58,14 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import junit.framework.TestCase;
   import org.apache.geronimo.deployment.model.geronimo.appclient.ApplicationClient;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.ServiceRef;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceRef;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.MessageDestination;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.MessageDestinationRef;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceRef;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.ServiceRef;
   import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.MessageDestination;
   import org.w3c.dom.Document;
   
   /**
  @@ -74,14 +73,13 @@
    *
    * @version $Revision$ $Date$
    */
  -public class GeronimoAppClientLoaderTest extends TestCase {
  +public class GeronimoAppClientLoaderTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private GeronimoAppClientLoader loader;
   
       public void testLoad() throws Exception {
           File f = new File(docDir, "geronimo-app-client.xml");
           Document doc = LoaderUtil.parseXML(new FileReader(f));
  -        ApplicationClient client = loader.load(doc).getApplicationClient();
  +        ApplicationClient client = GeronimoAppClientLoader.load(doc).getApplicationClient();
   
           EnvEntry[] envEntries = client.getEnvEntry();
           assertEquals(1, envEntries.length);
  @@ -139,7 +137,7 @@
       }
   
       protected void setUp() throws Exception {
  +        super.setUp();
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new GeronimoAppClientLoader();
       }
   }
  
  
  
  1.3       +82 -78    incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoConnectorLoaderTest.java
  
  Index: GeronimoConnectorLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoConnectorLoaderTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GeronimoConnectorLoaderTest.java	13 Nov 2003 22:22:31 -0000	1.2
  +++ GeronimoConnectorLoaderTest.java	2 Jan 2004 23:32:39 -0000	1.3
  @@ -59,11 +59,13 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import junit.framework.TestCase;
  -
  -import org.apache.geronimo.deployment.model.connector.ConnectorDocument;
   import org.apache.geronimo.deployment.model.connector.ConfigProperty;
  -import org.apache.geronimo.deployment.model.geronimo.connector.*;
  +import org.apache.geronimo.deployment.model.connector.ConnectorDocument;
  +import org.apache.geronimo.deployment.model.geronimo.connector.GeronimoConnectionManagerFactory;
  +import org.apache.geronimo.deployment.model.geronimo.connector.GeronimoConnector;
  +import org.apache.geronimo.deployment.model.geronimo.connector.GeronimoConnectorDocument;
  +import org.apache.geronimo.deployment.model.geronimo.connector.GeronimoOutboundResourceAdapter;
  +import org.apache.geronimo.deployment.model.geronimo.connector.GeronimoResourceAdapter;
   import org.w3c.dom.Document;
   
   /**
  @@ -71,38 +73,38 @@
    *
    * @version $Revision$ $Date$
    */
  -public class GeronimoConnectorLoaderTest extends TestCase {
  -	private File docDir_1_5;
  -	private File docDir_1_0;
  -
  -	public void testSimpleLoad_1_5() throws Exception {
  -		File f = new File(docDir_1_5, "ra.xml");
  -		Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -		ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  -		File g = new File(docDir_1_5, "geronimo-ra.xml");
  -		Document xmlGDoc = LoaderUtil.parseXML(new FileReader(g));
  -		GeronimoConnectorDocument gdoc = GeronimoConnectorLoader.load(xmlGDoc, doc);
  -		GeronimoConnector gconnector = gdoc.getGeronimoConnector();
  -		checkResourceAdapter_1_5(gconnector.getGeronimoResourceAdapter());
  -	}
  -	
  -	protected static void checkResourceAdapter_1_5(GeronimoResourceAdapter gresourceAdapter) throws Exception {
  -	    assertTrue("Expected a ResourceAdapter object", gresourceAdapter != null);
  -	    assertTrue("Expected a ResourceAdapter class", gresourceAdapter.getResourceAdapterClass() != null);
  -	    assertEquals("Expected 1 ConfigProperty", 1, gresourceAdapter.getConfigProperty().length);
  -		assertTrue("Expected a BootstrapContext", gresourceAdapter.getBootstrapContext() != null);
  -	    checkOutboundResourceAdapter_1_5(gresourceAdapter.getGeronimoOutboundResourceAdapter());
  -	    //checkInboundResourceAdapter(gresourceAdapter.getGeronimoInboundResourceAdapter());
  -	    assertEquals("Expected 2 adminobject", 2, gresourceAdapter.getAdminObject().length);
  -	    assertEquals("Expected admin object to have one config property", 1, gresourceAdapter.getAdminObject()[0].getConfigProperty().length);
  -	}
  -	
  -	protected static void checkOutboundResourceAdapter_1_5(GeronimoOutboundResourceAdapter goutboundResourceAdapter) throws Exception {
  -	    assertTrue("Expected an OutboundResourceAdapter object", goutboundResourceAdapter != null);
  -		assertEquals("Expected 3 ConnectionDefinition objects", 3, goutboundResourceAdapter.getConnectionDefinition().length);
  -		ConfigProperty[] configProperty = goutboundResourceAdapter.getGeronimoConnectionDefinition()[0].getConfigProperty();
  +public class GeronimoConnectorLoaderTest extends AbstractLoaderUtilTest {
  +    private File docDir_1_5;
  +    private File docDir_1_0;
  +
  +    public void testSimpleLoad_1_5() throws Exception {
  +        File f = new File(docDir_1_5, "ra.xml");
  +        Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  +        ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  +        File g = new File(docDir_1_5, "geronimo-ra.xml");
  +        Document xmlGDoc = LoaderUtil.parseXML(new FileReader(g));
  +        GeronimoConnectorDocument gdoc = GeronimoConnectorLoader.load(xmlGDoc, doc);
  +        GeronimoConnector gconnector = gdoc.getGeronimoConnector();
  +        checkResourceAdapter_1_5(gconnector.getGeronimoResourceAdapter());
  +    }
  +
  +    protected static void checkResourceAdapter_1_5(GeronimoResourceAdapter gresourceAdapter) throws Exception {
  +        assertTrue("Expected a ResourceAdapter object", gresourceAdapter != null);
  +        assertTrue("Expected a ResourceAdapter class", gresourceAdapter.getResourceAdapterClass() != null);
  +        assertEquals("Expected 1 ConfigProperty", 1, gresourceAdapter.getConfigProperty().length);
  +        assertTrue("Expected a BootstrapContext", gresourceAdapter.getBootstrapContext() != null);
  +        checkOutboundResourceAdapter_1_5(gresourceAdapter.getGeronimoOutboundResourceAdapter());
  +        //checkInboundResourceAdapter(gresourceAdapter.getGeronimoInboundResourceAdapter());
  +        assertEquals("Expected 2 adminobject", 2, gresourceAdapter.getAdminObject().length);
  +        assertEquals("Expected admin object to have one config property", 1, gresourceAdapter.getAdminObject()[0].getConfigProperty().length);
  +    }
  +
  +    protected static void checkOutboundResourceAdapter_1_5(GeronimoOutboundResourceAdapter goutboundResourceAdapter) throws Exception {
  +        assertTrue("Expected an OutboundResourceAdapter object", goutboundResourceAdapter != null);
  +        assertEquals("Expected 3 ConnectionDefinition objects", 3, goutboundResourceAdapter.getConnectionDefinition().length);
  +        ConfigProperty[] configProperty = goutboundResourceAdapter.getGeronimoConnectionDefinition()[0].getConfigProperty();
           assertEquals("Examining first ConnectionDefinition ConfigProperty count", 4,
  -		        configProperty.length);
  +                configProperty.length);
           assertEquals("ConnectionDefinition 1, ConfigProperty 1", "newvalue1", configProperty[0].getConfigPropertyValue());
           assertEquals("ConnectionDefinition 1, ConfigProperty 2", "originalvalue2", configProperty[1].getConfigPropertyValue());
           assertEquals("ConnectionDefinition 1, ConfigProperty 3", "newvalue2", configProperty[2].getConfigPropertyValue());
  @@ -119,47 +121,49 @@
           assertTrue("Expected a GeronimoConnectionManagerFactory", gcmf != null);
           assertTrue("Expected a descriptor for GeronimoConnectionManagerFactory", gcmf.getConnectionManagerFactoryDescriptor() != null);
           assertEquals("Wrong ConfigProperty count:", 1, gcmf.getConfigProperty().length);
  -	}
  -	/*
  -	protected static void checkInboundResourceAdapter(GeronimoInboundResourceAdapter ginboundResourceAdapter) throws Exception {
  -		assertTrue("Expected an InboundResourceAdapter object", ginboundResourceAdapter != null);
  -		assertEquals("Expected 1 MessageListener object", 1, ginboundResourceAdapter.getMessageAdapter().getMessageListener().length);
  -		assertEquals("Expected 1 required config property", 1,
  -		ginboundResourceAdapter.getMessageAdapter().getMessageListener()[0].getActivationSpec().getRequiredConfigProperty().length);
  -
  -	}
  -	*/
  -
  -	public void testSimpleLoad_1_0() throws Exception {
  -	File f = new File(docDir_1_0, "ra.xml");
  -	Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -	ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  -	File g = new File(docDir_1_0, "geronimo-ra.xml");
  -	Document xmlGDoc = LoaderUtil.parseXML(new FileReader(g));
  -	GeronimoConnectorDocument gdoc = GeronimoConnectorLoader.load(xmlGDoc, doc);
  -	GeronimoConnector gconnector = gdoc.getGeronimoConnector();
  -	checkResourceAdapter_1_0(gconnector.getGeronimoResourceAdapter());
  -}
  -	
  -protected static void checkResourceAdapter_1_0(GeronimoResourceAdapter gresourceAdapter) throws Exception {
  -	assertTrue("Expected a ResourceAdapter object", gresourceAdapter != null);
  -	assertTrue("Expected no ResourceAdapter class", gresourceAdapter.getResourceAdapterClass() == null);
  -	assertEquals("Expected 0 ConfigProperty", 0, gresourceAdapter.getConfigProperty().length);
  -	checkOutboundResourceAdapter_1_0(gresourceAdapter.getGeronimoOutboundResourceAdapter());
  -	//checkInboundResourceAdapter(gresourceAdapter.getGeronimoInboundResourceAdapter());
  -	assertEquals("Expected 0 adminobject", 0, gresourceAdapter.getAdminObject().length);
  -}
  -	
  -protected static void checkOutboundResourceAdapter_1_0(GeronimoOutboundResourceAdapter goutboundResourceAdapter) throws Exception {
  -	assertTrue("Expected an OutboundResourceAdapter object", goutboundResourceAdapter != null);
  -	assertEquals("Expected 2 ConnectionDefinition objects", 2, goutboundResourceAdapter.getConnectionDefinition().length);
  -	assertEquals("Expected first ConnectionDefinition to have 1 ConfigProperty", 1, 
  -			goutboundResourceAdapter.getConnectionDefinition()[0].getConfigProperty().length);
  -
  -}
  -protected void setUp() throws Exception {
  -		docDir_1_5 = new File("src/test-data/xml/deployment/connector_1_5");
  -		docDir_1_0 = new File("src/test-data/xml/deployment/connector_1_0");
  -	}
  +    }
  +    /*
  +    protected static void checkInboundResourceAdapter(GeronimoInboundResourceAdapter ginboundResourceAdapter) throws Exception {
  +            assertTrue("Expected an InboundResourceAdapter object", ginboundResourceAdapter != null);
  +            assertEquals("Expected 1 MessageListener object", 1, ginboundResourceAdapter.getMessageAdapter().getMessageListener().length);
  +            assertEquals("Expected 1 required config property", 1,
  +            ginboundResourceAdapter.getMessageAdapter().getMessageListener()[0].getActivationSpec().getRequiredConfigProperty().length);
  +
  +    }
  +    */
  +
  +    public void testSimpleLoad_1_0() throws Exception {
  +        File f = new File(docDir_1_0, "ra.xml");
  +        Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  +        ConnectorDocument doc = ConnectorLoader.load(xmlDoc);
  +        File g = new File(docDir_1_0, "geronimo-ra.xml");
  +        Document xmlGDoc = LoaderUtil.parseXML(new FileReader(g));
  +        GeronimoConnectorDocument gdoc = GeronimoConnectorLoader.load(xmlGDoc, doc);
  +        GeronimoConnector gconnector = gdoc.getGeronimoConnector();
  +        checkResourceAdapter_1_0(gconnector.getGeronimoResourceAdapter());
  +    }
  +
  +    protected static void checkResourceAdapter_1_0(GeronimoResourceAdapter gresourceAdapter) throws Exception {
  +        assertTrue("Expected a ResourceAdapter object", gresourceAdapter != null);
  +        assertTrue("Expected no ResourceAdapter class", gresourceAdapter.getResourceAdapterClass() == null);
  +        assertEquals("Expected 0 ConfigProperty", 0, gresourceAdapter.getConfigProperty().length);
  +        checkOutboundResourceAdapter_1_0(gresourceAdapter.getGeronimoOutboundResourceAdapter());
  +        //checkInboundResourceAdapter(gresourceAdapter.getGeronimoInboundResourceAdapter());
  +        assertEquals("Expected 0 adminobject", 0, gresourceAdapter.getAdminObject().length);
  +    }
  +
  +    protected static void checkOutboundResourceAdapter_1_0(GeronimoOutboundResourceAdapter goutboundResourceAdapter) throws Exception {
  +        assertTrue("Expected an OutboundResourceAdapter object", goutboundResourceAdapter != null);
  +        assertEquals("Expected 2 ConnectionDefinition objects", 2, goutboundResourceAdapter.getConnectionDefinition().length);
  +        assertEquals("Expected first ConnectionDefinition to have 1 ConfigProperty", 1,
  +                goutboundResourceAdapter.getConnectionDefinition()[0].getConfigProperty().length);
  +
  +    }
  +
  +    protected void setUp() throws Exception {
  +        super.setUp();
  +        docDir_1_5 = new File("src/test-data/xml/deployment/connector_1_5");
  +        docDir_1_0 = new File("src/test-data/xml/deployment/connector_1_0");
  +    }
   
   }
  
  
  
  1.8       +17 -21    incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java
  
  Index: GeronimoEjbJarLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- GeronimoEjbJarLoaderTest.java	19 Nov 2003 08:01:53 -0000	1.7
  +++ GeronimoEjbJarLoaderTest.java	2 Jan 2004 23:32:39 -0000	1.8
  @@ -58,49 +58,45 @@
   import java.io.File;
   import java.io.FileReader;
   
  -import javax.management.relation.Relation;
  -
  -import junit.framework.TestCase;
  -import org.w3c.dom.Document;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
  +import org.apache.geronimo.deployment.model.ejb.QueryMethod;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
   import org.apache.geronimo.deployment.model.geronimo.ejb.EjbJar;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelation;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelationshipRole;
   import org.apache.geronimo.deployment.model.geronimo.ejb.EnterpriseBeans;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.Session;
   import org.apache.geronimo.deployment.model.geronimo.ejb.Entity;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
   import org.apache.geronimo.deployment.model.geronimo.ejb.MessageDriven;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.Relationships;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelation;
  -import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelationshipRole;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
   import org.apache.geronimo.deployment.model.geronimo.ejb.RelationshipQuery;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Relationships;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Session;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.ClassSpace;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
   import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
  -import org.apache.geronimo.deployment.model.ejb.QueryMethod;
  +import org.w3c.dom.Document;
   
   /**
    * Tests basic Geronimo EJB JAR DD loading (not very comprehensive)
    *
    * @version $Revision$ $Date$
    */
  -public class GeronimoEjbJarLoaderTest extends TestCase {
  +public class GeronimoEjbJarLoaderTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private GeronimoEjbJarLoader loader;
   
       public void testSimpleLoad() throws Exception {
           File f = new File(docDir, "simple-geronimo-ejb-jar.xml");
           Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        GeronimoEjbJarDocument doc = loader.load(xmlDoc);
  +        GeronimoEjbJarDocument doc = GeronimoEjbJarLoader.load(xmlDoc);
           checkGeronimoJar(doc);
       }
   
       public void testRelationshipLoad() throws Exception {
           File f = new File(docDir, "simple-geronimo-ejb-jar.xml");
           Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        GeronimoEjbJarDocument doc = loader.load(xmlDoc);
  +        GeronimoEjbJarDocument doc = GeronimoEjbJarLoader.load(xmlDoc);
           EjbJar jar = doc.getEjbJar();
           Relationships relationships = jar.getGeronimoRelationships();
           checkRelationships(relationships);
  @@ -216,7 +212,7 @@
       }
   
       protected void setUp() throws Exception {
  +        super.setUp();
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new GeronimoEjbJarLoader();
       }
   }
  
  
  
  1.2       +8 -11     incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarStorerTest.java
  
  Index: GeronimoEjbJarStorerTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarStorerTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GeronimoEjbJarStorerTest.java	1 Oct 2003 19:03:40 -0000	1.1
  +++ GeronimoEjbJarStorerTest.java	2 Jan 2004 23:32:39 -0000	1.2
  @@ -58,41 +58,38 @@
   import java.io.File;
   import java.io.FileReader;
   import java.io.FileWriter;
  -import org.w3c.dom.Document;
  +
   import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
  -import junit.framework.TestCase;
  +import org.w3c.dom.Document;
   
   /**
    * Tests for storing a Geronimo EJB JAR
    *
    * @version $Revision$ $Date$
    */
  -public class GeronimoEjbJarStorerTest extends TestCase {
  +public class GeronimoEjbJarStorerTest extends AbstractLoaderUtilTest {
       private File docDir;
  -    private GeronimoEjbJarLoader loader;
  -    private GeronimoEjbJarStorer storer;
   
       protected void setUp() throws Exception {
  +        super.setUp();
           docDir = new File("src/test-data/xml/deployment");
  -        loader = new GeronimoEjbJarLoader();
  -        storer = new GeronimoEjbJarStorer();
       }
   
       public void testLoadStoreLoad() throws Exception {
           File f = new File(docDir, "simple-geronimo-ejb-jar.xml");
           Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        GeronimoEjbJarDocument doc = loader.load(xmlDoc);
  +        GeronimoEjbJarDocument doc = GeronimoEjbJarLoader.load(xmlDoc);
           GeronimoEjbJarLoaderTest.checkGeronimoJar(doc);
   
           File of = new File(docDir, "test-copy-geronimo-ejb-jar.xml");
           FileWriter out = new FileWriter(of);
  -        storer.store(doc, out);
  +        GeronimoEjbJarStorer.store(doc, out);
           out.flush();
           out.close();
   
           f = new File(docDir, "test-copy-geronimo-ejb-jar.xml");
           xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  -        doc = loader.load(xmlDoc);
  +        doc = GeronimoEjbJarLoader.load(xmlDoc);
           GeronimoEjbJarLoaderTest.checkGeronimoJar(doc);
       }
   }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/AbstractLoaderUtilTest.java
  
  Index: AbstractLoaderUtilTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.xml.deployment;
  
  import java.io.File;
  
  import junit.framework.TestCase;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2004/01/02 23:32:39 $
   */
  public abstract class AbstractLoaderUtilTest extends TestCase {
  
      private static final File repoDir = new File("src/schema");
      private static final File docDir = new File("src/test-data/xml/deployment");
      private static final File catalogFile = new File(docDir, "resolver-catalog.xml");
      protected LocalEntityResolver resolver;
  
      protected void setUp() throws Exception {
          setUp(catalogFile.toURI().toString(), repoDir.toURI().toString());
          resolver.setFailOnUnresolvable(false);
      }
  
      protected void setUp(String catalogFile, String docDirectory) {
          resolver = new LocalEntityResolver(catalogFile, docDirectory, true);
      }
  
      /**
       * @see junit.framework.TestCase#tearDown()
       */
      protected void tearDown() throws Exception {
          resolver = null;
          LoaderUtil.setEntityResolver(null);
          StorerUtil.setEntityResolver(null);
      }
  
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/test-data/xml/deployment/resolver-catalog.xml
  
  Index: resolver-catalog.xml
  ===================================================================
  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  
  <public publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          uri="xml/web-app_2_3.dtd"/>
            
  <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
          uri="file:///n:/share/doctypes/docbook/xml/docbookx.dtd"/>
  
  <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
          uri="file:///n:/share/doctypes/docbook/xml/docbookx.dtd"/>
  
  <system systemId="urn:x-oasis:docbook-xml-v4.1.2"
          uri="docbook/xml/docbookx.dtd"/>
  
  <system systemId="urn:x-oasis:docbook-xml-v4.1.0"
          uri="file:/home/kkoehler/share/doctypes/docbook/xml/docbookx.dtd"/>
  
  </catalog>