harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r660407 - in /harmony/enhanced/classlib/branches/java6/modules/sql/src: main/java/org/apache/harmony/sql/internal/nls/ main/java/org/apache/harmony/sql/internal/rowset/ test/java/org/apache/harmony/sql/tests/internal/rowset/
Date Tue, 27 May 2008 06:56:43 GMT
Author: qiuxx
Date: Mon May 26 23:56:31 2008
New Revision: 660407

URL: http://svn.apache.org/viewvc?rev=660407&view=rev
Log:
Apply patch for HARMONY-5836 ([java6][classlib][sql][rowset] - update rowset tests to java6)

Modified:
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetInsertTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetSQLWarningTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetUpdateTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetCachedRowSetTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetOtherTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
Mon May 26 23:56:31 2008
@@ -95,7 +95,7 @@
 rowset.32=The given rowset is empty
 rowset.33=Not a rowset
 rowset.34=Not set a match column
-rowset.35=Not a valid match olumn index
+rowset.35=Not a valid match column index
 rowset.36=Number of elements of two arrays don't equal
 rowset.37=The RowSet doesn't set the table name
 rowset.38=This type of join is not supported

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
Mon May 26 23:56:31 2008
@@ -1141,7 +1141,7 @@
             throw new SQLException(Messages.getString("rowset.4")); //$NON-NLS-1$
         }
         rows.remove(currentRow);
-        next();
+        absolute(currentRowIndex);
         if (isNotifyListener) {
             notifyRowChanged();
         }
@@ -1149,16 +1149,16 @@
 
     public void undoUpdate() throws SQLException {
         checkValidRow();
-        if (isCursorOnInsert && insertRow == null) {
+        if (isCursorOnInsert) {
             // rowset.11=Illegal operation on an insert row
             throw new SQLException(Messages.getString("rowset.11")); //$NON-NLS-1$
         }
-        if (currentRow == insertRow) {
-            currentRow = new CachedRow(new Object[columnCount]);
-        } else if (rowUpdated()) {
-            currentRow.restoreOriginal();
+        if (!rowInserted()) {
+            // rowset.4=Not an insert row
+            throw new SQLException(Messages.getString("rowset.4")); //$NON-NLS-1$
         }
-
+        rows.remove(currentRow);
+        absolute(currentRowIndex);
         if (isNotifyListener) {
             notifyRowChanged();
         }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java
Mon May 26 23:56:31 2008
@@ -1525,6 +1525,7 @@
         crset.updateTimestamp(12, new Timestamp(874532105));
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
         // check the new row in CachedRowSet
         crset.beforeFirst();
@@ -1550,6 +1551,7 @@
             noInitialCrset.insertRow();
         }
         noInitialCrset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         noInitialCrset.acceptChanges(conn);
         // check the new rows in CachedRowSet
         assertEquals(20, noInitialCrset.size());
@@ -1734,28 +1736,11 @@
             crset.deleteRow();
         }
 
-        // TODO maybe RI's bug
-        if ("true".equals(System.getProperty("Testing Harmony"))) {
-            crset.acceptChanges(conn);
-        } else {
-            try {
-                crset.acceptChanges(conn);
-            } catch (NullPointerException e) {
-                // RI would throw NullPointerException when deleting a row in
-                // which some columns' value are null
-            }
-        }
+        crset.acceptChanges(conn);
         // check DB
-        rs = st.executeQuery("select * from USER_INFO");
-        int rowCount = 0;
-        while (rs.next()) {
-            rowCount++;
-        }
-        if ("true".equals(System.getProperty("Testing Harmony"))) {
-            assertEquals(0, rowCount);
-        } else {
-            assertEquals(4, rowCount);
-        }
+        rs = st.executeQuery("select count(*) from USER_INFO");
+        assertTrue(rs.next());
+        assertEquals(0, rs.getInt(1));
     }
 
     public void testAcceptChanges_DeleteException() throws Exception {
@@ -2437,7 +2422,7 @@
             noInitialCrset.populate(rs);
 
             Collection<?> collection = noInitialCrset.toCollection();
-            assertEquals("class java.util.TreeMap$2", collection.getClass()
+            assertEquals("class java.util.TreeMap$Values", collection.getClass()
                     .toString());
             Iterator iter = collection.iterator();
             assertTrue(iter.hasNext());

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetInsertTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetInsertTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetInsertTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetInsertTest.java
Mon May 26 23:56:31 2008
@@ -180,6 +180,7 @@
         noInitialCrset.moveToCurrentRow();
 
         // commit to database
+        noInitialCrset.setTableName("USER_INFO");
         noInitialCrset.acceptChanges(conn);
 
         // check db
@@ -385,6 +386,7 @@
             // expected
         }
         noInitialCrset.moveToCurrentRow();
+        noInitialCrset.setTableName("USER_INFO");
         noInitialCrset.acceptChanges(conn);
         assertEquals(3, noInitialCrset.getInt(1));
 
@@ -422,9 +424,6 @@
         }
         assertEquals(20, noInitialCrset.getInt(1));
         assertTrue(noInitialCrset.rowInserted());
