db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1586755 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang: LuceneSupportPermsTest.java LuceneSupportTest.java
Date Fri, 11 Apr 2014 19:15:17 GMT
Author: rhillegas
Date: Fri Apr 11 19:15:17 2014
New Revision: 1586755

URL: http://svn.apache.org/r1586755
Log:
DERBY-590: Fix locale-related errors which surfaced on some platforms during the Lucene tests;
commit derby-590-23-aa-correctTestLocale.diff.

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java?rev=1586755&r1=1586754&r2=1586755&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
Fri Apr 11 19:15:17 2014
@@ -149,13 +149,13 @@ public class LuceneSupportPermsTest exte
         
         TestSuite suite = (TestSuite) TestConfiguration.embeddedSuite(LuceneSupportPermsTest.class);
 
-        Test        localizedTest = new LocaleTestSetup( suite, new Locale( LANGUAGE, COUNTRY
) );
-        Test        secureTest = new SecurityManagerSetup( localizedTest, POLICY_FILE );
+        Test        secureTest = new SecurityManagerSetup( suite, POLICY_FILE );
         Test        authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication
             ( secureTest, LEGAL_USERS, "LuceneSupportPermissions" );
         Test        authorizedTest = TestConfiguration.sqlAuthorizationDecorator( authenticatedTest
);
+        Test        localizedTest = new LocaleTestSetup( authorizedTest, new Locale( LANGUAGE,
COUNTRY ) );
 
-        return authorizedTest;
+        return localizedTest;
     }
 
     ///////////////////////////////////////////////////////////////////////////////////

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java?rev=1586755&r1=1586754&r2=1586755&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
Fri Apr 11 19:15:17 2014
@@ -23,6 +23,7 @@ package org.apache.derbyTesting.function
 import java.sql.CallableStatement;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Locale;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -30,6 +31,7 @@ import junit.framework.TestSuite;
 import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.LocaleTestSetup;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
@@ -49,8 +51,11 @@ public class LuceneSupportTest extends B
 	
 	public static Test suite() {
 		TestSuite suite = new TestSuite("LuceneSupportTest");
+
+        Test    baseTest = TestConfiguration.embeddedSuite(LuceneSupportTest.class);
+        Test        localizedTest = new LocaleTestSetup( baseTest, new Locale( "en", "US"
) );
 		
-		suite.addTest(SecurityManagerSetup.noSecurityManager(TestConfiguration.embeddedSuite(LuceneSupportTest.class)));
+		suite.addTest(SecurityManagerSetup.noSecurityManager(localizedTest));
  
 		return suite;
 	}
@@ -58,6 +63,26 @@ public class LuceneSupportTest extends B
 	public void testCreateAndQueryIndex() throws Exception {
 		CallableStatement cSt;
 		Statement s = createStatement();
+
+        // verify that we are in an en Locale
+        getConnection().prepareStatement
+            (
+             "create function getDatabaseLocale() returns varchar( 20 )\n" +
+             "language java parameter style java reads sql data\n" +
+             "external name 'org.apache.derbyTesting.functionTests.tests.lang.LuceneSupportPermsTest.getDatabaseLocale()'\n"
+             ).executeUpdate();
+	    JDBC.assertFullResultSet
+            (
+             s.executeQuery
+             (
+              "values ( substr( getDatabaseLocale(), 1, 2 ) )"
+              ),
+             new String[][]
+             {
+                 { "en" }
+             }
+             );
+        getConnection().prepareStatement( "drop function getDatabaseLocale" ).executeUpdate();
 	    
 		cSt = prepareCall
             ( "call LuceneSupport.createIndex('lucenetest','titles','title', null )" );



Mime
View raw message