djencks 2004/01/04 16:05:36
Modified: modules/core project.xml
modules/core/src/conf resolver-catalog.xml
modules/core/src/java/org/apache/geronimo/xml/deployment
LoaderUtil.java LocalEntityResolver.java
modules/core/src/test/org/apache/geronimo/xml/deployment
AbstractLoaderUtilTest.java LoaderUtilTest.java
modules/core/src/test-data/xml/deployment
geronimo-web-app-testRead.xml resolver-catalog.xml
Added: modules/core/src/test/org/apache/geronimo/xml/deployment
LocalEntityResolverTest.java
modules/core/src/test-data/xml/deployment
simple-dtd-example.xml
modules/core/src/test-data/xml/deployment/localresolverrepository
some.xsd
Log:
Most of the rest of Geronimo-133. The rest is pending schema reorgaonization
Revision Changes Path
1.32 +2 -1 incubator-geronimo/modules/core/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/project.xml,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- project.xml 2 Jan 2004 23:32:38 -0000 1.31
+++ project.xml 5 Jan 2004 00:05:35 -0000 1.32
@@ -401,6 +401,7 @@
<directory>${basedir}/src/schema</directory>
<includes>
<include>*.xsd</include>
+ <include>*.dtd</include>
</includes>
</resource>
</resources>
1.2 +2 -2
incubator-geronimo/modules/core/src/conf/resolver-catalog.xml
Index: resolver-catalog.xml
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/conf/resolver-catalog.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- resolver-catalog.xml 2 Jan 2004 23:32:38 -0000 1.1
+++ resolver-catalog.xml 5 Jan 2004 00:05:35 -0000 1.2
@@ -1,8 +1,8 @@
<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"/>
-
+ uri="sun/dtd/web-app_2_3.dtd"/-->
+<!--
<public publicId="http://java.sun.com/xml/ns/j2ee"
uri="j2ee_1_4.xsd"/-->
1.12 +3 -3
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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- LoaderUtil.java 2 Jan 2004 23:32:38 -0000 1.11
+++ LoaderUtil.java 5 Jan 2004 00:05:35 -0000 1.12
@@ -209,7 +209,7 @@
* @throws SAXException if there was a parsing problem
* @throws IOException if there was a problem reading the input
*/
- public static Document parseXML2(Reader reader)
+ public static Document parseXML(Reader reader)
throws SAXException, IOException {
DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/validation", true);
@@ -240,7 +240,7 @@
}
//It looks to me as if this does the same things, but with jaxp.
- public static Document parseXML(Reader reader)
+ public static Document parseXML2(Reader reader)
throws SAXException, IOException {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
1.7 +32 -6
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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LocalEntityResolver.java 2 Jan 2004 23:32:38 -0000 1.6
+++ LocalEntityResolver.java 5 Jan 2004 00:05:35 -0000 1.7
@@ -98,6 +98,7 @@
*/
public class LocalEntityResolver implements EntityResolver {
+ private static final String INTERNAL_CATALOG = "resolver-catalog.xml";
/**
* used Logger
*/
@@ -130,12 +131,15 @@
*/
private boolean failOnUnresolvable = false;
+ private String internalCatalog;
+
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.addAttributeInfo(new
GeronimoAttributeInfo("InternalCatalog", true, false, "Name of catalog file in
a schema jar file, for classpath access"));
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")},
@@ -156,6 +160,11 @@
}
public LocalEntityResolver(String catalogFile, String localRepository,
boolean failOnUnresolvable) {
+ this(catalogFile, localRepository, INTERNAL_CATALOG,
failOnUnresolvable);
+ }
+
+ public LocalEntityResolver(String catalogFile, String localRepository,
String internalCatalog, boolean failOnUnresolvable) {
+ this.internalCatalog = internalCatalog;
setLocalRepository(localRepository);
setFailOnUnresolvable(failOnUnresolvable);
setCatalogFile(catalogFile);
@@ -206,6 +215,10 @@
localRepository = string;
}
+ public String getInternalCatalog() {
+ return internalCatalog;
+ }
+
public void addPublicMapping(final String publicId, final String uri) {
Vector args = new Vector();
@@ -286,7 +299,7 @@
* @throws MalformedURLException
* @throws IOException
*/
- private InputSource resolveWithCatalog(
+ InputSource resolveWithCatalog(
final String publicId,
final String systemId)
throws MalformedURLException, IOException {
@@ -320,7 +333,7 @@
* @param systemId the SystemId
* @return InputSource if the entity could be resolved. null otherwise
*/
- private InputSource resolveWithRepository(
+ InputSource resolveWithRepository(
final String publicId,
final String systemId) {
@@ -360,7 +373,7 @@
* @param systemId the SystemId
* @return InputSource if the entity could be resolved. null otherwise
*/
- private InputSource resolveWithClasspath(
+ InputSource resolveWithClasspath(
final String publicId,
final String systemId) {
@@ -407,7 +420,7 @@
return null;
}
- int indexBackSlash = systemId.lastIndexOf(File.separator);
+ int indexBackSlash = systemId.lastIndexOf("\\");
int indexSlash = systemId.lastIndexOf("/");
int index = Math.max(indexBackSlash, indexSlash);
@@ -457,7 +470,20 @@
manager.setCatalogFiles(this.catalogFileURI.toString());
manager.setIgnoreMissingProperties(true);
catalog = manager.getCatalog();
-
+ //This is an attempt to use a catalog in gerionimo-schema.jar. It
is not yet clear
+ //if it works, and is pretty much untestable until schemas are in a
different module.
+ if (internalCatalog != null) {
+ URL url =
getClass().getClassLoader().getResource(internalCatalog);
+ if (url == null) {
+ log.info("Could not locate internal catalog " +
internalCatalog);
+ } else {
+ try {
+ catalog.parseCatalog(url);
+ } catch (IOException e) {
+ log.info("Could not add internal catalog: " + url, e);
+ }
+ }
+ }
}
}
1.2 +1 -2
incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/AbstractLoaderUtilTest.java
Index: AbstractLoaderUtilTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/AbstractLoaderUtilTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractLoaderUtilTest.java 2 Jan 2004 23:32:39 -0000 1.1
+++ AbstractLoaderUtilTest.java 5 Jan 2004 00:05:36 -0000 1.2
@@ -72,7 +72,6 @@
protected void setUp() throws Exception {
setUp(catalogFile.toURI().toString(), repoDir.toURI().toString());
- resolver.setFailOnUnresolvable(false);
}
protected void setUp(String catalogFile, String docDirectory) {
1.2 +112 -100
incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/LoaderUtilTest.java
Index: LoaderUtilTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/LoaderUtilTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoaderUtilTest.java 1 Jan 2004 20:34:27 -0000 1.1
+++ LoaderUtilTest.java 5 Jan 2004 00:05:36 -0000 1.2
@@ -1,100 +1,112 @@
-/* ====================================================================
- * 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 [EMAIL PROTECTED]
- *
- * 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 junit.framework.TestCase;
-
-/**
- * @version $Revision$ $Date$
- */
-public class LoaderUtilTest extends TestCase {
-
- public void testGetContent() {
- assertNull(LoaderUtil.getContent(null));
- }
-
- public void testGetAttribute() {
- assertNull(LoaderUtil.getAttribute(null, null));
- }
-
- public void testGetChild() {
- assertNull(LoaderUtil.getChild(null, null));
- }
-
- public void testGetChildren() {
- assertTrue(LoaderUtil.getChildren(null, null).length == 0);
- }
-
- public void testGetChildContent() {
- assertNull(LoaderUtil.getChildContent(null, null));
- }
-
- public void testGetChildrenContent() {
- assertTrue(LoaderUtil.getChildrenContent(null, null).length == 0);
- }
-
- public void testGetBoolean() {
- assertFalse(LoaderUtil.getBoolean(null, null));
- }
-
- public void testParseXML() {
- try {
- LoaderUtil.parseXML(null);
- assertTrue("reader == null", false);
- } catch (Exception expected) {
- }
- }
-}
+/* ====================================================================
+ * 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 [EMAIL PROTECTED]
+ *
+ * 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.FileReader;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class LoaderUtilTest extends AbstractLoaderUtilTest {
+
+ public void testGetContent() {
+ assertNull(LoaderUtil.getContent(null));
+ }
+
+ public void testGetAttribute() {
+ assertNull(LoaderUtil.getAttribute(null, null));
+ }
+
+ public void testGetChild() {
+ assertNull(LoaderUtil.getChild(null, null));
+ }
+
+ public void testGetChildren() {
+ assertTrue(LoaderUtil.getChildren(null, null).length == 0);
+ }
+
+ public void testGetChildContent() {
+ assertNull(LoaderUtil.getChildContent(null, null));
+ }
+
+ public void testGetChildrenContent() {
+ assertTrue(LoaderUtil.getChildrenContent(null, null).length == 0);
+ }
+
+ public void testGetBoolean() {
+ assertFalse(LoaderUtil.getBoolean(null, null));
+ }
+
+ public void testParseXML() {
+ try {
+ LoaderUtil.parseXML(null);
+ assertTrue("reader == null", false);
+ } catch (Exception expected) {
+ }
+ }
+
+ public void testParseNoneValidXML() {
+
+ try {
+ LoaderUtil.parseXML(new
FileReader("src/test-data/xml/deployment/simple-dtd-example.xml"));
+ LoaderUtil.parseXML2(new
FileReader("src/test-data/xml/deployment/simple-dtd-example.xml"));
+ //fail("should throw a SAXParserException");
+ } catch (Exception expected) {
+
+ }
+ }
+
+}
1.1
incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/LocalEntityResolverTest.java
Index: LocalEntityResolverTest.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 [EMAIL PROTECTED]
*
* 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 java.io.IOException;
import java.net.URI;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/05 00:05:36 $
*/
public class LocalEntityResolverTest extends AbstractLoaderUtilTest {
private static final File docDir = new
File("src/test-data/xml/deployment");
private static final File catalogFile = new File(docDir,
"resolver-catalog.xml");
private static final String NON_EXISTING_DTD = "-//Keine Ahnung,
Inc.//DTD Nonesense 1.0//DE";
protected void setUp() throws Exception {
setUp(catalogFile.toURI().toString(), null);
}
public void testEntityResolverCatalogPublicId() throws Exception {
File expected = new File(catalogFile.getParent(),
"../../../test-data/xml/deployment/sun/dtd/web-app_2_3.dtd");
String resolved = resolver.resolveEntity("-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN", "c:\\work\\dd\\web.dtd").getSystemId();
URI resolvedURI = new URI(resolved);
assertEquals(expected.toURI().normalize(), resolvedURI);
resolved = resolver.resolveEntity("-//OASIS//DTD DocBook XML
V4.1.2//EN", "c:\\work\\dummy\\sonstwo.dtd").getSystemId();
resolvedURI = new URI(resolved);
assertEquals(new
URI("file:///n:/share/doctypes/docbook/xml/docbookx.dtd"), resolvedURI);
}
public void testEntityResolverCatalogSystemId() throws Exception {
File expected = new File(catalogFile.getParent(),
"docbook/xml/docbookx.dtd");
String resolved = resolver.resolveEntity(NON_EXISTING_DTD,
"urn:x-oasis:docbook-xml-v4.1.2").getSystemId();
URI real = new URI(resolved);
assertEquals(expected.toURI(), real);
resolved = resolver.resolveEntity(NON_EXISTING_DTD,
"urn:x-oasis:docbook-xml-v4.1.0").getSystemId();
URI resolvedURI = new URI(resolved);
assertEquals(new
URI("file:/home/kkoehler/share/doctypes/docbook/xml/docbookx.dtd"),
resolvedURI);
}
public void testNotFoundInCatalog() throws Exception {
resolver.setFailOnUnresolvable(false);
assertNull(resolver.resolveEntity(NON_EXISTING_DTD,
"urn:x-oasis:docbook-xml-v4.1.1"));
}
public void testFailOnUnresolvable() throws IOException {
resolver.setFailOnUnresolvable(true);
try {
resolver.resolveEntity(NON_EXISTING_DTD,
"urn:x-oasis:docbook-xml-v4.1.1");
fail("no exception is thrown");
} catch (SAXException e) {
//exception is desired
}
}
public void testAddPublicEntry() throws Exception {
resolver.addPublicMapping(NON_EXISTING_DTD,
"file:/home/kkoehler/geronimo/geronimo.dtd");
InputSource source = resolver.resolveEntity(NON_EXISTING_DTD,
"http://incubator.apache.org/geronimo/geronimo.dtd");
assertNotNull(source);
URI resolvedSystemId = new URI(source.getSystemId());
assertEquals(new URI("file:/home/kkoehler/geronimo/geronimo.dtd"),
resolvedSystemId);
}
public void testStaticCatalog() throws Exception {
resolver.addPublicMapping(NON_EXISTING_DTD,
"file:/home/kkoehler/geronimo/geronimo.dtd");
InputSource source = resolver.resolveEntity(NON_EXISTING_DTD,
"http://incubator.apache.org/geronimo/geronimo.dtd");
assertNotNull(source);
tearDown();
setUp();
resolver.setFailOnUnresolvable(false);
source = resolver.resolveEntity(NON_EXISTING_DTD,
"http://incubator.apache.org/geronimo/geronimo.dtd");
assertNull(source);
}
public void testAddSystemEntry() throws Exception {
resolver.addSystemMapping("urn:x-oasis:docbook-xml-v4.0.9",
"file:/home/kkoehler/geronimo/geronimo.dtd");
InputSource source = resolver.resolveEntity(NON_EXISTING_DTD,
"urn:x-oasis:docbook-xml-v4.0.9");
assertNotNull(source);
}
public void testLocalRepository() throws Exception {
File repo = new File(docDir, "localresolverrepository");
resolver.setLocalRepository(repo.getAbsolutePath());
InputSource source = resolver.resolveEntity(NON_EXISTING_DTD,
"c:\\work\\some.xsd");
assertNotNull(source);
source = resolver.resolveEntity(NON_EXISTING_DTD,
"/home/kkoehler/some.xsd");
assertNotNull(source);
resolver.setFailOnUnresolvable(false);
source = resolver.resolveEntity(NON_EXISTING_DTD, "not existing");
assertNull(source);
}
public void testNotFoundWithLocalRepository() throws Exception {
File repo = new File(docDir, "localresolverrepository");
resolver.setLocalRepository(repo.getAbsolutePath());
resolver.setFailOnUnresolvable(false);
InputSource source = resolver.resolveEntity(NON_EXISTING_DTD,
"http://incubator.apache.org/geronimo/geronimo.dtd");
assertNull(source);
}
public void testNullParameters() throws Exception {
resolver.setFailOnUnresolvable(false);
InputSource source = resolver.resolveEntity(null,
"http://incubator.apache.org/geronimo/geronimo.dtd");
assertNull(source);
source = resolver.resolveEntity(null,
"urn:x-oasis:docbook-xml-v4.1.0");
assertNotNull(source);
source = resolver.resolveEntity(NON_EXISTING_DTD, null);
assertNull(source);
source = resolver.resolveEntity("-//OASIS//DTD DocBook XML
V4.1.2//EN", null);
assertNotNull(source);
source = resolver.resolveEntity(null, null);
assertNull(source);
}
}
1.2 +1 -1
incubator-geronimo/modules/core/src/test-data/xml/deployment/geronimo-web-app-testRead.xml
Index: geronimo-web-app-testRead.xml
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test-data/xml/deployment/geronimo-web-app-testRead.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- geronimo-web-app-testRead.xml 18 Nov 2003 05:12:00 -0000 1.1
+++ geronimo-web-app-testRead.xml 5 Jan 2004 00:05:36 -0000 1.2
@@ -3,7 +3,7 @@
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:ger="http://geronimo.apache.org/xml/schema/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://geronimo.apache.org/xml/schema/j2ee/geronimo-web-app.xsd">
+
xsi:schemaLocation="http://geronimo.apache.org/xml/schema/j2ee/geronimo-web-app.xsd">
<security/>
1.2 +11 -2
incubator-geronimo/modules/core/src/test-data/xml/deployment/resolver-catalog.xml
Index: resolver-catalog.xml
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test-data/xml/deployment/resolver-catalog.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- resolver-catalog.xml 2 Jan 2004 23:32:39 -0000 1.1
+++ resolver-catalog.xml 5 Jan 2004 00:05:36 -0000 1.2
@@ -1,13 +1,22 @@
<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"/>
-
+ uri="sun/dtd/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"/>
+
+<public publicId="-//W3C//DTD XMLSCHEMA 200102//EN"
+ uri="../../../schema/XMLSchema.dtd"/>
+
+<public publicId="datatypes"
+ uri="../../../schema/datatypes.dtd"/>
+
+<public publicId="-//Sun Microsystems, Inc.//DTD Connector 1.0//EN"
+ uri="../../../schema/connector_1_0.dtd"/>
<system systemId="urn:x-oasis:docbook-xml-v4.1.2"
uri="docbook/xml/docbookx.dtd"/>
1.1
incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-dtd-example.xml
Index: simple-dtd-example.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- This is not valid and is tested! -->
<descriptio>My Description</descriptio>
</web-app>
1.1
incubator-geronimo/modules/core/src/test-data/xml/deployment/localresolverrepository/some.xsd
Index: some.xsd
===================================================================
NOTHING