db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1488120 - in /db/derby/code/branches/10.9: ./ java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLBindingTest.java java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
Date Fri, 31 May 2013 07:36:58 GMT
Author: kahatlen
Date: Fri May 31 07:36:58 2013
New Revision: 1488120

URL: http://svn.apache.org/r1488120
Log:
DERBY-6233: XMLBindingTest fails on latest JDK 8 EA

Merged revision 1488116 from trunk.

Modified:
    db/derby/code/branches/10.9/   (props changed)
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLBindingTest.java
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java

Propchange: db/derby/code/branches/10.9/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1488116

Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLBindingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLBindingTest.java?rev=1488120&r1=1488119&r2=1488120&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLBindingTest.java
(original)
+++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLBindingTest.java
Fri May 31 07:36:58 2013
@@ -21,12 +21,9 @@
 
 package org.apache.derbyTesting.functionTests.tests.lang;
 
-import java.io.InputStreamReader;
-
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.sql.Statement;
 import java.sql.Types;
 
 import junit.framework.Test;
@@ -37,6 +34,7 @@ import org.apache.derbyTesting.junit.XML
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 import org.apache.derbyTesting.junit.SupportFilesSetup;
+import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
@@ -78,18 +76,27 @@ public class XMLBindingTest extends Base
              * database before the embedded and client suites.  This ensures
              * that we do not remove the objects created by XBindTestSetup.
              */
-            suite.addTest(
-                TestConfiguration.defaultSuite(XMLBindingTest.class, false));
+            Test test =
+                TestConfiguration.defaultSuite(XMLBindingTest.class, false);
 
-            XBindTestSetup wrapper = new XBindTestSetup(suite);
+            test = new XBindTestSetup(test);
 
             /* XML parser needs to read "personal.dtd" for schema-based
              * insertion, so copy it to user directory.
              */
-            return new SupportFilesSetup(wrapper,
+            test = new SupportFilesSetup(test,
                 new String [] {
                     "functionTests/tests/lang/xmlTestFiles/personal.dtd"
                 });
+
+            // JEP 185 (http://openjdk.java.net/jeps/185) in Java SE 8 added
+            // restrictions on access to external resources. This system
+            // property loosens the restriction so that the XML parser is
+            // allowed to read the DTD.
+            test = SystemPropertyTestSetup.singleProperty(
+                    test, "javax.xml.accessExternalDTD", "file");
+
+            suite.addTest(test);
         }
 
         return suite;
@@ -266,8 +273,8 @@ public class XMLBindingTest extends Base
      */
     private static class XBindTestSetup extends BaseJDBCTestSetup
     {
-        public XBindTestSetup(TestSuite tSuite) {
-            super(tSuite);
+        public XBindTestSetup(Test test) {
+            super(test);
         }
 
         /**

Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java?rev=1488120&r1=1488119&r2=1488120&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
(original)
+++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
Fri May 31 07:36:58 2013
@@ -68,6 +68,31 @@ public class SystemPropertyTestSetup ext
 		this.newValues = newValues;
 		this.staticProperties = false;
 	}
+
+    /**
+     * Decorate a test so that it sets a single system property in
+     * {@code setUp()} and resets it in {@code tearDown()}. The engine is
+     * not shut down after the property is set.
+     */
+    public static Test singleProperty(Test test, String property, String value)
+    {
+        return singleProperty(test, property, value, false);
+    }
+
+    /**
+     * Decorate a test so that it sets a single system property in
+     * {@code setUp()} and resets it in {@code tearDown()}. The engine is
+     * shut down after the property is set if {@code staticProperty} is
+     * {@code true}.
+     */
+    public static Test singleProperty(Test test, String property, String value,
+            boolean staticProperty)
+    {
+        Properties properties = new Properties();
+        properties.setProperty(property, value);
+        return new SystemPropertyTestSetup(test, properties, staticProperty);
+    }
+
 	/**
 	 * For each property store the current value and
 	 * replace it with the new value, unless there is no change.



Mime
View raw message