phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [1/5] git commit: PHOENIX-834 Unit tests fail if default locale is not en_US (GabrielReid)
Date Wed, 12 Mar 2014 00:33:28 GMT
Repository: incubator-phoenix
Updated Branches:
  refs/heads/master cb7763d3d -> 3e684149d


PHOENIX-834 Unit tests fail if default locale is not en_US (GabrielReid)


Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/1ccb3f6c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/1ccb3f6c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/1ccb3f6c

Branch: refs/heads/master
Commit: 1ccb3f6cb0a74e591a74c29216d25a669eacd6d6
Parents: cb7763d
Author: jamestaylor <jamestaylor@apache.org>
Authored: Tue Mar 11 15:56:29 2014 -0700
Committer: jamestaylor <jamestaylor@apache.org>
Committed: Tue Mar 11 17:29:19 2014 -0700

----------------------------------------------------------------------
 .../phoenix/compile/WhereCompilerTest.java       |  2 +-
 .../phoenix/end2end/ToNumberFunctionTest.java    | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/1ccb3f6c/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereCompilerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereCompilerTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereCompilerTest.java
index 54a8738..5122963 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereCompilerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereCompilerTest.java
@@ -322,7 +322,7 @@ public class WhereCompilerTest extends BaseConnectionlessQueryTest {
 
     @Test
     public void testToNumberFilterWithPatternParam() throws Exception {
-        String toNumberClause = "to_number('$1.23333E2', '\u00A40.00000E0')";
+        String toNumberClause = "to_number('!1.23333E2', '!0.00000E0')";
         BigDecimal expectedDecimal = NumberUtil.normalize(new BigDecimal("123.333"));
         helpTestToNumberFilter(toNumberClause, expectedDecimal);
     }

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/1ccb3f6c/phoenix-core/src/test/java/org/apache/phoenix/end2end/ToNumberFunctionTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/ToNumberFunctionTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/end2end/ToNumberFunctionTest.java
index 77bd3cb..3b6b8e6 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/ToNumberFunctionTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/end2end/ToNumberFunctionTest.java
@@ -31,9 +31,12 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.util.Locale;
 import java.util.Properties;
 
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import org.apache.phoenix.schema.PDataType;
@@ -47,6 +50,9 @@ import org.apache.phoenix.util.PhoenixRuntime;
  * @since 0.1
  */
 public class ToNumberFunctionTest extends BaseClientManagedTimeTest {
+
+    // This test changes to locale to en_US, and saves the previous locale here
+    private static Locale saveLocale;
     
     public static final String TO_NUMBER_TABLE_NAME = "TO_NUMBER_TABLE";
     
@@ -68,7 +74,18 @@ public class ToNumberFunctionTest extends BaseClientManagedTimeTest {
     private Timestamp row1Timestamp;
     private Timestamp row2Timestamp;
     private Timestamp row3Timestamp;
-    
+
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        saveLocale = Locale.getDefault();
+        Locale.setDefault(Locale.US);
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() {
+        Locale.setDefault(saveLocale);
+    }
+
     @Before
     public void initTable() throws Exception {
         long ts = nextTimestamp();


Mime
View raw message