-        /*
-         * When run on RI, undoInsert() has no effect.
-         */
         noInitialCrset.undoInsert();
 
         // commit to database
@@ -433,11 +432,6 @@
         // check db
         rs = st.executeQuery("SELECT COUNT(*) FROM USER_INFO WHERE ID = 20");
         assertTrue(rs.next());
-        if ("true".equals(System.getProperty("Testing Harmony"))) {
-            assertEquals(0, rs.getInt(1));
-        } else {
-            // undoInsert() has no effect when run RI.
-            assertEquals(1, rs.getInt(1));
-        }
+        assertEquals(0, rs.getInt(1));
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetSQLWarningTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetSQLWarningTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetSQLWarningTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetSQLWarningTest.java
Mon May 26 23:56:31 2008
@@ -69,7 +69,7 @@
         rs = st.executeQuery("SELECT * FROM USER_INFO");
         noInitialCrset.populate(rs);
         assertNull(rs.getWarnings());
-        
+
         assertTrue(noInitialCrset.first());
         assertNull(rs.getWarnings());
     }
@@ -119,6 +119,7 @@
         assertNull(rsWarning.getSQLState());
         assertEquals(0, rsWarning.getErrorCode());
 
+        noInitialCrset.setTableName("USER_INFO");
         noInitialCrset.acceptChanges(conn);
         assertEquals(rsWarning, noInitialCrset.getRowSetWarnings());
         assertEquals(0, rsWarning.getErrorCode());

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=660407&r1=660406&r2=660407&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
Mon May 26 23:56:31 2008
@@ -251,9 +251,7 @@
             // expected
         }
 
-        rs = st.executeQuery("SELECT * FROM USER_INFO");
-        noInitialCrset.populate(rs);
-
+        noInitialCrset.populate(st.executeQuery("SELECT * FROM USER_INFO"));
         assertTrue(noInitialCrset.isBeforeFirst());
         try {
             noInitialCrset.undoUpdate();
@@ -271,110 +269,79 @@
             // 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
+        assertTrue(noInitialCrset.absolute(3));
+        try {
+            noInitialCrset.undoUpdate();
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // RI throw SQLException 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.updateString(2, "update3");
+        noInitialCrset.updateLong(3, 3333333L);
+        noInitialCrset.updateFloat(7, 3.3F);
+        try {
             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
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // RI throw SQLException here.
+        }
+
+        noInitialCrset.updateRow();
+        try {
             noInitialCrset.undoUpdate();
-            noInitialCrset.acceptChanges(conn);
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // RI throw SQLException here.
+        }
 
-            // 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.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();
         try {
             noInitialCrset.undoUpdate();
             fail("should throw SQLException");
         } catch (SQLException e) {
             // RI throw SQLException here.
         }
-        noInitialCrset.moveToCurrentRow();
+
+        // move to the inserted row
+        noInitialCrset.absolute(4);
+        assertTrue(noInitialCrset.rowInserted());
+        assertEquals(10, noInitialCrset.getInt(1));
+        // undoUpdate() work. It undo the insert operation.
+        noInitialCrset.undoUpdate();
+        // The cursor moves to the next row.
+        assertFalse(noInitialCrset.rowInserted());
+        assertEquals(4, noInitialCrset.getInt(1));
+        noInitialCrset.acceptChanges(conn);
+
+        // check db
+        rs = st.executeQuery("SELECT COUNT(*) FROM USER_INFO WHERE ID = 10");
+        assertTrue(rs.next());
+        assertEquals(0, rs.getInt(1));
+
+        // check CachedRowSet
+        noInitialCrset.beforeFirst();
+        int index = 0;
+        while (noInitialCrset.next()) {
+            index++;
+            assertEquals(index, noInitialCrset.getInt(1));
+        }
+        assertEquals(4, index);
     }
 
     public void testUpdateValue() throws Exception {
@@ -425,8 +392,8 @@
 
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
-
     }
 
     public void testUpdateLong() throws SQLException {
@@ -481,8 +448,8 @@
         crset.updateTimestamp(12, new Timestamp(874532105));
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
-
     }
 
     public void testUpdateInt() throws SQLException {
@@ -543,6 +510,7 @@
         crset.updateTimestamp(12, new Timestamp(874532105));
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
 
         ResultSet rs = st
@@ -615,6 +583,7 @@
         crset.updateTimestamp(12, new Timestamp(874532105));
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
     }
 
@@ -656,6 +625,7 @@
         crset.updateTimestamp(12, new Timestamp(874532105));
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
     }
 
