You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2005/11/06 18:12:26 UTC
svn commit: r331117 - in /ibatis/trunk/java/mapper/mapper2: build/
src/com/ibatis/sqlmap/engine/builder/xml/ test/com/ibatis/sqlmap/builder/
test/com/ibatis/sqlmap/builder/xml/
Author: cbegin
Date: Sun Nov 6 09:12:21 2005
New Revision: 331117
URL: http://svn.apache.org/viewcvs?rev=331117&view=rev
Log:
Added entity resolver test and included new PUBLIC ID for ibatis.apache.org
Added:
ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/
ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/xml/
ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/xml/SqlMapClasspathEntityResolverTest.java
Modified:
ibatis/trunk/java/mapper/mapper2/build/version.properties
ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java
Modified: ibatis/trunk/java/mapper/mapper2/build/version.properties
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/build/version.properties?rev=331117&r1=331116&r2=331117&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/build/version.properties (original)
+++ ibatis/trunk/java/mapper/mapper2/build/version.properties Sun Nov 6 09:12:21 2005
@@ -1,5 +1,5 @@
#Build version info
-#Sat Nov 05 23:58:55 MST 2005
+#Sun Nov 06 09:57:40 MST 2005
version=2.1.6
-buildDate=2005/11/05 23\:58
-buildNum=589
+buildDate=2005/11/06 09\:57
+buildNum=590
Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java?rev=331117&r1=331116&r2=331117&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java (original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java Sun Nov 6 09:12:21 2005
@@ -20,11 +20,10 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import java.io.InputStream;
import java.io.IOException;
-import java.util.Map;
+import java.io.InputStream;
import java.util.HashMap;
-import java.util.Collections;
+import java.util.Map;
/**
* Offline entity resolver for the iBATIS DTDs
@@ -40,10 +39,12 @@
doctypeMap.put("http://www.ibatis.com/dtd/sql-map-config-2.dtd", SQL_MAP_CONFIG_DTD);
doctypeMap.put("http://ibatis.apache.org/dtd/sql-map-config-2.dtd", SQL_MAP_CONFIG_DTD);
doctypeMap.put("-//iBATIS.com//DTD SQL Map Config 2.0//EN", SQL_MAP_CONFIG_DTD);
+ doctypeMap.put("-//ibatis.apache.org//DTD SQL Map Config 2.0//EN", SQL_MAP_CONFIG_DTD);
doctypeMap.put("http://www.ibatis.com/dtd/sql-map-2.dtd", SQL_MAP_DTD);
doctypeMap.put("http://ibatis.apache.org/dtd/sql-map-2.dtd", SQL_MAP_DTD);
doctypeMap.put("-//iBATIS.com//DTD SQL Map 2.0//EN", SQL_MAP_DTD);
+ doctypeMap.put("-//ibatis.apache.org//DTD SQL Map 2.0//EN", SQL_MAP_DTD);
}
Added: ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/xml/SqlMapClasspathEntityResolverTest.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/xml/SqlMapClasspathEntityResolverTest.java?rev=331117&view=auto
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/xml/SqlMapClasspathEntityResolverTest.java (added)
+++ ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/builder/xml/SqlMapClasspathEntityResolverTest.java Sun Nov 6 09:12:21 2005
@@ -0,0 +1,78 @@
+package com.ibatis.sqlmap.builder.xml;
+
+import junit.framework.TestCase;
+import com.ibatis.sqlmap.engine.builder.xml.SqlMapClasspathEntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class SqlMapClasspathEntityResolverTest extends TestCase {
+
+ // ibatis.com
+
+ public void testComConfigSystemId() {
+ String id = "http://www.ibatis.com/dtd/sql-map-config-2.dtd";
+ assertSystemIdCanBeResolved(id);
+ }
+
+ public void testComConfigPublicId() {
+ String id = "-//iBATIS.com//DTD SQL Map Config 2.0//EN";
+ assertPublicIdCanBeResolved(id);
+ }
+
+ public void testComMapSystemId() {
+ String id = "http://www.ibatis.com/dtd/sql-map-2.dtd";
+ assertSystemIdCanBeResolved(id);
+ }
+
+ public void testComMapPublicId() {
+ String id = "-//iBATIS.com//DTD SQL Map 2.0//EN";
+ assertPublicIdCanBeResolved(id);
+ }
+
+ // ibatis.apache.org
+
+ public void testOrgConfigSystemId() {
+ String id = "http://ibatis.apache.org/dtd/sql-map-config-2.dtd";
+ assertSystemIdCanBeResolved(id);
+ }
+
+ public void testOrgConfigPublicId() {
+ String id = "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN";
+ assertPublicIdCanBeResolved(id);
+ }
+
+ public void testOrgMapSystemId() {
+ String id = "http://ibatis.apache.org/dtd/sql-map-2.dtd";
+ assertSystemIdCanBeResolved(id);
+ }
+
+ public void testOrgMapPublicId() {
+ String id = "-//ibatis.apache.org//DTD SQL Map 2.0//EN";
+ assertPublicIdCanBeResolved(id);
+ }
+
+ private void assertSystemIdCanBeResolved(String id) {
+ SqlMapClasspathEntityResolver resolver = new SqlMapClasspathEntityResolver();
+ try {
+ InputSource source = resolver.resolveEntity(null, id);
+ if (source == null) {
+ throw new RuntimeException("Could not resolve System ID " + id);
+ }
+ } catch (SAXException e) {
+ throw new RuntimeException("Error. Cause: " + e, e);
+ }
+ }
+
+ private void assertPublicIdCanBeResolved(String id) {
+ SqlMapClasspathEntityResolver resolver = new SqlMapClasspathEntityResolver();
+ try {
+ InputSource source = resolver.resolveEntity(id, null);
+ if (source == null) {
+ throw new RuntimeException("Could not resolve System ID " + id);
+ }
+ } catch (SAXException e) {
+ throw new RuntimeException("Error. Cause: " + e, e);
+ }
+ }
+
+}