db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1590782 - in /db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang: CastingTest.java _Suite.java
Date Mon, 28 Apr 2014 20:28:37 GMT
Author: myrnavl
Date: Mon Apr 28 20:28:36 2014
New Revision: 1590782

URL: http://svn.apache.org/r1590782
Log:
DERBY-6501; change 10.10 version of CastingTest.java to build/run under jsr169
  implementing a simple 'replace' method for the JSR169 case, and moving the test back to
its previous spot in the suite.

Modified:
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CastingTest.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CastingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CastingTest.java?rev=1590782&r1=1590781&r2=1590782&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CastingTest.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CastingTest.java
Mon Apr 28 20:28:36 2014
@@ -452,9 +452,9 @@ public static String[][]SQLData =
                                 // whether today or yesterday was used. Accept
                                 // both.
                                 String[] expectedValues = {
-                                    expected.replace(
+                                    replace(expected, 
                                       "TODAY", new Date(startTime).toString()),
-                                    expected.replace(
+                                    replace(expected,
                                       "TODAY", new Date(finishTime).toString()),
                                 };
 
@@ -1310,4 +1310,20 @@ public static String[][]SQLData =
     public static Test suite() {
         return TestConfiguration.defaultSuite(CastingTest.class);
     }
+    
+    private static String replace(String targetStr, String orgStr, String replaceStr)
+    {
+        if (JDBC.vmSupportsJSR169())
+        {
+            int startind = targetStr.indexOf(orgStr);
+            int orgstrlength = orgStr.length(); 
+            int endind = startind + orgstrlength;
+            String startchunk = targetStr.substring(0, startind);
+            String endchunk = targetStr.substring(endind);
+            String returnStr=startchunk + replaceStr + endchunk;
+            return returnStr;
+        }
+        else
+            return (targetStr.replace(orgStr, replaceStr));
+    }
 }

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1590782&r1=1590781&r2=1590782&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Mon Apr 28 20:28:36 2014
@@ -103,6 +103,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(UpdatableResultSetTest.suite());
         suite.addTest(CurrentOfTest.suite());
 	    suite.addTest(CursorTest.suite());
+        suite.addTest(CastingTest.suite());
         suite.addTest(ScrollCursors2Test.suite());
         suite.addTest(NullIfTest.suite());
         suite.addTest(InListMultiProbeTest.suite());
@@ -197,9 +198,6 @@ public class _Suite extends BaseTestCase
             // requires Java 5 (generics)
             suite.addTest(UserDefinedAggregatesTest.suite());
             suite.addTest(UDAPermsTest.suite());
-
-            // requires replace(CharSequence target, CharSequence replacement)
-            suite.addTest(CastingTest.suite());
         }
 
         // tests that require Java 6



Mime
View raw message