@@ -712,7 +682,7 @@
 
         crset.insertRow();
         crset.moveToCurrentRow();
-
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
     }
 
@@ -820,6 +790,7 @@
         crset.updateTimestamp(12, new Timestamp(874532105));
         crset.insertRow();
         crset.moveToCurrentRow();
+        crset.setTableName("USER_INFO");
         crset.acceptChanges(conn);
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
Mon May 26 23:56:31 2008
@@ -384,30 +384,9 @@
          * when running on RI.
          */
         filteredRowSet.moveToInsertRow();
-        if ("true".equals(System.getProperty("Testing Harmony"))) {
-            filteredRowSet.updateInt(1, 10);
-            filteredRowSet.updateString(2, "insert10");
-            filteredRowSet.insertRow();
-        } else {
-            try {
-                filteredRowSet.updateInt(1, 10);
-                fail("should throw NullPointerException");
-            } catch (NullPointerException e) {
-                // expected
-            }
-            try {
-                filteredRowSet.updateString(2, "insert10");
-                fail("should throw NullPointerException");
-            } catch (NullPointerException e) {
-                // expected
-            }
-            try {
-                filteredRowSet.insertRow();
-                fail("should throw SQLException");
-            } catch (SQLException e) {
-                // expected
-            }
-        }
+        filteredRowSet.updateInt(1, 10);
+        filteredRowSet.updateString(2, "insert10");
+        filteredRowSet.insertRow();
         filteredRowSet.moveToCurrentRow();
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetCachedRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetCachedRowSetTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetCachedRowSetTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetCachedRowSetTest.java
Mon May 26 23:56:31 2008
@@ -611,6 +611,7 @@
         } catch (SyncProviderException e) {
             // Expected.
         }
+        jrs.setTableName("USER_INFO");
         jrs.acceptChanges(conn);
         rs = st.executeQuery("select * from USER_INFO");
         crset = newNoInitialInstance();

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetOtherTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetOtherTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetOtherTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetOtherTest.java
Mon May 26 23:56:31 2008
@@ -126,20 +126,11 @@
         }
 
         // Tests setJoinType(CROSS_JOIN)
