You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2016/02/09 16:37:18 UTC

svn commit: r1729402 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLXXETest.java

Author: kahatlen
Date: Tue Feb  9 15:37:17 2016
New Revision: 1729402

URL: http://svn.apache.org/viewvc?rev=1729402&view=rev
Log:
DERBY-6869: XMLXXETest fails in non-English locales

Decorate the test with a LocaleTestSetup that forces it to run in US
locale, so that it always sees English error messages.

Change the failing assert so that it reports the original exception in
case it doesn't get the expected exception. Makes it easier to debug
the test.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLXXETest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLXXETest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLXXETest.java?rev=1729402&r1=1729401&r2=1729402&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLXXETest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLXXETest.java Tue Feb  9 15:37:17 2016
@@ -23,22 +23,17 @@ import java.io.File;
 import java.io.PrintWriter;
 import java.net.URL;
 
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
-import java.sql.SQLWarning;
 import java.sql.Statement;
-import java.sql.Types;
+import java.util.Locale;
 
 import junit.framework.Test;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
-import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 import org.apache.derbyTesting.junit.BaseTestSuite;
 import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.LocaleTestSetup;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 import org.apache.derbyTesting.junit.SupportFilesSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
@@ -84,8 +79,11 @@ public final class XMLXXETest extends Ba
 			TestConfiguration.defaultSuite(XMLXXETest.class),
 			testFiles ) );
 
-
-        return SecurityManagerSetup.noSecurityManager(suite);
+        // Need to run in US locale because the test checks error messages
+        // which may be different in different locales (DERBY-6869).
+        return new LocaleTestSetup(
+                SecurityManagerSetup.noSecurityManager(suite),
+                Locale.US);
     }
  
     /**
@@ -250,7 +248,9 @@ String xmlBillionLaughs = "insert into x
 		// This next line will need to change once DERBY-6807 is fixed:
 		fail( "Expected SAXParseException" );
 	} catch ( Throwable e ) {
-		assertTrue( e.getMessage().indexOf( "entity expansions" ) > 0 );
+        if (!e.getMessage().contains("entity expansions")) {
+            fail("Expected SAXParseException", e);
+        }
 	}
     }
 }