harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r646264 [13/13] - in /harmony/enhanced/classlib/branches/java6: depends/build/ depends/build/platform/ depends/files/ modules/accessibility/ modules/annotation/ modules/applet/ modules/archive/ modules/archive/src/main/java/java/util/jar/ m...
Date Wed, 09 Apr 2008 11:02:07 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetUpdateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetUpdateTest.java?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetUpdateTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetUpdateTest.java
Wed Apr  9 04:01:14 2008
@@ -28,6 +28,355 @@
 import javax.sql.rowset.spi.SyncProviderException;
 
 public class CachedRowSetUpdateTest extends CachedRowSetTestCase {
+
+    public void testColumnUpdated() throws Exception {
+        noInitialCrset = newNoInitialInstance();
+        try {
+            noInitialCrset.columnUpdated(1);
+            fail("should throw exception");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // RI throw ArrayIndexOutOfBoundsException
+        } catch (SQLException e) {
+            // According to spec, it's supposed to throw SQLException
+        }
+
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        noInitialCrset.populate(rs);
+
+        // the cursor is before the first row
+        assertTrue(noInitialCrset.isBeforeFirst());
+        try {
+            noInitialCrset.columnUpdated("ID");
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        // the cursor is after the last row
+        noInitialCrset.afterLast();
+        assertTrue(noInitialCrset.isAfterLast());
+        try {
+            noInitialCrset.columnUpdated(1);
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        assertTrue(noInitialCrset.first());
+        noInitialCrset.moveToInsertRow();
+        try {
+            noInitialCrset.columnUpdated("NAME");
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.moveToCurrentRow();
+        assertTrue(noInitialCrset.absolute(3));
+        assertEquals(3, noInitialCrset.getInt(1));
+        assertFalse(noInitialCrset.columnUpdated(2));
+        noInitialCrset.updateString(2, "update3");
+        assertTrue(noInitialCrset.columnUpdated(2));
+        noInitialCrset.acceptChanges(conn);
+
+        assertTrue(noInitialCrset.absolute(3));
+        assertEquals(3, noInitialCrset.getInt(1));
+        assertTrue(noInitialCrset.columnUpdated("NAME"));
+
+        noInitialCrset.updateRow();
+        noInitialCrset.acceptChanges(conn);
+        assertTrue(noInitialCrset.absolute(3));
+        assertEquals("update3", noInitialCrset.getString(2));
+        assertFalse(noInitialCrset.columnUpdated(2));
+
+        assertTrue(noInitialCrset.absolute(4));
+        try {
+            noInitialCrset.columnUpdated(0);
+            fail("should throw exception");
+        } catch (IndexOutOfBoundsException e) {
+            // RI throw IndexOutOfBoundsException
+        } catch (SQLException e) {
+            // expected
+        }
+
+        try {
+            noInitialCrset.columnUpdated("abc");
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+    }
+
+    public void testRowUpdated() throws Exception {
+        noInitialCrset = newNoInitialInstance();
+        try {
+            noInitialCrset.rowUpdated();
+            fail("should throw exception");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // RI throw exception here
+        } catch (SQLException e) {
+            // expected
+        }
+
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        noInitialCrset.populate(rs);
+
+        assertTrue(noInitialCrset.isBeforeFirst());
+        try {
+            noInitialCrset.rowUpdated();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.afterLast();
+        assertTrue(noInitialCrset.isAfterLast());
+        try {
+            noInitialCrset.rowUpdated();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        assertTrue(noInitialCrset.absolute(3));
+        assertFalse(noInitialCrset.rowUpdated());
+        noInitialCrset.updateString(2, "update3");
+        assertFalse(noInitialCrset.rowUpdated());
+        noInitialCrset.updateRow();
+        assertTrue(noInitialCrset.rowUpdated());
+        noInitialCrset.acceptChanges(conn);
+        assertTrue(noInitialCrset.absolute(3));
+        assertEquals("update3", noInitialCrset.getString(2));
+        assertFalse(noInitialCrset.rowUpdated());
+
+        noInitialCrset.moveToInsertRow();
+        try {
+            noInitialCrset.rowUpdated();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.moveToCurrentRow();
+        assertTrue(noInitialCrset.absolute(4));
+        assertFalse(noInitialCrset.rowUpdated());
+        noInitialCrset.updateRow();
+        assertFalse(noInitialCrset.rowUpdated());
+        noInitialCrset.updateString(2, "abc");
+        noInitialCrset.updateRow();
+        assertTrue(noInitialCrset.rowUpdated());
+    }
+
+    public void testCancelRowUpdates() throws Exception {
+        noInitialCrset = newNoInitialInstance();
+        Listener listener = new Listener();
+        noInitialCrset.addRowSetListener(listener);
+        try {
+            noInitialCrset.cancelRowUpdates();
+            fail("should throw exception");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // RI throw exception here
+        } catch (SQLException e) {
+            // expected
+        }
+
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        noInitialCrset.populate(rs);
+
+        assertTrue(noInitialCrset.isBeforeFirst());
+        try {
+            noInitialCrset.cancelRowUpdates();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.afterLast();
+        assertTrue(noInitialCrset.isAfterLast());
+        try {
+            noInitialCrset.cancelRowUpdates();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.moveToInsertRow();
+        try {
+            noInitialCrset.cancelRowUpdates();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.moveToCurrentRow();
+        assertTrue(noInitialCrset.absolute(2));
+        // no effect here
+        noInitialCrset.cancelRowUpdates();
+
+        assertTrue(noInitialCrset.absolute(3));
+        noInitialCrset.updateString(2, "update3");
+        // call cancelRowUpdates() before updateRow(), no effect here
+        listener.clear();
+        noInitialCrset.cancelRowUpdates();
+        assertNull(listener.getTag());
+        assertEquals("update3", noInitialCrset.getString(2));
+        noInitialCrset.updateRow();
+        noInitialCrset.acceptChanges(conn);
+        assertEquals("update3", noInitialCrset.getString(2));
+
+        assertTrue(noInitialCrset.absolute(4));
+        noInitialCrset.updateString(2, "update4");
+        assertEquals("update4", noInitialCrset.getString(2));
+        noInitialCrset.updateRow();
+        assertEquals("update4", noInitialCrset.getString(2));
+        // call cancelRowUpdates() after updateRow(), it works here
+
+        listener.clear();
+        noInitialCrset.cancelRowUpdates();
+        assertEquals(CachedRowSetListenerTest.EVENT_ROW_CHANGED, listener
+                .getTag());
+        assertEquals("test4", noInitialCrset.getString(2));
+        noInitialCrset.acceptChanges(conn);
+        assertEquals("test4", noInitialCrset.getString(2));
+    }
+
+    public void testUndoUpdate() throws Exception {
+        noInitialCrset = newNoInitialInstance();
+        try {
+            noInitialCrset.undoUpdate();
+            fail("should throw exception");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // RI throw exception here
+        } catch (SQLException e) {
+            // expected
+        }
+
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        noInitialCrset.populate(rs);
+
+        assertTrue(noInitialCrset.isBeforeFirst());
+        try {
+            noInitialCrset.undoUpdate();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        noInitialCrset.afterLast();
+        assertTrue(noInitialCrset.isAfterLast());
+        try {
+            noInitialCrset.undoUpdate();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        /*
+         * The implementation of RI's undoUpdate seems not follow the spec at
+         * all.
+         */
+        if ("true".equals(System.getProperty("Testing Harmony"))) {
+            assertTrue(noInitialCrset.absolute(3));
+            noInitialCrset.undoUpdate(); // no effect here
+
+            noInitialCrset.updateString(2, "update3");
+            noInitialCrset.undoUpdate(); // no effect here
+            assertEquals("update3", noInitialCrset.getString(2));
+            noInitialCrset.updateRow();
+            noInitialCrset.undoUpdate(); // effect here
+            assertEquals("test3", noInitialCrset.getString(2));
+
+            noInitialCrset.acceptChanges(conn);
+            assertEquals("test3", noInitialCrset.getString(2));
+            noInitialCrset.undoUpdate(); // no effect here
+
+            noInitialCrset.moveToInsertRow();
+            noInitialCrset.updateInt(1, 10);
+            noInitialCrset.updateString(2, "update10");
+            // undoUpdate() will set all columns of insert row null
+            noInitialCrset.undoUpdate();
+            for (int i = 1; i <= DEFAULT_COLUMN_COUNT; i++) {
+                assertNull(noInitialCrset.getObject(i));
+            }
+        } else {
+            assertTrue(noInitialCrset.absolute(3));
+            try {
+                noInitialCrset.undoUpdate();
+                fail("should throw SQLException");
+            } catch (SQLException e) {
+                // RI throw SQLException here.
+            }
+
+            noInitialCrset.updateString(2, "update3");
+            noInitialCrset.updateLong(3, 3333333L);
+            noInitialCrset.updateFloat(7, 3.3F);
+            try {
+                noInitialCrset.undoUpdate();
+                fail("should throw SQLException");
+            } catch (SQLException e) {
+                // RI throw SQLException here.
+            }
+
+            noInitialCrset.updateRow();
+            try {
+                noInitialCrset.undoUpdate();
+                fail("should throw SQLException");
+            } catch (SQLException e) {
+                // RI throw SQLException here.
+            }
+
+            noInitialCrset.acceptChanges(conn);
+            assertEquals("update3", noInitialCrset.getString(2));
+            assertEquals(3333333L, noInitialCrset.getLong(3));
+            assertEquals(3.3F, noInitialCrset.getFloat(7));
+            try {
+                noInitialCrset.undoUpdate();
+                fail("should throw SQLException");
+            } catch (SQLException e) {
+                // RI throw SQLException here.
+            }
+
+            noInitialCrset.moveToInsertRow();
+            noInitialCrset.updateInt(1, 10);
+            noInitialCrset.updateString(2, "update10");
+            noInitialCrset.insertRow();
+            noInitialCrset.moveToCurrentRow();
+            noInitialCrset.absolute(4);
+            assertEquals(10, noInitialCrset.getInt(1));
+            noInitialCrset.updateString(2, "abc");
+            // undoUpdate() has no effect here
+            noInitialCrset.undoUpdate();
+            noInitialCrset.acceptChanges(conn);
+
+            // check db
+            rs = st.executeQuery("SELECT * FROM USER_INFO WHERE ID = 10");
+            assertTrue(rs.next());
+            assertEquals(10, rs.getInt(1));
+            assertEquals("abc", rs.getString(2));
+
+            noInitialCrset.absolute(4);
+            assertEquals(10, noInitialCrset.getInt(1));
+            try {
+                noInitialCrset.undoUpdate();
+                fail("should throw SQLException");
+            } catch (SQLException e) {
+                // RI throw SQLException here.
+            }
+        }
+
+        noInitialCrset.moveToInsertRow();
+        noInitialCrset.updateInt(1, 10);
+        noInitialCrset.updateString(2, "update10");
+        noInitialCrset.insertRow();
+        try {
+            noInitialCrset.undoUpdate();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // RI throw SQLException here.
+        }
+        noInitialCrset.moveToCurrentRow();
+    }
+
     public void testUpdateValue() throws Exception {
 
         try {
@@ -414,7 +763,7 @@
             assertEquals(scaled, crset.getObject(5));
         } else {
             /*
-             * seems ri doesn't do scale
+             * TODO seems ri doesn't do scale
              */
             assertEquals(bigDecimal, crset.getBigDecimal(5));
             assertEquals(bigDecimal, crset.getObject(5));
@@ -472,5 +821,208 @@
         crset.insertRow();
         crset.moveToCurrentRow();
         crset.acceptChanges(conn);
+    }
+
+    public void testUpdateString() throws Exception {
+        crset.moveToInsertRow();
+
+        crset.updateInt(1, 50);
+        crset.updateString(2, "test100");
+        crset.updateInt(2, 2);
+        assertEquals("2", crset.getObject(2));
+
+        try {
+            crset.updateBytes(2, new byte[] { 1, 2 });
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        crset.updateDate(2, new Date(965324512));
+        assertEquals(new Date(965324512).toString(), crset.getObject(2));
+
+        crset.updateTime(2, new Time(452368512));
+        assertEquals(new Time(452368512).toString(), crset.getObject(2));
+
+        crset.updateTimestamp(2, new Timestamp(874532105));
+        assertEquals(new Timestamp(874532105).toString(), crset.getObject(2));
+
+        crset.updateBigDecimal(2, new BigDecimal(12));
+        assertEquals(new BigDecimal(12).toString(), crset.getObject(2));
+
+        crset.updateLong(3, 444423L);
+        crset.updateBigDecimal(4, new BigDecimal(12));
+        crset.updateBigDecimal(5, new BigDecimal(23));
+        crset.updateLong(6, 33);
+        crset.updateFloat(7, 4.8F);
+        crset.updateFloat(8, 4.888F);
+        crset.updateDouble(9, 4.9999);
+        crset.updateDate(10, new Date(965324512));
+        crset.updateTime(11, new Time(452368512));
+        crset.updateTimestamp(12, new Timestamp(874532105));
+    }
+
+    public void testUpdateDate() throws Exception {
+        crset.moveToInsertRow();
+
+        crset.updateInt(1, 50);
+        crset.updateString(2, "test100");
+        crset.updateLong(3, 444423L);
+        crset.updateBigDecimal(4, new BigDecimal(12));
+        crset.updateBigDecimal(5, new BigDecimal(23));
+        crset.updateLong(6, 33);
+        crset.updateFloat(7, 4.8F);
+        crset.updateFloat(8, 4.888F);
+        crset.updateDouble(9, 4.9999);
+
+        crset.updateDate(10, new Date(965324512));
+        try {
+            crset.updateInt(10, 12345);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateLong(10, 123456789L);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateDouble(10, 123456789.2398);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateTime(10, new Time(452368512));
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        crset.updateString(10, "test");
+        assertTrue(crset.getObject(10) instanceof String);
+        assertEquals("test", crset.getObject(10));
+
+        crset.updateTimestamp(10, new Timestamp(874532105));
+        assertTrue(crset.getObject(10) instanceof Date);
+        assertEquals(new Timestamp(874532105).getTime(), crset.getDate(10)
+                .getTime());
+
+        crset.updateTime(11, new Time(452368512));
+        crset.updateTimestamp(12, new Timestamp(874532105));
+    }
+
+    public void testUpdateTime() throws Exception {
+        crset.moveToInsertRow();
+
+        crset.updateInt(1, 50);
+        crset.updateString(2, "test100");
+        crset.updateLong(3, 444423L);
+        crset.updateBigDecimal(4, new BigDecimal(12));
+        crset.updateBigDecimal(5, new BigDecimal(23));
+        crset.updateLong(6, 33);
+        crset.updateFloat(7, 4.8F);
+        crset.updateFloat(8, 4.888F);
+        crset.updateDouble(9, 4.9999);
+        crset.updateDate(10, new Date(965324512));
+
+        crset.updateTime(11, new Time(452368512));
+
+        try {
+            crset.updateInt(11, 12345);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateLong(11, 123456789L);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateDouble(11, 123456789.2398);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateDate(11, new Date(452368512));
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        crset.updateString(11, "test");
+        assertTrue(crset.getObject(11) instanceof String);
+        assertEquals("test", crset.getObject(11));
+
+        crset.updateTimestamp(11, new Timestamp(874532105));
+        assertTrue(crset.getObject(11) instanceof Time);
+        assertEquals(new Timestamp(874532105).getTime(), crset.getTime(11)
+                .getTime());
+
+        crset.updateTimestamp(12, new Timestamp(874532105));
+    }
+
+    public void testUpdateTimestamp() throws Exception {
+        crset.moveToInsertRow();
+
+        crset.updateInt(1, 50);
+        crset.updateString(2, "test100");
+        crset.updateLong(3, 444423L);
+        crset.updateBigDecimal(4, new BigDecimal(12));
+        crset.updateBigDecimal(5, new BigDecimal(23));
+        crset.updateLong(6, 33);
+        crset.updateFloat(7, 4.8F);
+        crset.updateFloat(8, 4.888F);
+        crset.updateDouble(9, 4.9999);
+        crset.updateDate(10, new Date(965324512));
+        crset.updateTime(11, new Time(452368512));
+
+        crset.updateTimestamp(12, new Timestamp(874532105));
+
+        try {
+            crset.updateInt(12, 12345);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateLong(12, 123456789L);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        try {
+            crset.updateDouble(12, 123456789.2398);
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected, Data Type Mismatch
+        }
+
+        crset.updateString(12, "test");
+        assertTrue(crset.getObject(12) instanceof String);
+        assertEquals("test", crset.getObject(12));
+
+        crset.updateDate(12, new Date(452368512));
+        assertTrue(crset.getObject(12) instanceof Timestamp);
+        assertEquals(new Date(452368512).getTime(), crset.getTimestamp(12)
+                .getTime());
+
+        crset.updateTime(12, new Time(874532105));
+        assertTrue(crset.getObject(12) instanceof Timestamp);
+        assertEquals(new Timestamp(874532105).getTime(), crset.getTimestamp(12)
+                .getTime());
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/SyncResolverTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/SyncResolverTest.java?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/SyncResolverTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/SyncResolverTest.java
Wed Apr  9 04:01:14 2008
@@ -20,13 +20,14 @@
 import java.sql.SQLException;
 
 import javax.sql.RowSetMetaData;
+import javax.sql.rowset.CachedRowSet;
 import javax.sql.rowset.RowSetMetaDataImpl;
+import javax.sql.rowset.spi.SyncProviderException;
 import javax.sql.rowset.spi.SyncResolver;
 
 import org.apache.harmony.sql.internal.rowset.CachedRow;
 import org.apache.harmony.sql.internal.rowset.SyncResolverImpl;
 
-
 public class SyncResolverTest extends CachedRowSetTestCase {
     @Override
     public void setUp() throws Exception {
@@ -39,41 +40,36 @@
     }
 
     public void testNotSupportMethods() throws Exception {
-        /*
-         * TODO uncomment below fragment code when Harmony support detect
-         * conflict, so the test can run on both RI and Harmony
-         */
-        // CachedRowSet copy = crset.createCopy();
-        //
-        // copy.absolute(3);
-        // crset.absolute(3);
-        //
-        // copy.updateString(2, "updated");
-        // assertEquals("updated", copy.getString(2));
-        // assertEquals("test3", crset.getString(2));
-        //
-        // copy.updateRow();
-        // copy.acceptChanges();
-        //
-        // assertEquals(copy.getString(2), "updated");
-        // assertEquals(crset.getString(2), "test3");
-        //
-        // crset.updateString(2, "again");
-        //
-        // assertEquals(copy.getString(2), "updated");
-        // assertEquals(crset.getString(2), "again");
-        //
-        // crset.updateRow();
-        //
-        // SyncProviderException ex = null;
-        // try {
-        // crset.acceptChanges(conn);
-        // } catch (SyncProviderException e) {
-        // ex = e;
-        // }
-        //
-        // SyncResolver resolver = ex.getSyncResolver();
-        SyncResolver resolver = new SyncResolverImpl(null);
+        CachedRowSet copy = crset.createCopy();
+
+        copy.absolute(3);
+        crset.absolute(3);
+
+        copy.updateString(2, "updated");
+        assertEquals("updated", copy.getString(2));
+        assertEquals("test3", crset.getString(2));
+
+        copy.updateRow();
+        copy.acceptChanges();
+
+        assertEquals(copy.getString(2), "updated");
+        assertEquals(crset.getString(2), "test3");
+
+        crset.updateString(2, "again");
+
+        assertEquals(copy.getString(2), "updated");
+        assertEquals(crset.getString(2), "again");
+
+        crset.updateRow();
+
+        SyncProviderException ex = null;
+        try {
+            crset.acceptChanges(conn);
+        } catch (SyncProviderException e) {
+            ex = e;
+        }
+
+        SyncResolver resolver = ex.getSyncResolver();
 
         try {
             resolver.absolute(1);
@@ -372,7 +368,7 @@
         resolver.addConflictRow(
                 new CachedRow(new Object[DEFAULT_COLUMN_COUNT]), 2,
                 SyncResolver.INSERT_ROW_CONFLICT);
-        
+
         try {
             resolver.getStatus();
             fail("Should throw NullPointerException");

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?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- 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
Wed Apr  9 04:01:14 2008
@@ -941,6 +941,37 @@
                 params[0] instanceof SerialRef);
     }
 
+    // Parameters should be cleared when setCommand()
+    public void testSetCommand() throws SQLException {
+        BaseRowSetImpl baseRowSet = new BaseRowSetImpl();
+        baseRowSet.initParams();
+        baseRowSet.setCommand("Test command ? and ?");
+        baseRowSet.setString(1, "FirstParameter");
+        baseRowSet.setString(2, "SecondParameter");
+        Object[] params1 = baseRowSet.getParams();
+
+        assertEquals("The number of parameters should be 2 after setting.", 2,
+                params1.length);
+
+        baseRowSet.setCommand("Test command 2 without parameter");
+        Object[] params2 = baseRowSet.getParams();
+
+        assertEquals(
+                "The number of parameters should be 0 since command has been reset",
+                0, params2.length);
+
+    }
+
+    // Since the maxSize is set to 0 by default and 0 represents no limit, we
+    // can't just throw exception when we want to set size greater to 0,
+    public void testSetFetchSize() throws SQLException {
+        BaseRowSetImpl baseRowSet = new BaseRowSetImpl();
+        baseRowSet.initParams();
+        assertEquals(0, baseRowSet.getMaxRows());
+        baseRowSet.setFetchSize(3);
+        assertEquals("The fetch size should be set to 3.", 3, baseRowSet.getFetchSize());
+    }
+    
     private static final class BaseRowSetImpl extends BaseRowSet {
         private static final long serialVersionUID = 1L;
 

Modified: harmony/enhanced/classlib/branches/java6/modules/suncompat/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/suncompat/build.xml?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/suncompat/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/suncompat/build.xml Wed Apr  9 04:01:14
2008
@@ -97,7 +97,8 @@
 
     <target name="build-jar" depends="svn-info">
         <jar destfile="${hy.jdk}/jre/lib/boot/suncompat.jar"
-             manifest="${hy.suncompat}/META-INF/MANIFEST.MF">
+             manifest="${hy.suncompat}/META-INF/MANIFEST.MF"
+             compress="${hy.jar.compress}">
             <fileset refid="classes" />
             <manifest>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/build.xml?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/build.xml Wed Apr  9 04:01:14 2008
@@ -126,7 +126,8 @@
 
     <target name="build-jar" depends="svn-info">
         <jar destfile="${hy.jdk}/jre/lib/boot/${hy.swing.packaging.jarname}.jar"
-             manifest="${hy.swing}/META-INF/MANIFEST.MF">
+             manifest="${hy.swing}/META-INF/MANIFEST.MF"
+             compress="${hy.jar.compress}">
             <fileset refid="classes" />
             <fileset refid="hidden.classes" />
             <manifest>

Modified: harmony/enhanced/classlib/branches/java6/modules/text/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/build.xml?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/build.xml Wed Apr  9 04:01:14 2008
@@ -99,7 +99,8 @@
 
     <target name="build-jar" depends="svn-info">
         <jar destfile="${hy.jdk}/jre/lib/boot/text.jar"
-             manifest="${hy.text}/META-INF/MANIFEST.MF">
+             manifest="${hy.text}/META-INF/MANIFEST.MF"
+             compress="${hy.jar.compress}">
             <fileset refid="classes" />
             <manifest>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 

Modified: harmony/enhanced/classlib/branches/java6/modules/text/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/make/exclude.common?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/make/exclude.common (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/make/exclude.common Wed Apr  9 04:01:14
2008
@@ -3,3 +3,6 @@
 org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java
 org/apache/harmony/text/tests/java/text/NumberFormatTest.java
 org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
+org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java
+org/apache/harmony/text/tests/java/text/CollationElementIteratorTest.java
+

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java
Wed Apr  9 04:01:14 2008
@@ -185,8 +185,8 @@
     }
 
     /* private constructor used by createLineBidi() */
-    private Bidi(com.ibm.icu.text.Bidi bidi) {
-        this.icuBidi = bidi;
+    private Bidi() {
+        super();
     }
 
     /**
@@ -218,8 +218,8 @@
                     "text.12", new Object[] { lineStart, lineLimit, length })); //$NON-NLS-1$
         }
 
-        com.ibm.icu.text.Bidi lineBidi = icuBidi.createLineBidi(lineStart, lineLimit);
-        Bidi bidi = new Bidi(lineBidi);
+        Bidi bidi = new Bidi();
+        bidi.icuBidi = icuBidi.createLineBidi(lineStart, lineLimit);
         return bidi;
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml Wed Apr  9 04:01:14 2008
@@ -101,7 +101,8 @@
 
     <target name="build-jar" depends="svn-info">
         <jar destfile="${hy.jdk}/jre/lib/boot/${hy.x-net.packaging.jarname}.jar"
-            manifest="${hy.x-net}/META-INF/MANIFEST.MF">
+             manifest="${hy.x-net}/META-INF/MANIFEST.MF"
+             compress="${hy.jar.compress}">
             <fileset refid="classes" />
             <manifest>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java
Wed Apr  9 04:01:14 2008
@@ -29,10 +29,8 @@
 
 import junit.framework.TestCase;
 
-
 /**
  * Tests for <code>HandshakeCompletedEvent</code> class constructors and methods.
- * 
  */
 public class HandshakeCompletedEventTest extends TestCase {
 
@@ -87,14 +85,9 @@
         SSLSession ses = new MySSLSession();
 
         HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);
-        String name = event.getCipherSuite();
-        String name_ses = ses.getCipherSuite();
-        if (name == null && name_ses != null) {
-            fail("incorrect null CipherCuite");
-        }
-        if (!name.equals(name_ses)) {
-            fail("incorrect CipherCuite");
-        }
+        
+        assertNotNull(event.getCipherSuite());
+        assertNull(ses.getCipherSuite());
     }
 
     public final void testGetLocalCertificates() {
@@ -151,12 +144,8 @@
         }
     	SSLSession ses = new MySSLSession();
         HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);
-        if (!ses.equals(event.getSession())) {
-            fail("incorrect session");
-        }
-        if (!soc.equals(event.getSocket())) {
-            fail("incorrect socket");
-        }
+        
+        assertEquals(ses, event.getSession());
+        assertEquals(soc, event.getSocket());
     }
-
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java
Wed Apr  9 04:01:14 2008
@@ -26,11 +26,9 @@
 
 import junit.framework.TestCase;
 
-
 /**
  * Tests for <code>KeyStoreBuilderParameters</code> class constructors and
  * methods.
- *  
  */
 public class KeyStoreBuilderParametersTest extends TestCase {
 
@@ -71,12 +69,8 @@
             fail("The list is modifiable");
         } catch (UnsupportedOperationException e) {
         }
-        if (result.size() != 1) {
-            fail("incorrect size");
-        }
-        if (!result.contains(builder)) {
-            fail("incorrect list");
-        }
+        assertEquals("incorrect size", 1, result.size());
+        assertTrue("incorrect list", result.contains(builder));
         
         ksbuilders = new ArrayList();
         ksbuilders.add(builder);
@@ -88,12 +82,8 @@
             fail("The list is modifiable");
         } catch (UnsupportedOperationException e) {
         }
-        if (result.size() != 2) {
-            fail("incorrect size");
-        }
-        if (!result.containsAll(ksbuilders)) {
-            fail("incorrect list");
-        }
+        assertEquals("incorrect size", 2, result.size());
+        assertTrue("incorrect list", result.containsAll(ksbuilders));
     }
 }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java?rev=646264&r1=646263&r2=646264&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java
Wed Apr  9 04:01:14 2008
@@ -38,12 +38,9 @@
     public final void testSSLSessionBindingEvent() {
         SSLSession ses = new MySSLSession();
         SSLSessionBindingEvent event = new SSLSessionBindingEvent(ses, "test");
-        if (!"test".equals(event.getName())) {
-            fail("incorrect name");
-        }
-        if (!event.getSession().equals(ses)) {
-            fail("incorrect session");
-        }
+        
+        assertEquals("test", event.getName());
+        assertEquals(ses, event.getSession());
     }
 
 }



Mime
View raw message