-        if (System.getProperty("Testing Harmony") == "true") {
-            try {
-                jrs.setJoinType(JoinRowSet.CROSS_JOIN);
-                fail("Should throw SQLException according to spec.");
-            } catch (SQLException e) {
-                // Expected.
-            }
-        } else {
-            try {
-                jrs.setJoinType(JoinRowSet.CROSS_JOIN);
-                fail("Should throw UnsupportedOperationException in RI");
-            } catch (UnsupportedOperationException e) {
-                // Expected
-            }
+        try {
+            jrs.setJoinType(JoinRowSet.CROSS_JOIN);
+            fail("Should throw SQLException according to spec.");
+        } catch (SQLException e) {
+            // Expected.
         }
 
         // Tests setJoinType(INNER_JOIN)
@@ -148,54 +139,27 @@
         assertEquals(JoinRowSet.INNER_JOIN, joinType);
 
         // Tests setJoinType(FULL_JOIN)
-        if (System.getProperty("Testing Harmony") == "true") {
-            try {
-                jrs.setJoinType(JoinRowSet.FULL_JOIN);
-                fail("Should throw SQLException according to spec.");
-            } catch (SQLException e) {
-                // Expected.
-            }
-        } else {
-            try {
-                jrs.setJoinType(JoinRowSet.FULL_JOIN);
-                fail("Should throw UnsupportedOperationException in RI");
-            } catch (UnsupportedOperationException e) {
-                // Expected
-            }
+        try {
+            jrs.setJoinType(JoinRowSet.FULL_JOIN);
+            fail("Should throw SQLException according to spec.");
+        } catch (SQLException e) {
+            // Expected.
         }
 
         // Tests setJoinType(LEFT_OUTER_JOIN)
-        if (System.getProperty("Testing Harmony") == "true") {
-            try {
-                jrs.setJoinType(JoinRowSet.LEFT_OUTER_JOIN);
-                fail("Should throw SQLException according to spec.");
-            } catch (SQLException e) {
-                // Expected.
-            }
-        } else {
-            try {
-                jrs.setJoinType(JoinRowSet.LEFT_OUTER_JOIN);
-                fail("Should throw UnsupportedOperationException in RI");
-            } catch (UnsupportedOperationException e) {
-                // Expected
-            }
+        try {
+            jrs.setJoinType(JoinRowSet.LEFT_OUTER_JOIN);
+            fail("Should throw SQLException according to spec.");
+        } catch (SQLException e) {
+            // Expected.
         }
 
         // Tests setJoinType(RIGHT_OUTER_JOIN)
-        if (System.getProperty("Testing Harmony") == "true") {
-            try {
-                jrs.setJoinType(JoinRowSet.RIGHT_OUTER_JOIN);
-                fail("Should throw SQLException according to spec.");
-            } catch (SQLException e) {
-                // Expected.
-            }
-        } else {
-            try {
-                jrs.setJoinType(JoinRowSet.RIGHT_OUTER_JOIN);
-                fail("Should throw UnsupportedOperationException in RI");
-            } catch (UnsupportedOperationException e) {
-                // Expected
-            }
+        try {
+            jrs.setJoinType(JoinRowSet.RIGHT_OUTER_JOIN);
+            fail("Should throw SQLException according to spec.");
+        } catch (SQLException e) {
+            // Expected.
         }
 
         // Tests setJoinType(-1)
@@ -307,23 +271,23 @@
      * @tests java.sql.rowset.joinRowSet#addRowSet()
      */
     public void testAddRowSet_NoInitialCachedRowSet() throws Exception {
-        Collection collection;
-
         CachedRowSet crs = newNoInitialInstance();
-        
+
         if ("true".equals(System.getProperty("Testing Harmony"))) {
             try {
                 jrs.addRowSet(crs, 1);
                 fail("Should throw SQLException in harmony.");
+            } catch (SQLException e) {
+                // Expected.
             }
-            catch (SQLException e)
-            {
+        } else {
+            try {
+                jrs.addRowSet(crs, 1);
+                fail("should throw NullPointerException");
+            } catch (NullPointerException e) {
                 // Expected.
             }
         }
-        else {
-            jrs.addRowSet(crs, 1);
-        }
     }
 
     public void testGetRowSets_MultipleCachedRowSet() throws Exception {

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java?rev=660407&r1=660406&r2=660407&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java
Mon May 26 23:56:31 2008
@@ -527,15 +527,17 @@
                     i++;
                 }
                 assertEquals("type", list.item(i).getNodeName());
-                assertEquals(key, list.item(i).getTextContent());
+                String docTypeName = list.item(i).getTextContent();
+                assertTrue(webRs.getTypeMap().keySet().contains(docTypeName));
                 ++i;
 
                 while (!(list.item(i) instanceof Element)) {
                     i++;
                 }
                 assertEquals("class", list.item(i).getNodeName());
-                assertEquals(webRs.getTypeMap().get(key).getName(), list
-                        .item(i).getTextContent());
+                assertEquals(webRs.getTypeMap().get(docTypeName).getName(),
+                        list.item(i).getTextContent());
+
                 ++i;
             }
         }



Mime
View raw message