You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/07/17 08:31:04 UTC
svn commit: r556825 [8/10] - in
/harmony/enhanced/classlib/branches/java6/modules:
archive/src/main/java/java/util/jar/ archive/src/main/java/java/util/zip/
archive/src/main/java/org/apache/harmony/archive/internal/nls/
archive/src/main/java/org/apache...
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java Mon Jul 16 23:30:22 2007
@@ -17,20 +17,19 @@
package org.apache.harmony.sql.tests.java.sql;
-
/**
* TODO Type description
*
*/
public class TestHelper_Driver3 extends TestHelper_Driver1 {
- /*
- * This driver does NOT automatically register itself...
- */
+ /*
+ * This driver does NOT automatically register itself...
+ */
- public TestHelper_Driver3() {
- super();
- baseURL = "jdbc:mikes3";
- } // end constructor TestHelper_Driver1()
+ public TestHelper_Driver3() {
+ super();
+ baseURL = "jdbc:mikes3";
+ } // end constructor TestHelper_Driver1()
} // end class TestHelper_Driver3
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java Mon Jul 16 23:30:22 2007
@@ -92,10 +92,13 @@
String user = (String) info.get(userProperty);
String password = (String) info.get(passwordProperty);
if (user == null || password == null) {
- throw new SQLException("Userid and/or password not supplied");
+ throw new SQLException(
+ "Userid and/or password not supplied");
}
- if (!user.equals(validuser) || !password.equals(validpassword)) {
- throw new SQLException("Userid and/or password not valid");
+ if (!user.equals(validuser)
+ || !password.equals(validpassword)) {
+ throw new SQLException(
+ "Userid and/or password not valid");
} // end if
} // end if
// It all checks out - so return a connection
@@ -117,7 +120,8 @@
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException {
- DriverPropertyInfo[] theInfos = { new DriverPropertyInfo(userProperty, "*"),
+ DriverPropertyInfo[] theInfos = {
+ new DriverPropertyInfo(userProperty, "*"),
new DriverPropertyInfo(passwordProperty, "*"), };
return theInfos;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver5.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver5.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver5.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver5.java Mon Jul 16 23:30:22 2007
@@ -27,18 +27,18 @@
*/
public class TestHelper_Driver5 extends TestHelper_Driver4 {
- static {
- Driver theDriver = new TestHelper_Driver5();
- try {
- DriverManager.registerDriver(theDriver);
- } catch (SQLException e) {
- System.out.println("Failed to register driver!");
- }
- } // end static block initializer
+ static {
+ Driver theDriver = new TestHelper_Driver5();
+ try {
+ DriverManager.registerDriver(theDriver);
+ } catch (SQLException e) {
+ System.out.println("Failed to register driver!");
+ }
+ } // end static block initializer
- protected TestHelper_Driver5() {
- super();
- baseURL = "jdbc:mikes5";
- } // end constructor TestHelper_Driver5()
+ protected TestHelper_Driver5() {
+ super();
+ baseURL = "jdbc:mikes5";
+ } // end constructor TestHelper_Driver5()
} // end class TestHelper_Driver5
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_DriverManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_DriverManager.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_DriverManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_DriverManager.java Mon Jul 16 23:30:22 2007
@@ -31,83 +31,80 @@
*/
public class TestHelper_DriverManager extends TestCase {
- static Driver testDriver = null;
+ static Driver testDriver = null;
- static TestHelper_DriverManager theHelper;
+ static TestHelper_DriverManager theHelper;
- static {
- theHelper = new TestHelper_DriverManager();
- // theHelper.testDeregister();
- } // end static
-
- public TestHelper_DriverManager() {
- super();
- } // end constructor TestHelper_DriverManager()
-
- public static void setDriver(Driver theDriver) {
- testDriver = theDriver;
- // System.out.println("TestHelper_DriverManager: Test Driver set!");
-
- theHelper.checkDeregister();
- } // end method setDriver( Driver )
-
- public void checkDeregister() {
-
- String baseURL = "jdbc:mikes1";
-
- // System.out.println("Calling checkDeregister in
- // TestHelper_DriverManager....");
-
- Driver aDriver;
-
- // System.out.println("checkDeregister classloader: " +
- // this.getClass().getClassLoader() );
-
- // Try to get a driver from the general pool... this should fail
- try {
- aDriver = DriverManager.getDriver(baseURL);
- fail(
- "testDeregisterDriver: Didn't get exception when getting valid driver from other classloader.");
- } catch (SQLException e) {
- // e.printStackTrace();
- assertTrue(
- "testDeregisterDriver: Got exception when getting valid driver from other classloader.",
- true);
- // return;
- } // end try
-
- // OK, now THIS driver was loaded by someone else....
- aDriver = testDriver;
-
- // printClassLoader( aDriver );
-
- // Deregister this driver
- try {
- DriverManager.deregisterDriver(aDriver);
- // We shouldn't get here - but if we do, we need to re-register the
- // driver to
- // prevent subsequent tests from failing due to inability to get to
- // this driver...
- DriverManager.registerDriver(aDriver);
- fail(
- "checkDeregisterDriver: Didn't get Security Exception deregistering invalid driver.");
- } catch (SecurityException s) {
- // This is the exception we should get...
- // System.out.println("checkDeregisterDriver: got expected Security
- // Exception");
- } catch (Exception e) {
- fail(
- "checkDeregisterDriver: Got wrong exception type when deregistering invalid driver.");
- } // end try
-
- } // end method testDeRegister
-
- static void printClassLoader(Object theObject) {
- Class<? extends Object> theClass = theObject.getClass();
- ClassLoader theClassLoader = theClass.getClassLoader();
- System.out.println("ClassLoader is: " + theClassLoader.toString()
- + " for object: " + theObject.toString());
- } // end method printClassLoader( Object )
+ static {
+ theHelper = new TestHelper_DriverManager();
+ // theHelper.testDeregister();
+ } // end static
+
+ public TestHelper_DriverManager() {
+ super();
+ } // end constructor TestHelper_DriverManager()
+
+ public static void setDriver(Driver theDriver) {
+ testDriver = theDriver;
+ // System.out.println("TestHelper_DriverManager: Test Driver set!");
+
+ theHelper.checkDeregister();
+ } // end method setDriver( Driver )
+
+ public void checkDeregister() {
+
+ String baseURL = "jdbc:mikes1";
+
+ // System.out.println("Calling checkDeregister in
+ // TestHelper_DriverManager....");
+
+ Driver aDriver;
+
+ // System.out.println("checkDeregister classloader: " +
+ // this.getClass().getClassLoader() );
+
+ // Try to get a driver from the general pool... this should fail
+ try {
+ aDriver = DriverManager.getDriver(baseURL);
+ fail("testDeregisterDriver: Didn't get exception when getting valid driver from other classloader.");
+ } catch (SQLException e) {
+ // e.printStackTrace();
+ assertTrue(
+ "testDeregisterDriver: Got exception when getting valid driver from other classloader.",
+ true);
+ // return;
+ } // end try
+
+ // OK, now THIS driver was loaded by someone else....
+ aDriver = testDriver;
+
+ // printClassLoader( aDriver );
+
+ // Deregister this driver
+ try {
+ DriverManager.deregisterDriver(aDriver);
+ // We shouldn't get here - but if we do, we need to re-register the
+ // driver to
+ // prevent subsequent tests from failing due to inability to get to
+ // this driver...
+ DriverManager.registerDriver(aDriver);
+ fail("checkDeregisterDriver: Didn't get Security Exception deregistering invalid driver.");
+ } catch (SecurityException s) {
+ // This is the exception we should get...
+ // System.out.println("checkDeregisterDriver: got expected Security
+ // Exception");
+ } catch (Exception e) {
+ fail("checkDeregisterDriver: Got wrong exception type when deregistering invalid driver.");
+ } // end try
+
+ } // end method testDeRegister
+
+ static void printClassLoader(Object theObject) {
+ Class<? extends Object> theClass = theObject.getClass();
+ ClassLoader theClassLoader = theClass.getClassLoader();
+ System.out.println("ClassLoader is: " + theClassLoader.toString()
+ + " for object: " + theObject.toString());
+ } // end method printClassLoader( Object )
} // end class TestHelper_DriverManager
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java Mon Jul 16 23:30:22 2007
@@ -26,9 +26,9 @@
// Install SecurityManager
System.setSecurityManager(new SecurityManager());
// Load java.sql.DriverManager and it will invoke its <clinit> method
- try{
+ try {
Class.forName("java.sql.DriverManager");
- }catch (ExceptionInInitializerError e){
+ } catch (ExceptionInInitializerError e) {
// ExceptionInInitializerError is caused by AccessControlException
throw e.getException();
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java Mon Jul 16 23:30:22 2007
@@ -28,277 +28,276 @@
*/
public class TimeTest extends TestCase {
- static long TIME_TEST1 = 38720000; // 10:45:20 GMT
+ static long TIME_TEST1 = 38720000; // 10:45:20 GMT
- static long TIME_TEST2 = 80279000; // 22:17:59 GMT
+ static long TIME_TEST2 = 80279000; // 22:17:59 GMT
- static long TIME_TEST3 = -38720000; // 13:14:40 GMT
+ static long TIME_TEST3 = -38720000; // 13:14:40 GMT
- static String STRING_TEST1 = "10:45:20";
+ static String STRING_TEST1 = "10:45:20";
- static String STRING_TEST2 = "22:17:59";
+ static String STRING_TEST2 = "22:17:59";
- static String STRING_TEST3 = "13:14:40";
+ static String STRING_TEST3 = "13:14:40";
- static String STRING_INVALID1 = "ABCDEFGHI";
+ static String STRING_INVALID1 = "ABCDEFGHI";
- static String STRING_INVALID2 = "233104";
+ static String STRING_INVALID2 = "233104";
- static String STRING_INVALID3 = "21-43-48";
+ static String STRING_INVALID3 = "21-43-48";
- static String STRING_OUTRANGE = "35:99:66";
+ static String STRING_OUTRANGE = "35:99:66";
- static long[] TIME_ARRAY = { TIME_TEST1, TIME_TEST2, TIME_TEST3 };
+ static long[] TIME_ARRAY = { TIME_TEST1, TIME_TEST2, TIME_TEST3 };
- static String[] STRING_GMT_ARRAY = { STRING_TEST1, STRING_TEST2,
- STRING_TEST3 };
+ static String[] STRING_GMT_ARRAY = { STRING_TEST1, STRING_TEST2,
+ STRING_TEST3 };
- static String[] STRING_LA_ARRAY = { "02:45:20", "14:17:59", "05:14:40" };
+ static String[] STRING_LA_ARRAY = { "02:45:20", "14:17:59", "05:14:40" };
- static String[] STRING_JP_ARRAY = { "19:45:20", "07:17:59", "22:14:40" };
+ static String[] STRING_JP_ARRAY = { "19:45:20", "07:17:59", "22:14:40" };
- static String[] INVALID_STRINGS = { STRING_INVALID1, STRING_INVALID2,
- STRING_INVALID3 };
+ static String[] INVALID_STRINGS = { STRING_INVALID1, STRING_INVALID2,
+ STRING_INVALID3 };
- // Timezones
- static String TZ_LONDON = "GMT"; // GMT (!) PS London != GMT (?!?)
+ // Timezones
+ static String TZ_LONDON = "GMT"; // GMT (!) PS London != GMT (?!?)
- static String TZ_PACIFIC = "America/Los_Angeles"; // GMT - 8
+ static String TZ_PACIFIC = "America/Los_Angeles"; // GMT - 8
- static String TZ_JAPAN = "Asia/Tokyo"; // GMT + 9
+ static String TZ_JAPAN = "Asia/Tokyo"; // GMT + 9
- static String[] TIMEZONES = { TZ_LONDON, TZ_PACIFIC, TZ_JAPAN };
+ static String[] TIMEZONES = { TZ_LONDON, TZ_PACIFIC, TZ_JAPAN };
- static String[][] STRING_ARRAYS = { STRING_GMT_ARRAY, STRING_LA_ARRAY,
- STRING_JP_ARRAY };
+ static String[][] STRING_ARRAYS = { STRING_GMT_ARRAY, STRING_LA_ARRAY,
+ STRING_JP_ARRAY };
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testTimeintintint() {
- Time theTime = new Time(10, 45, 20);
+ Time theTime = new Time(10, 45, 20);
- // The date should have been created
- assertNotNull(theTime);
- } // end method testTimeintintint()
-
- public void testTime() {
- Time theTime = new Time(TIME_TEST1);
-
- // The date should have been created
- assertNotNull(theTime);
- } // end method testTime()
-
- public void testToString() {
- // Loop through the timezones testing the String conversion for each
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- testToString(TIMEZONES[i], TIME_ARRAY, STRING_ARRAYS[i]);
- } // end for
-
- } // end method test
-
- private void testToString(String timeZone, long[] theTimes,
- String[] theTimeStrings) {
- // Set the timezone
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
-
- for (int i = 0; i < theTimes.length; i++) {
- // Create the Time object
- Time theTime = new Time(theTimes[i]);
- // Convert to a time string ... and compare
- String JDBCString = theTime.toString();
- assertEquals(theTimeStrings[i], JDBCString);
- } // end for
-
- } // end testToString( String, long[], String[] )
-
- /*
- * Method test for valueOf
- */
- public void testValueOfString() {
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
-
-
- Time[] theReturns = { new Time(38720000), new Time(80279000),
- new Time(47680000)};
- String[] validTime = { "10:45:20", "22:17:59", "13:14:40", };
+ // The date should have been created
+ assertNotNull(theTime);
+ } // end method testTimeintintint()
+
+ public void testTime() {
+ Time theTime = new Time(TIME_TEST1);
+
+ // The date should have been created
+ assertNotNull(theTime);
+ } // end method testTime()
+
+ public void testToString() {
+ // Loop through the timezones testing the String conversion for each
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ testToString(TIMEZONES[i], TIME_ARRAY, STRING_ARRAYS[i]);
+ } // end for
+
+ } // end method test
+
+ private void testToString(String timeZone, long[] theTimes,
+ String[] theTimeStrings) {
+ // Set the timezone
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ for (int i = 0; i < theTimes.length; i++) {
+ // Create the Time object
+ Time theTime = new Time(theTimes[i]);
+ // Convert to a time string ... and compare
+ String JDBCString = theTime.toString();
+ assertEquals(theTimeStrings[i], JDBCString);
+ } // end for
+
+ } // end testToString( String, long[], String[] )
+
+ /*
+ * Method test for valueOf
+ */
+ public void testValueOfString() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+
+ Time[] theReturns = { new Time(38720000), new Time(80279000),
+ new Time(47680000) };
+ String[] validTime = { "10:45:20", "22:17:59", "13:14:40", };
String[] invalidTime = { null, "ABCDEFGHI", "233104", "21-43-48" };
-
- for (int i = 0; i < validTime.length; i++) {
+
+ for (int i = 0; i < validTime.length; i++) {
Time theReturn = Time.valueOf(validTime[i]);
- assertEquals(theReturns[i], theReturn);
- } // end for
-
+ assertEquals(theReturns[i], theReturn);
+ } // end for
+
for (String element : invalidTime) {
try {
Time.valueOf(element);
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
}
- } // end method testValueOfString
+ } // end method testValueOfString
- public void testSetTime() {
- // Ensure that the timezone is set to GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ public void testSetTime() {
+ // Ensure that the timezone is set to GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
assertEquals(STRING_TEST1, theTime.toString());
- theTime.setTime(TIME_TEST2);
+ theTime.setTime(TIME_TEST2);
assertEquals(STRING_TEST2, theTime.toString());
- } // end method testSetTime()
+ } // end method testSetTime()
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testSetDate() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.setDate(10);
+ try {
+ theTime.setDate(10);
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method testSetDate()
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method testSetDate()
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testSetMonth() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.setMonth(2);
+ try {
+ theTime.setMonth(2);
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method testSetMonth()
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method testSetMonth()
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testSetYear() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.setYear(99);
+ try {
+ theTime.setYear(99);
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method testSetYear()
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method testSetYear()
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testGetDate() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.getDate();
+ try {
+ theTime.getDate();
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method test
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method test
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testGetDay() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.getDay();
+ try {
+ theTime.getDay();
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method test
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method test
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testGetMonth() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.getMonth();
+ try {
+ theTime.getMonth();
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method test
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method test
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation")
public void testGetYear() {
- Time theTime = new Time(TIME_TEST1);
+ Time theTime = new Time(TIME_TEST1);
- try {
- theTime.getYear();
+ try {
+ theTime.getYear();
fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
- } // end method test
-
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+ } // end method test
+
/**
* @tests java.sql.Time#valueOf(String )
*/
- public void test_valueOf_IllegalArgumentException() {
- try{
- Time.valueOf("15:43:12:34");
- fail("should throw NumberFormatException");
- } catch (NumberFormatException e) {
- //expected
- }
-
- try{
- Time.valueOf(":10:07:01");
- fail("should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- }
-
- try{
- Time.valueOf("::01");
- fail("should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- }
-
- try{
- Time.valueOf("11::");
- fail("should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- }
-
- try{
- Time.valueOf(":01:");
- fail("should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- }
-
- try{
- Time.valueOf(":10:w2:01");
- fail("should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- }
-
- try{
- Time.valueOf("07:w2:");
- fail("should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- }
-
- try{
- Time.valueOf("17:w2:w2");
- fail("should throw NumberFormatException");
- } catch (NumberFormatException e) {
- //expected
- }
-
- try{
- Time.valueOf("16::01");
- fail("should throw NumberFormatException");
- } catch (NumberFormatException e) {
- //expected
- }
+ public void test_valueOf_IllegalArgumentException() {
+ try {
+ Time.valueOf("15:43:12:34");
+ fail("should throw NumberFormatException");
+ } catch (NumberFormatException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf(":10:07:01");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf("::01");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf("11::");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf(":01:");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf(":10:w2:01");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf("07:w2:");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf("17:w2:w2");
+ fail("should throw NumberFormatException");
+ } catch (NumberFormatException e) {
+ // expected
+ }
+
+ try {
+ Time.valueOf("16::01");
+ fail("should throw NumberFormatException");
+ } catch (NumberFormatException e) {
+ // expected
}
+ }
} // end class TimeTest
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java Mon Jul 16 23:30:22 2007
@@ -31,134 +31,133 @@
public class TimestampTest extends TestCase {
- static long TIME_TEST1 = 38720231; // 10:45:20.231 GMT
+ static long TIME_TEST1 = 38720231; // 10:45:20.231 GMT
- static long TIME_TEST2 = 80279000; // 22:17:59.000 GMT
+ static long TIME_TEST2 = 80279000; // 22:17:59.000 GMT
- static long TIME_TEST3 = -38720691; // 13:14:39.309 GMT
+ static long TIME_TEST3 = -38720691; // 13:14:39.309 GMT
- static long TIME_COMPARE = 123498845;
+ static long TIME_COMPARE = 123498845;
- static long TIME_EARLY = -2347889122L;// A time well before the Epoch
+ static long TIME_EARLY = -2347889122L;// A time well before the Epoch
- static long TIME_LATE = 2347889122L; // A time well after the Epoch
+ static long TIME_LATE = 2347889122L; // A time well after the Epoch
- static String STRING_TEST1 = "1970-01-01 10:45:20.231"; // "1970-01-01
- // 10:45:20.231000000";
+ static String STRING_TEST1 = "1970-01-01 10:45:20.231"; // "1970-01-01
- static String STRING_TEST2 = "1970-01-01 22:17:59.0"; // "1970-01-01
- // 22:17:59.000000000";
+ // 10:45:20.231000000";
- static String STRING_TEST3 = "1969-12-31 13:14:39.309"; // "1969-12-31
- // 13:14:39.309000000";
+ static String STRING_TEST2 = "1970-01-01 22:17:59.0"; // "1970-01-01
- static String STRING_INVALID1 = "ABCDEFGHI";
+ // 22:17:59.000000000";
- static String STRING_INVALID2 = "233104";
+ static String STRING_TEST3 = "1969-12-31 13:14:39.309"; // "1969-12-31
- static String STRING_INVALID3 = "21-43-48";
+ // 13:14:39.309000000";
- // A timepoint in the correct format but with numeric values out of range
- // ...this is accepted despite being a crazy date specification
- // ...it is treated as the correct format date 3000-06-08 12:40:06.875 !!
- static String STRING_OUTRANGE = "2999-15-99 35:99:66.875";
+ static String STRING_INVALID1 = "ABCDEFGHI";
- static long[] TIME_ARRAY = { TIME_TEST1, TIME_TEST2, TIME_TEST3 };
+ static String STRING_INVALID2 = "233104";
- static int[] YEAR_ARRAY = { 70, 70, 69 };
+ static String STRING_INVALID3 = "21-43-48";
- static int[] MONTH_ARRAY = { 0, 0, 11 };
+ // A timepoint in the correct format but with numeric values out of range
+ // ...this is accepted despite being a crazy date specification
+ // ...it is treated as the correct format date 3000-06-08 12:40:06.875 !!
+ static String STRING_OUTRANGE = "2999-15-99 35:99:66.875";
- static int[] DATE_ARRAY = { 1, 1, 31 };
+ static long[] TIME_ARRAY = { TIME_TEST1, TIME_TEST2, TIME_TEST3 };
- static int[] HOURS_ARRAY = { 10, 22, 13 };
+ static int[] YEAR_ARRAY = { 70, 70, 69 };
- static int[] MINUTES_ARRAY = { 45, 17, 14 };
+ static int[] MONTH_ARRAY = { 0, 0, 11 };
- static int[] SECONDS_ARRAY = { 20, 59, 39 };
+ static int[] DATE_ARRAY = { 1, 1, 31 };
- static int[] NANOS_ARRAY = { 231000000, 000000000, 309000000 };
+ static int[] HOURS_ARRAY = { 10, 22, 13 };
- static int[] NANOS_ARRAY2 = { 137891990, 635665198, 109985421 };
+ static int[] MINUTES_ARRAY = { 45, 17, 14 };
- static String[] STRING_NANOS_ARRAY = { "1970-01-01 10:45:20.13789199",
- "1970-01-01 22:17:59.635665198", "1969-12-31 13:14:39.109985421" };
+ static int[] SECONDS_ARRAY = { 20, 59, 39 };
- static String[] STRING_GMT_ARRAY = { STRING_TEST1, STRING_TEST2,
- STRING_TEST3 };
+ static int[] NANOS_ARRAY = { 231000000, 000000000, 309000000 };
- static String[] STRING_LA_ARRAY = { "02:45:20", "14:17:59", "05:14:40" };
+ static int[] NANOS_ARRAY2 = { 137891990, 635665198, 109985421 };
- static String[] STRING_JP_ARRAY = { "19:45:20", "07:17:59", "22:14:40" };
+ static String[] STRING_NANOS_ARRAY = { "1970-01-01 10:45:20.13789199",
+ "1970-01-01 22:17:59.635665198", "1969-12-31 13:14:39.109985421" };
- static String[] INVALID_STRINGS = { STRING_INVALID1, STRING_INVALID2,
- STRING_INVALID3 };
+ static String[] STRING_GMT_ARRAY = { STRING_TEST1, STRING_TEST2,
+ STRING_TEST3 };
- // Timezones
- static String TZ_LONDON = "GMT"; // GMT (!) PS London != GMT (?!?)
+ static String[] STRING_LA_ARRAY = { "02:45:20", "14:17:59", "05:14:40" };
- static String TZ_PACIFIC = "America/Los_Angeles"; // GMT - 8
+ static String[] STRING_JP_ARRAY = { "19:45:20", "07:17:59", "22:14:40" };
- static String TZ_JAPAN = "Asia/Tokyo"; // GMT + 9
+ static String[] INVALID_STRINGS = { STRING_INVALID1, STRING_INVALID2,
+ STRING_INVALID3 };
- static String[] TIMEZONES = { TZ_LONDON, TZ_PACIFIC, TZ_JAPAN };
+ // Timezones
+ static String TZ_LONDON = "GMT"; // GMT (!) PS London != GMT (?!?)
- static String[][] STRING_ARRAYS = { STRING_GMT_ARRAY, STRING_LA_ARRAY,
- STRING_JP_ARRAY };
+ static String TZ_PACIFIC = "America/Los_Angeles"; // GMT - 8
- /*
- * Constructor test
- */
- public void testTimestamplong() {
- Timestamp theTimestamp = new Timestamp(TIME_TEST1);
+ static String TZ_JAPAN = "Asia/Tokyo"; // GMT + 9
- // The Timestamp should have been created
- assertNotNull(theTimestamp);
- } // end method testTimestamplong
+ static String[] TIMEZONES = { TZ_LONDON, TZ_PACIFIC, TZ_JAPAN };
- /*
- * Constructor test
- */
- @SuppressWarnings("deprecation")
+ static String[][] STRING_ARRAYS = { STRING_GMT_ARRAY, STRING_LA_ARRAY,
+ STRING_JP_ARRAY };
+
+ /*
+ * Constructor test
+ */
+ public void testTimestamplong() {
+ Timestamp theTimestamp = new Timestamp(TIME_TEST1);
+
+ // The Timestamp should have been created
+ assertNotNull(theTimestamp);
+ } // end method testTimestamplong
+
+ /*
+ * Constructor test
+ */
+ @SuppressWarnings("deprecation")
public void testTimestampintintintintintintint() {
- int[][] valid = { { 99, 2, 14, 17, 52, 3, 213577212 }, // 0 valid
- { 0, 0, 1, 0, 0, 0, 0 }, // 1 valid
- { 106, 11, 31, 23, 59, 59, 999999999 }, // 2 valid
- { 106, 11, 31, 23, 59, 61, 999999999 }, // 5 Seconds out of
- // range
- { 106, 11, 31, 23, 59, -1, 999999999 }, // 6 Seconds out of
- // range
- { 106, 11, 31, 23, 61, 59, 999999999 }, // 7 Minutes out of
- // range
- { 106, 11, 31, 23, -1, 59, 999999999 }, // 8 Minutes out of
- // range
- { 106, 11, 31, 25, 59, 59, 999999999 }, // 9 Hours out of range
- { 106, 11, 31, -1, 59, 59, 999999999 }, // 10 Hours out of range
- { 106, 11, 35, 23, 59, 59, 999999999 }, // 11 Days out of range
- { 106, 11, -1, 23, 59, 59, 999999999 }, // 12 Days out of range
- { 106, 15, 31, 23, 59, 59, 999999999 }, // 13 Months out of
- // range
- { 106, -1, 31, 23, 59, 59, 999999999 }, // 14 Months out of
- // range
- { -10, 11, 31, 23, 59, 59, 999999999 }, // 15 valid - Years
- // negative
- };
-
- for (int[] element : valid) {
- Timestamp theTimestamp = new Timestamp(element[0],
- element[1], element[2], element[3],
- element[4], element[5], element[6]);
+ int[][] valid = { { 99, 2, 14, 17, 52, 3, 213577212 }, // 0 valid
+ { 0, 0, 1, 0, 0, 0, 0 }, // 1 valid
+ { 106, 11, 31, 23, 59, 59, 999999999 }, // 2 valid
+ { 106, 11, 31, 23, 59, 61, 999999999 }, // 5 Seconds out of
+ // range
+ { 106, 11, 31, 23, 59, -1, 999999999 }, // 6 Seconds out of
+ // range
+ { 106, 11, 31, 23, 61, 59, 999999999 }, // 7 Minutes out of
+ // range
+ { 106, 11, 31, 23, -1, 59, 999999999 }, // 8 Minutes out of
+ // range
+ { 106, 11, 31, 25, 59, 59, 999999999 }, // 9 Hours out of range
+ { 106, 11, 31, -1, 59, 59, 999999999 }, // 10 Hours out of range
+ { 106, 11, 35, 23, 59, 59, 999999999 }, // 11 Days out of range
+ { 106, 11, -1, 23, 59, 59, 999999999 }, // 12 Days out of range
+ { 106, 15, 31, 23, 59, 59, 999999999 }, // 13 Months out of
+ // range
+ { 106, -1, 31, 23, 59, 59, 999999999 }, // 14 Months out of
+ // range
+ { -10, 11, 31, 23, 59, 59, 999999999 }, // 15 valid - Years
+ // negative
+ };
+
+ for (int[] element : valid) {
+ Timestamp theTimestamp = new Timestamp(element[0], element[1],
+ element[2], element[3], element[4], element[5], element[6]);
assertNotNull("Timestamp not generated: ", theTimestamp);
} // end for
-
- int[][] invalid = {
- { 106, 11, 31, 23, 59, 59, 1999999999 },
- { 106, 11, 31, 23, 59, 59, -999999999 },
- };
+
+ int[][] invalid = { { 106, 11, 31, 23, 59, 59, 1999999999 },
+ { 106, 11, 31, 23, 59, 59, -999999999 }, };
for (int[] element : invalid) {
try {
- new Timestamp(element[0],
- element[1], element[2], element[3],
+ new Timestamp(element[0], element[1], element[2], element[3],
element[4], element[5], element[6]);
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
@@ -166,376 +165,368 @@
}
}
- } // end method testTimestampintintintintintintint
+ } // end method testTimestampintintintintintintint
- /*
- * Method test for setTime
- */
- public void testSetTimelong() {
- // First set the timezone to GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ /*
+ * Method test for setTime
+ */
+ public void testSetTimelong() {
+ // First set the timezone to GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- Timestamp theTimestamp = new Timestamp(TIME_TEST1);
+ Timestamp theTimestamp = new Timestamp(TIME_TEST1);
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- theTimestamp.setTime(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ theTimestamp.setTime(TIME_ARRAY[i]);
- assertEquals(TIME_ARRAY[i], theTimestamp.getTime());
+ assertEquals(TIME_ARRAY[i], theTimestamp.getTime());
assertEquals(NANOS_ARRAY[i], theTimestamp.getNanos());
- } // end for
+ } // end for
- } // end method testsetTimelong
+ } // end method testsetTimelong
- /*
- * Method test for getTime
- */
- public void testGetTime() {
- // First set the timezone to GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ /*
+ * Method test for getTime
+ */
+ public void testGetTime() {
+ // First set the timezone to GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
assertEquals(element, theTimestamp.getTime());
- } // end for
+ } // end for
- } // end method testgetTime
+ } // end method testgetTime
- /*
- * Method test for getYear
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for getYear
+ */
+ @SuppressWarnings("deprecation")
public void testGetYear() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(YEAR_ARRAY[i], theTimestamp.getYear());
- } // end for
+ } // end for
- } // end method testgetYear
+ } // end method testgetYear
- /*
- * Method test for getMonth
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for getMonth
+ */
+ @SuppressWarnings("deprecation")
public void testGetMonth() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(MONTH_ARRAY[i], theTimestamp.getMonth());
- } // end for
+ } // end for
- } // end method testgetMonth
+ } // end method testgetMonth
- /*
- * Method test for getDate
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for getDate
+ */
+ @SuppressWarnings("deprecation")
public void testGetDate() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(DATE_ARRAY[i], theTimestamp.getDate());
- } // end for
+ } // end for
- } // end method testgetDate
+ } // end method testgetDate
- /*
- * Method test for getHours
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for getHours
+ */
+ @SuppressWarnings("deprecation")
public void testGetHours() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(HOURS_ARRAY[i], theTimestamp.getHours());
- } // end for
+ } // end for
- } // end method testgetHours
+ } // end method testgetHours
- /*
- * Method test for getMinutes
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for getMinutes
+ */
+ @SuppressWarnings("deprecation")
public void testGetMinutes() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(MINUTES_ARRAY[i], theTimestamp.getMinutes());
- } // end for
+ } // end for
- } // end method testgetMinutes
+ } // end method testgetMinutes
- /*
- * Method test for getSeconds
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for getSeconds
+ */
+ @SuppressWarnings("deprecation")
public void testGetSeconds() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(SECONDS_ARRAY[i], theTimestamp.getSeconds());
- } // end for
+ } // end for
+
+ } // end method testgetSeconds
- } // end method testgetSeconds
+ /*
+ * Method test for valueOf
+ */
+ static String theExceptionMessage = "Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff";
- /*
- * Method test for valueOf
- */
- static String theExceptionMessage = "Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff";
-
- public void testValueOfString() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
- Timestamp theTimestamp2 = Timestamp.valueOf(STRING_GMT_ARRAY[i]);
+ public void testValueOfString() {
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ Timestamp theTimestamp2 = Timestamp.valueOf(STRING_GMT_ARRAY[i]);
assertEquals(theTimestamp, theTimestamp2);
- } // end for
+ } // end for
- // Test for a string in correct format but with number values out of
- // range
- Timestamp theTimestamp = Timestamp.valueOf(STRING_OUTRANGE);
+ // Test for a string in correct format but with number values out of
+ // range
+ Timestamp theTimestamp = Timestamp.valueOf(STRING_OUTRANGE);
assertNotNull(theTimestamp);
- /*
- * System.out.println("testValueOfString: outrange timestamp: " +
- * theTimestamp.toString() );
- */
-
- for (String element : INVALID_STRINGS) {
- try {
- Timestamp.valueOf(element);
- fail("Should throw IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
-
- } // end for
-
- } // end method testvalueOfString
-
- /*
- * Method test for valueOf
- */
- public void testValueOfString1() {
-
- Timestamp theReturn;
- long[] theReturnTime = { 38720231, 38720231, 80279000, -38720691,
- 38720000};
- int[] theReturnNanos = { 231000000, 231987654, 0, 309000000, 0,};
-
- String[] valid = {
- "1970-01-01 10:45:20.231",
- "1970-01-01 10:45:20.231987654",
- "1970-01-01 22:17:59.0",
- "1969-12-31 13:14:39.309",
- "1970-01-01 10:45:20",
- };
- String[] invalid = {
- null,
- "ABCDEFGHI",
- "233104", "1970-01-01 22:17:59.",
+ /*
+ * System.out.println("testValueOfString: outrange timestamp: " +
+ * theTimestamp.toString() );
+ */
+
+ for (String element : INVALID_STRINGS) {
+ try {
+ Timestamp.valueOf(element);
+ fail("Should throw IllegalArgumentException.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
+
+ } // end for
+
+ } // end method testvalueOfString
+
+ /*
+ * Method test for valueOf
+ */
+ public void testValueOfString1() {
+
+ Timestamp theReturn;
+ long[] theReturnTime = { 38720231, 38720231, 80279000, -38720691,
+ 38720000 };
+ int[] theReturnNanos = { 231000000, 231987654, 0, 309000000, 0, };
+
+ String[] valid = { "1970-01-01 10:45:20.231",
+ "1970-01-01 10:45:20.231987654", "1970-01-01 22:17:59.0",
+ "1969-12-31 13:14:39.309", "1970-01-01 10:45:20", };
+ String[] invalid = { null, "ABCDEFGHI", "233104",
+ "1970-01-01 22:17:59.",
"1970-01-01 10:45:20.231987654690645322",
"1970-01-01 10:45:20&231987654",
"1970-01-01 10:45:20.-31987654",
- "1970-01-01 10:45:20.ABCD87654",
- "21-43-48",
- };
-
- for (int i = 0; i < valid.length; i++) {
- theReturn = Timestamp.valueOf(valid[i]);
- assertEquals(theReturnTime[i], theReturn.getTime());
- assertEquals(theReturnNanos[i], theReturn.getNanos());
- } // end for
+ "1970-01-01 10:45:20.ABCD87654", "21-43-48", };
+
+ for (int i = 0; i < valid.length; i++) {
+ theReturn = Timestamp.valueOf(valid[i]);
+ assertEquals(theReturnTime[i], theReturn.getTime());
+ assertEquals(theReturnNanos[i], theReturn.getNanos());
+ } // end for
for (String element : invalid) {
try {
theReturn = Timestamp.valueOf(element);
fail("Should throw IllegalArgumentException.");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
}
- } // end method testValueOfString
+ } // end method testValueOfString
- /*
- * Method test for toString
- */
- public void testToString() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ /*
+ * Method test for toString
+ */
+ public void testToString() {
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(STRING_GMT_ARRAY[i], theTimestamp.toString());
- } // end for
+ } // end for
- } // end method testtoString
+ } // end method testtoString
- /*
- * Method test for getNanos
- */
- public void testGetNanos() {
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ /*
+ * Method test for getNanos
+ */
+ public void testGetNanos() {
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(NANOS_ARRAY[i], theTimestamp.getNanos());
- } // end for
+ } // end for
- } // end method testgetNanos
+ } // end method testgetNanos
- /*
- * Method test for setNanos
- */
- public void testSetNanosint() {
- int[] NANOS_INVALID = { -137891990, 1635665198, -1 };
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ /*
+ * Method test for setNanos
+ */
+ public void testSetNanosint() {
+ int[] NANOS_INVALID = { -137891990, 1635665198, -1 };
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
- theTimestamp.setNanos(NANOS_ARRAY2[i]);
+ theTimestamp.setNanos(NANOS_ARRAY2[i]);
assertEquals(NANOS_ARRAY2[i], theTimestamp.getNanos());
- // Also check that these Timestamps with detailed nanos values
- // convert to
- // strings correctly
+ // Also check that these Timestamps with detailed nanos values
+ // convert to
+ // strings correctly
assertEquals(STRING_NANOS_ARRAY[i], theTimestamp.toString());
- } // end for
+ } // end for
- for (int i = 0; i < NANOS_INVALID.length; i++) {
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
- int originalNanos = theTimestamp.getNanos();
- try {
- theTimestamp.setNanos(NANOS_INVALID[i]);
- fail("Should throw IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- //expected
- } // end try
+ for (int i = 0; i < NANOS_INVALID.length; i++) {
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
+ int originalNanos = theTimestamp.getNanos();
+ try {
+ theTimestamp.setNanos(NANOS_INVALID[i]);
+ fail("Should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // expected
+ } // end try
assertEquals(originalNanos, theTimestamp.getNanos());
- } // end for
+ } // end for
+
+ } // end method testsetNanosint
+
+ /*
+ * Method test for equals
+ */
+ public void testEqualsTimestamp() {
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
+ Timestamp theTimestamp2 = new Timestamp(element);
+
+ assertTrue(theTimestamp.equals(theTimestamp2));
+ } // end for
- } // end method testsetNanosint
+ Timestamp theTest = new Timestamp(TIME_COMPARE);
+
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
+ assertFalse(theTimestamp.equals(theTest));
+ } // end for
- /*
- * Method test for equals
- */
- public void testEqualsTimestamp() {
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
- Timestamp theTimestamp2 = new Timestamp(element);
-
- assertTrue(theTimestamp.equals(theTimestamp2));
- } // end for
-
- Timestamp theTest = new Timestamp(TIME_COMPARE);
-
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
- assertFalse(theTimestamp.equals(theTest));
- } // end for
-
// Regression for HARMONY-526
assertFalse(new Timestamp(0).equals((Timestamp) null));
- } // end method testequalsTimestamp
+ } // end method testequalsTimestamp
- /*
- * Method test for equals
- */
- public void testEqualsObject() {
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
+ /*
+ * Method test for equals
+ */
+ public void testEqualsObject() {
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
- Object theTimestamp2 = new Timestamp(element);
+ Object theTimestamp2 = new Timestamp(element);
- assertTrue(theTimestamp.equals(theTimestamp2));
- } // end for
+ assertTrue(theTimestamp.equals(theTimestamp2));
+ } // end for
- Object theTest = new Timestamp(TIME_COMPARE);
+ Object theTest = new Timestamp(TIME_COMPARE);
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
- assertFalse(theTimestamp.equals(theTest));
- } // end for
+ assertFalse(theTimestamp.equals(theTest));
+ } // end for
- Object nastyTest = new String("Test ");
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[1]);
- assertFalse(theTimestamp.equals(nastyTest));
+ Object nastyTest = new String("Test ");
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[1]);
+ assertFalse(theTimestamp.equals(nastyTest));
// Regression for HARMONY-526
assertFalse(new Timestamp(0).equals((Object) null));
- } // end method testequalsObject
+ } // end method testequalsObject
- /*
- * Method test for before
- */
- public void testBeforeTimestamp() {
- Timestamp theTest = new Timestamp(TIME_LATE);
-
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
-
- assertTrue(theTimestamp.before(theTest));
- } // end for
+ /*
+ * Method test for before
+ */
+ public void testBeforeTimestamp() {
+ Timestamp theTest = new Timestamp(TIME_LATE);
- theTest = new Timestamp(TIME_EARLY);
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
+ assertTrue(theTimestamp.before(theTest));
+ } // end for
- assertFalse(theTimestamp.before(theTest));
- } // end for
+ theTest = new Timestamp(TIME_EARLY);
- for (long element : TIME_ARRAY) {
- theTest = new Timestamp(element);
- Timestamp theTimestamp = new Timestamp(element);
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
- assertFalse(theTimestamp.before(theTest));
- theTest.setNanos(theTest.getNanos() + 1);
- assertTrue(theTimestamp.before(theTest));
- } // end for
+ assertFalse(theTimestamp.before(theTest));
+ } // end for
- } // end method testbeforeTimestamp
+ for (long element : TIME_ARRAY) {
+ theTest = new Timestamp(element);
+ Timestamp theTimestamp = new Timestamp(element);
+
+ assertFalse(theTimestamp.before(theTest));
+ theTest.setNanos(theTest.getNanos() + 1);
+ assertTrue(theTimestamp.before(theTest));
+ } // end for
- /*
- * Method test for after
- */
- public void testAfterTimestamp() {
- Timestamp theTest = new Timestamp(TIME_LATE);
+ } // end method testbeforeTimestamp
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
+ /*
+ * Method test for after
+ */
+ public void testAfterTimestamp() {
+ Timestamp theTest = new Timestamp(TIME_LATE);
- assertFalse(theTimestamp.after(theTest));
- } // end for
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
- theTest = new Timestamp(TIME_EARLY);
+ assertFalse(theTimestamp.after(theTest));
+ } // end for
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
+ theTest = new Timestamp(TIME_EARLY);
- assertTrue(theTimestamp.after(theTest));
- } // end for
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
- for (long element : TIME_ARRAY) {
- theTest = new Timestamp(element);
- Timestamp theTimestamp = new Timestamp(element);
+ assertTrue(theTimestamp.after(theTest));
+ } // end for
- assertFalse(theTimestamp.after(theTest));
- theTimestamp.setNanos(theTimestamp.getNanos() + 1);
- assertTrue(theTimestamp.after(theTest));
- } // end for
+ for (long element : TIME_ARRAY) {
+ theTest = new Timestamp(element);
+ Timestamp theTimestamp = new Timestamp(element);
+
+ assertFalse(theTimestamp.after(theTest));
+ theTimestamp.setNanos(theTimestamp.getNanos() + 1);
+ assertTrue(theTimestamp.after(theTest));
+ } // end for
- } // end method testafterTimestamp
+ } // end method testafterTimestamp
- /*
- * Method test for compareTo
- */
- @SuppressWarnings("deprecation")
+ /*
+ * Method test for compareTo
+ */
+ @SuppressWarnings("deprecation")
public void testCompareToTimestamp() {
- Timestamp theTest = new Timestamp(TIME_EARLY);
- Timestamp theTest2 = new Timestamp(TIME_LATE);
+ Timestamp theTest = new Timestamp(TIME_EARLY);
+ Timestamp theTest2 = new Timestamp(TIME_LATE);
+
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
+ Timestamp theTimestamp2 = new Timestamp(element);
+
+ assertTrue(theTimestamp.compareTo(theTest) > 0);
+ assertTrue(theTimestamp.compareTo(theTest2) < 0);
+ assertEquals(0, theTimestamp.compareTo(theTimestamp2));
+ } // end for
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
- Timestamp theTimestamp2 = new Timestamp(element);
-
- assertTrue(theTimestamp.compareTo(theTest) > 0);
- assertTrue(theTimestamp.compareTo(theTest2) < 0);
- assertEquals(0, theTimestamp.compareTo(theTimestamp2));
- } // end for
-
Timestamp t1 = new Timestamp(-1L);
Timestamp t2 = new Timestamp(-1L);
-
+
t1.setTime(Long.MIN_VALUE);
t2.setDate(Integer.MIN_VALUE);
assertEquals(1, t1.compareTo(t2));
@@ -551,42 +542,42 @@
assertEquals(0, t1.compareTo(t2));
assertEquals(0, t2.compareTo(t1));
- } // end method testcompareToTimestamp
+ } // end method testcompareToTimestamp
+
+ /**
+ * @tests java.sql.Timestamp#compareTo(java.util.Date)
+ */
+ public void testCompareToDate() {
+ Date theTest = new Timestamp(TIME_EARLY);
+ Date theTest2 = new Timestamp(TIME_LATE);
+
+ for (long element : TIME_ARRAY) {
+ Timestamp theTimestamp = new Timestamp(element);
+ Date theTimestamp2 = new Timestamp(element);
+
+ assertTrue(theTimestamp.compareTo(theTest) > 0);
+ assertTrue(theTimestamp.compareTo(theTest2) < 0);
+ assertEquals(0, theTimestamp.compareTo(theTimestamp2));
+ } // end for
- /**
- * @tests java.sql.Timestamp#compareTo(java.util.Date)
- */
- public void testCompareToDate() {
- Date theTest = new Timestamp(TIME_EARLY);
- Date theTest2 = new Timestamp(TIME_LATE);
-
- for (long element : TIME_ARRAY) {
- Timestamp theTimestamp = new Timestamp(element);
- Date theTimestamp2 = new Timestamp(element);
-
- assertTrue(theTimestamp.compareTo(theTest) > 0);
- assertTrue(theTimestamp.compareTo(theTest2) < 0);
- assertEquals(0, theTimestamp.compareTo(theTimestamp2));
- } // end for
-
- Date nastyTest = new Date();
- Timestamp theTimestamp = new Timestamp(TIME_ARRAY[1]);
- try {
- theTimestamp.compareTo(nastyTest);
+ Date nastyTest = new Date();
+ Timestamp theTimestamp = new Timestamp(TIME_ARRAY[1]);
+ try {
+ theTimestamp.compareTo(nastyTest);
// It throws ClassCastException in JDK 1.5.0_06 but in 1.5.0_07 it
// does not throw the expected exception.
fail("testCompareToObject: Did not get expected ClassCastException");
} catch (ClassCastException e) {
- // Should get here
- /*
- * System.out.println("testCompareToObject: ClassCastException as
- * expected"); System.out.println("Exception message: " +
- * e.getMessage());
- */
- } // end try
+ // Should get here
+ /*
+ * System.out.println("testCompareToObject: ClassCastException as
+ * expected"); System.out.println("Exception message: " +
+ * e.getMessage());
+ */
+ } // end try
+
+ } // end method testcompareToObject
- } // end method testcompareToObject
-
/**
* @tests serialization/deserialization compatibility.
*/
@@ -602,7 +593,7 @@
Timestamp object = new Timestamp(100L);
SerializationTest.verifyGolden(this, object);
}
-
+
/**
* @tests java.sql.Timestamp#toString()
*/
@@ -620,5 +611,5 @@
Timestamp t4 = new Timestamp(Long.MIN_VALUE + 808);
assertEquals("292269055-12-02 16:47:05.0", t4.toString()); //$NON-NLS-1$
}
-
+
} // end class TimestampTest
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java Mon Jul 16 23:30:22 2007
@@ -22,46 +22,46 @@
public class TypesTest extends TestCase {
- /*
- * Public statics test
- */
- public void testPublicStatics() {
- assertEquals(ARRAY,2003);
- assertEquals(BIGINT,-5);
- assertEquals(BINARY,-2);
- assertEquals(BIT,-7);
- assertEquals(BLOB,2004);
- assertEquals(BOOLEAN,16);
- assertEquals(CHAR,1);
- assertEquals(CLOB,2005);
- assertEquals(DATALINK,70);
- assertEquals(DATE,91);
- assertEquals(DECIMAL,3);
- assertEquals(DISTINCT,2001);
- assertEquals(DOUBLE,8);
- assertEquals(FLOAT,6);
- assertEquals(INTEGER,4);
- assertEquals(JAVA_OBJECT,2000);
- assertEquals(LONGNVARCHAR,-16);
- assertEquals(LONGVARBINARY,-4);
- assertEquals(LONGVARCHAR,-1);
- assertEquals(NCHAR,-15);
- assertEquals(NCLOB,2011);
- assertEquals(NULL,0);
- assertEquals(NUMERIC,2);
- assertEquals(NVARCHAR,-9);
- assertEquals(OTHER,1111);
- assertEquals(REAL,7);
- assertEquals(REF,2006);
- assertEquals(ROWID,-8);
- assertEquals(SMALLINT,5);
- assertEquals(SQLXML,2009);
- assertEquals(STRUCT,2002);
- assertEquals(TIME,92);
- assertEquals(TIMESTAMP,93);
- assertEquals(TINYINT,-6);
- assertEquals(VARBINARY,-3);
- assertEquals(VARCHAR,12);
- }
+ /*
+ * Public statics test
+ */
+ public void testPublicStatics() {
+ assertEquals(ARRAY,2003);
+ assertEquals(BIGINT,-5);
+ assertEquals(BINARY,-2);
+ assertEquals(BIT,-7);
+ assertEquals(BLOB,2004);
+ assertEquals(BOOLEAN,16);
+ assertEquals(CHAR,1);
+ assertEquals(CLOB,2005);
+ assertEquals(DATALINK,70);
+ assertEquals(DATE,91);
+ assertEquals(DECIMAL,3);
+ assertEquals(DISTINCT,2001);
+ assertEquals(DOUBLE,8);
+ assertEquals(FLOAT,6);
+ assertEquals(INTEGER,4);
+ assertEquals(JAVA_OBJECT,2000);
+ assertEquals(LONGNVARCHAR,-16);
+ assertEquals(LONGVARBINARY,-4);
+ assertEquals(LONGVARCHAR,-1);
+ assertEquals(NCHAR,-15);
+ assertEquals(NCLOB,2011);
+ assertEquals(NULL,0);
+ assertEquals(NUMERIC,2);
+ assertEquals(NVARCHAR,-9);
+ assertEquals(OTHER,1111);
+ assertEquals(REAL,7);
+ assertEquals(REF,2006);
+ assertEquals(ROWID,-8);
+ assertEquals(SMALLINT,5);
+ assertEquals(SQLXML,2009);
+ assertEquals(STRUCT,2002);
+ assertEquals(TIME,92);
+ assertEquals(TIMESTAMP,93);
+ assertEquals(TINYINT,-6);
+ assertEquals(VARBINARY,-3);
+ assertEquals(VARCHAR,12);
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java Mon Jul 16 23:30:22 2007
@@ -34,31 +34,31 @@
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_PooledConnection ipc = new Impl_PooledConnection();
ConnectionEvent ce = new ConnectionEvent(ipc);
assertSame(ipc, ce.getSource());
assertNull(ce.getSQLException());
}
-
+
public void testConstructorConnectionSQLException() {
try {
new ConnectionEvent(null, null);
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_PooledConnection ipc = new Impl_PooledConnection();
ConnectionEvent ce = new ConnectionEvent(ipc, null);
assertSame(ipc, ce.getSource());
assertNull(ce.getSQLException());
-
+
SQLException e = new SQLException();
ce = new ConnectionEvent(ipc, e);
assertSame(ipc, ce.getSource());
assertSame(e, ce.getSQLException());
}
-
+
/**
* @tests serialization/deserialization compatibility.
*/
@@ -111,5 +111,4 @@
}
};
-}
-
+}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java Mon Jul 16 23:30:22 2007
@@ -33,6 +33,7 @@
return null;
}
- public void removeConnectionEventListener(ConnectionEventListener theListener) {
+ public void removeConnectionEventListener(
+ ConnectionEventListener theListener) {
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java Mon Jul 16 23:30:22 2007
@@ -103,34 +103,38 @@
public void removeRowSetListener(RowSetListener theListener) {
}
- public void setArray(int parameterIndex, Array theArray) throws SQLException {
- }
-
- public void setAsciiStream(int parameterIndex, InputStream theInputStream, int length)
+ public void setArray(int parameterIndex, Array theArray)
throws SQLException {
}
- public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal) throws SQLException {
+ public void setAsciiStream(int parameterIndex, InputStream theInputStream,
+ int length) throws SQLException {
}
- public void setBinaryStream(int parameterIndex, InputStream theInputStream, int length)
+ public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal)
throws SQLException {
}
+ public void setBinaryStream(int parameterIndex, InputStream theInputStream,
+ int length) throws SQLException {
+ }
+
public void setBlob(int parameterIndex, Blob theBlob) throws SQLException {
}
- public void setBoolean(int parameterIndex, boolean theBoolean) throws SQLException {
+ public void setBoolean(int parameterIndex, boolean theBoolean)
+ throws SQLException {
}
public void setByte(int parameterIndex, byte theByte) throws SQLException {
}
- public void setBytes(int parameterIndex, byte[] theByteArray) throws SQLException {
+ public void setBytes(int parameterIndex, byte[] theByteArray)
+ throws SQLException {
}
- public void setCharacterStream(int parameterIndex, Reader theReader, int length)
- throws SQLException {
+ public void setCharacterStream(int parameterIndex, Reader theReader,
+ int length) throws SQLException {
}
public void setClob(int parameterIndex, Clob theClob) throws SQLException {
@@ -152,13 +156,15 @@
public void setDate(int parameterIndex, Date theDate) throws SQLException {
}
- public void setDouble(int parameterIndex, double theDouble) throws SQLException {
+ public void setDouble(int parameterIndex, double theDouble)
+ throws SQLException {
}
public void setEscapeProcessing(boolean enable) throws SQLException {
}
- public void setFloat(int parameterIndex, float theFloat) throws SQLException {
+ public void setFloat(int parameterIndex, float theFloat)
+ throws SQLException {
}
public void setInt(int parameterIndex, int theInteger) throws SQLException {
@@ -173,21 +179,23 @@
public void setMaxRows(int max) throws SQLException {
}
- public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
+ public void setNull(int parameterIndex, int sqlType, String typeName)
+ throws SQLException {
}
public void setNull(int parameterIndex, int sqlType) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject, int targetSqlType, int scale)
- throws SQLException {
+ public void setObject(int parameterIndex, Object theObject,
+ int targetSqlType, int scale) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject, int targetSqlType)
- throws SQLException {
+ public void setObject(int parameterIndex, Object theObject,
+ int targetSqlType) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject) throws SQLException {
+ public void setObject(int parameterIndex, Object theObject)
+ throws SQLException {
}
public void setPassword(String password) throws SQLException {
@@ -202,10 +210,12 @@
public void setRef(int parameterIndex, Ref theRef) throws SQLException {
}
- public void setShort(int parameterIndex, short theShort) throws SQLException {
+ public void setShort(int parameterIndex, short theShort)
+ throws SQLException {
}
- public void setString(int parameterIndex, String theString) throws SQLException {
+ public void setString(int parameterIndex, String theString)
+ throws SQLException {
}
public void setTime(int parameterIndex, Time theTime, Calendar theCalendar)
@@ -215,11 +225,12 @@
public void setTime(int parameterIndex, Time theTime) throws SQLException {
}
- public void setTimestamp(int parameterIndex, Timestamp theTimestamp, Calendar theCalendar)
- throws SQLException {
+ public void setTimestamp(int parameterIndex, Timestamp theTimestamp,
+ Calendar theCalendar) throws SQLException {
}
- public void setTimestamp(int parameterIndex, Timestamp theTimestamp) throws SQLException {
+ public void setTimestamp(int parameterIndex, Timestamp theTimestamp)
+ throws SQLException {
}
public void setTransactionIsolation(int level) throws SQLException {
@@ -228,7 +239,8 @@
public void setType(int type) throws SQLException {
}
- public void setTypeMap(Map<String, Class<?>> theTypeMap) throws SQLException {
+ public void setTypeMap(Map<String, Class<?>> theTypeMap)
+ throws SQLException {
}
public void setUrl(String theURL) throws SQLException {
@@ -283,7 +295,8 @@
return null;
}
- public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+ public BigDecimal getBigDecimal(int columnIndex, int scale)
+ throws SQLException {
return null;
}
@@ -291,7 +304,8 @@
return null;
}
- public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
+ public BigDecimal getBigDecimal(String columnName, int scale)
+ throws SQLException {
return null;
}
@@ -423,7 +437,8 @@
return null;
}
- public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+ public Object getObject(int columnIndex, Map<String, Class<?>> map)
+ throws SQLException {
return null;
}
@@ -431,7 +446,8 @@
return null;
}
- public Object getObject(String columnName, Map<String, Class<?>> map) throws SQLException {
+ public Object getObject(String columnName, Map<String, Class<?>> map)
+ throws SQLException {
return null;
}
@@ -487,7 +503,8 @@
return null;
}
- public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+ public Timestamp getTimestamp(int columnIndex, Calendar cal)
+ throws SQLException {
return null;
}
@@ -495,7 +512,8 @@
return null;
}
- public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
+ public Timestamp getTimestamp(String columnName, Calendar cal)
+ throws SQLException {
return null;
}
@@ -603,10 +621,12 @@
throws SQLException {
}
- public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+ public void updateBigDecimal(int columnIndex, BigDecimal x)
+ throws SQLException {
}
- public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
+ public void updateBigDecimal(String columnName, BigDecimal x)
+ throws SQLException {
}
public void updateBinaryStream(int columnIndex, InputStream x, int length)
@@ -645,8 +665,8 @@
throws SQLException {
}
- public void updateCharacterStream(String columnName, Reader reader, int length)
- throws SQLException {
+ public void updateCharacterStream(String columnName, Reader reader,
+ int length) throws SQLException {
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
@@ -691,13 +711,15 @@
public void updateNull(String columnName) throws SQLException {
}
- public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
+ public void updateObject(int columnIndex, Object x, int scale)
+ throws SQLException {
}
public void updateObject(int columnIndex, Object x) throws SQLException {
}
- public void updateObject(String columnName, Object x, int scale) throws SQLException {
+ public void updateObject(String columnName, Object x, int scale)
+ throws SQLException {
}
public void updateObject(String columnName, Object x) throws SQLException {
@@ -730,10 +752,12 @@
public void updateTime(String columnName, Time x) throws SQLException {
}
- public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+ public void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException {
}
- public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
+ public void updateTimestamp(String columnName, Timestamp x)
+ throws SQLException {
}
public boolean wasNull() throws SQLException {
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java Mon Jul 16 23:30:22 2007
@@ -28,7 +28,7 @@
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_RowSet irs = new Impl_RowSet();
RowSetEvent rse = new RowSetEvent(irs);
assertSame(irs, rse.getSource());
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java Mon Jul 16 23:30:22 2007
@@ -41,7 +41,7 @@
assertNotNull(params);
assertEquals(0, params.length);
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#getFetchDirection()}
*/
@@ -49,7 +49,7 @@
BaseRowSetImpl brs = new BaseRowSetImpl();
assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#getTypeMap()}
*/
@@ -57,7 +57,7 @@
BaseRowSetImpl brs = new BaseRowSetImpl();
assertNull(brs.getTypeMap());
}
-
+
public void testSetNullintint() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
@@ -65,25 +65,25 @@
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
brs.setNull(0, Types.BINARY);
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.setNull(1, Types.BINARY);
Object[] params = brs.getParams();
assertNotNull(params);
- Object[] param = (Object[])params[0];
+ Object[] param = (Object[]) params[0];
assertNotNull(param);
assertEquals(2, param.length);
assertNull(param[0]);
assertEquals(Integer.valueOf(Types.BINARY), param[1]);
}
-
+
public void testSetNullintintString() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
@@ -91,26 +91,26 @@
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
brs.setNull(0, Types.BINARY, "java.lang.Boolean");
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.setNull(1, Types.BINARY, "java.lang.Boolean");
Object[] params = brs.getParams();
assertNotNull(params);
- Object[] param = (Object[])params[0];
+ Object[] param = (Object[]) params[0];
assertNotNull(param);
assertEquals(3, param.length);
assertNull(param[0]);
assertEquals(Integer.valueOf(Types.BINARY), param[1]);
assertEquals("java.lang.Boolean", param[2]);
}
-
+
public void testSetBoolean() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
@@ -118,105 +118,105 @@
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
brs.setBoolean(0, true);
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.setBoolean(1, true);
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
assertEquals(Boolean.TRUE, params[0]);
}
-
+
public void testSetByte() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
- brs.setByte(1, (byte)1);
+ brs.setByte(1, (byte) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
- brs.setByte(0, (byte)1);
+ brs.setByte(0, (byte) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
- brs.setByte(1, (byte)1);
+
+ brs.setByte(1, (byte) 1);
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertEquals(Byte.valueOf((byte)1), params[0]);
+ assertEquals(Byte.valueOf((byte) 1), params[0]);
}
-
+
public void testSetShort() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
- brs.setShort(1, (short)1);
+ brs.setShort(1, (short) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
- brs.setShort(0, (short)1);
+ brs.setShort(0, (short) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
- brs.setShort(1, (byte)1);
+
+ brs.setShort(1, (byte) 1);
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertEquals(Short.valueOf((short)1), params[0]);
+ assertEquals(Short.valueOf((short) 1), params[0]);
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#setFetchDirection(int)}
*/
public void testSetFetchDirectionI() throws SQLException {
- BaseRowSetImpl brs = new BaseRowSetImpl();
- brs.setFetchDirection(ResultSet.FETCH_FORWARD);
- assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
-
- brs.setType(ResultSet.TYPE_SCROLL_SENSITIVE);
- brs.setFetchDirection(ResultSet.FETCH_UNKNOWN);
- assertEquals(ResultSet.FETCH_UNKNOWN, brs.getFetchDirection());
-
- brs.setType(ResultSet.TYPE_FORWARD_ONLY);
- try {
- brs.setFetchDirection(ResultSet.FETCH_REVERSE);
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
-
- try {
- brs.setFetchDirection(1100);
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
+ BaseRowSetImpl brs = new BaseRowSetImpl();
+ brs.setFetchDirection(ResultSet.FETCH_FORWARD);
+ assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
+
+ brs.setType(ResultSet.TYPE_SCROLL_SENSITIVE);
+ brs.setFetchDirection(ResultSet.FETCH_UNKNOWN);
+ assertEquals(ResultSet.FETCH_UNKNOWN, brs.getFetchDirection());
+
+ brs.setType(ResultSet.TYPE_FORWARD_ONLY);
+ try {
+ brs.setFetchDirection(ResultSet.FETCH_REVERSE);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+
+ try {
+ brs.setFetchDirection(1100);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#setTypeMap(java.util.Map)}
*/
public void testSetTypeMap() {
- BaseRowSetImpl brs = new BaseRowSetImpl();
- brs.setTypeMap(null);
- assertNull(brs.getTypeMap());
+ BaseRowSetImpl brs = new BaseRowSetImpl();
+ brs.setTypeMap(null);
+ assertNull(brs.getTypeMap());
}
-
+
public void testSetArray() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -225,9 +225,10 @@
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertTrue("Should have stored a SerialArray", params[0] instanceof SerialArray);
+ assertTrue("Should have stored a SerialArray",
+ params[0] instanceof SerialArray);
}
-
+
public void testSetBlob() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -236,9 +237,10 @@
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertTrue("Should have stored a SerialBlob", params[0] instanceof SerialBlob);
+ assertTrue("Should have stored a SerialBlob",
+ params[0] instanceof SerialBlob);
}
-
+
public void testSetClob() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -248,9 +250,10 @@
assertNotNull(params);
assertEquals(1, params.length);
assertTrue(c != params[0]);
- assertTrue("Should have stored a SerialClob", params[0] instanceof SerialClob);
+ assertTrue("Should have stored a SerialClob",
+ params[0] instanceof SerialClob);
}
-
+
public void testSetRef() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -260,9 +263,10 @@
assertNotNull(params);
assertEquals(1, params.length);
assertTrue(r != params[0]);
- assertTrue("Should have stored a SerialRef", params[0] instanceof SerialRef);
+ assertTrue("Should have stored a SerialRef",
+ params[0] instanceof SerialRef);
}
-
+
private static final class BaseRowSetImpl extends BaseRowSet {
private static final long serialVersionUID = 1L;
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java Mon Jul 16 23:30:22 2007
@@ -52,8 +52,7 @@
return null;
}
- public ResultSet getResultSet(long index, int count)
- throws SQLException {
+ public ResultSet getResultSet(long index, int count) throws SQLException {
return null;
}