You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2008/05/01 05:14:38 UTC
svn commit: r652421 [6/6] - in
/harmony/enhanced/classlib/branches/java6/modules:
beans/src/main/java/java/beans/
beans/src/main/java/org/apache/harmony/beans/editors/
beans/src/test/java/org/apache/harmony/beans/tests/java/beans/
imageio/src/main/java...
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java Wed Apr 30 20:14:31 2008
@@ -58,11 +58,7 @@
try {
conn = DriverManager.getConnection(DERBY_URL);
} catch (SQLException e) {
- try {
- conn = DriverManager.getConnection(DERBY_URL_Create);
- } catch (SQLException ee) {
- throw new SQLException("Create DB Failure!");
- }
+ conn = DriverManager.getConnection(DERBY_URL_Create);
}
st = conn.createStatement();
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=652421&r1=652420&r2=652421&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 Wed Apr 30 20:14:31 2008
@@ -53,11 +53,15 @@
Predicate range = new RangeOne();
filteredRowSet.setFilter(range);
- try {
+ if ("true".equals(System.getProperty("Testing Harmony"))) {
filteredRowSet.createCopy();
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
+ } else {
+ try {
+ filteredRowSet.createCopy();
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JdbcRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JdbcRowSetTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JdbcRowSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JdbcRowSetTest.java Wed Apr 30 20:14:31 2008
@@ -252,7 +252,7 @@
assertEquals(0, jrs.getMaxRows());
assertEquals(0, jrs.getQueryTimeout());
- assertEquals(false, jrs.getShowDeleted());
+ assertFalse(jrs.getShowDeleted());
assertEquals(DERBY_URL, jrs.getUrl());
assertNull(jrs.getUsername());
@@ -274,7 +274,7 @@
assertEquals(0, jrs.getMaxRows());
assertEquals(0, jrs.getQueryTimeout());
- assertEquals(false, jrs.getShowDeleted());
+ assertFalse(jrs.getShowDeleted());
assertEquals(DERBY_URL, jrs.getUrl());
assertNull(jrs.getUsername());
@@ -1018,6 +1018,18 @@
// expected
}
jrs.getFetchSize();
+ try {
+ jrs.getMatchColumnIndexes();
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+ try {
+ jrs.getMatchColumnNames();
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
jrs.getMaxFieldSize();
jrs.getMaxRows();
try {
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTest.java Wed Apr 30 20:14:31 2008
@@ -312,7 +312,6 @@
* Test empty WebRowSet
*/
WebRowSet webRs = newWebRowSet();
-
/*
* Though WebRowSet implements Joinable, addRowSet(WebRowSet) would
* throw ClassCastException when run on RI.
@@ -336,6 +335,8 @@
try {
jrs.addRowSet(webRs);
fail("should throw NullPointerException");
+ } catch (NullPointerException e) {
+ // expected
} catch (SQLException e) {
// Expected
}
@@ -348,15 +349,14 @@
/*
* Test WebRowSet filled with data
*/
- // TODO uncomment it after implementing addRowSet(RowSet, int)
- // jrs = newJoinRowSet();
- // webRs = newWebRowSet();
- // webRs.populate(st.executeQuery("SELECT * FROM USER_INFO"));
- // webRs.setMatchColumn(1);
- // jrs.addRowSet(webRs);
- // assertTrue(jrs.next());
- // assertEquals(1, jrs.getInt(1));
- // jrs.close();
+ jrs = newJoinRowSet();
+ webRs = newWebRowSet();
+ webRs.populate(st.executeQuery("SELECT * FROM USER_INFO"));
+ webRs.setMatchColumn(1);
+ jrs.addRowSet(webRs);
+ assertTrue(jrs.next());
+ assertEquals(1, jrs.getInt(1));
+ jrs.close();
}
public void testAddJoinableRowSet_WebRowSet_Int_Exception()
@@ -381,14 +381,13 @@
/*
* Test non-empty WebRowSet.
*/
- // TODO uncomment it after implementing addRowSet(RowSet, int)
- // jrs = newJoinRowSet();
- // webRs = newWebRowSet();
- // webRs.populate(st.executeQuery("SELECT * FROM USER_INFO"));
- // jrs.addRowSet(webRs, 1);
- // assertTrue(jrs.next());
- // assertEquals(1, jrs.getInt(1));
- // jrs.close();
+ jrs = newJoinRowSet();
+ webRs = newWebRowSet();
+ webRs.populate(st.executeQuery("SELECT * FROM USER_INFO"));
+ jrs.addRowSet(webRs, 1);
+ assertTrue(jrs.next());
+ assertEquals(1, jrs.getInt(1));
+ jrs.close();
}
public void testAddJoinableRowSet_FilteredRowSet_Exception()
@@ -604,6 +603,7 @@
}
}
}
+
}
private boolean isTypeMatch(int first, int second) throws Exception {
@@ -739,12 +739,9 @@
crset.setTableName("BOOKS");
jrs.addRowSet(crset);
if ("true".equals(System.getProperty("Testing Harmony"))) {
- try {
- jrs.getRowSetNames();
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
+ assertEquals(2, jrs.getRowSetNames().length);
+ assertEquals("USER_INFO", jrs.getRowSetNames()[0]);
+ assertEquals("BOOKS", jrs.getRowSetNames()[1]);
} else {
try {
jrs.getRowSetNames();
@@ -754,4 +751,185 @@
}
}
}
+
+ public void testToCachedRowSet_CachedRowSet() throws Exception {
+ /*
+ * Test empty JoinRowSet
+ */
+ CachedRowSet emptyToCrset = jrs.toCachedRowSet();
+ assertNull(emptyToCrset.getMetaData());
+ assertFalse(emptyToCrset.first());
+
+ /*
+ * The first CachedRowSet
+ */
+ jrs = newJoinRowSet();
+ jrs.addRowSet(crset, 1);
+ CachedRowSet toCrset = jrs.toCachedRowSet();
+ // check metadata
+ assertSame(crset.getMetaData(), jrs.getMetaData());
+ assertSame(crset.getMetaData(), toCrset.getMetaData());
+ assertNotSame(crset, toCrset);
+ // check data
+ int index = 0;
+ toCrset.beforeFirst();
+ crset.beforeFirst();
+ while (toCrset.next() && crset.next()) {
+ for (int i = 1; i <= crset.getMetaData().getColumnCount(); i++) {
+ assertEquals(toCrset.getObject(i), crset.getObject(i));
+ }
+ index++;
+ }
+ assertEquals(4, index);
+
+ /*
+ * The second CachedRowSet
+ */
+ noInitialCrset.populate(st.executeQuery("SELECT * FROM BOOKS"));
+ jrs.addRowSet(noInitialCrset, 1);
+ toCrset = jrs.toCachedRowSet();
+ // check metadata
+ assertSame(jrs.getMetaData(), toCrset.getMetaData());
+ /*
+ * check data. The data order is not the same between RI and HY.
+ */
+ index = 0;
+ rs = st.executeQuery("SELECT * FROM BOOKS");
+ if ("true".equals(System.getProperty("Testing Harmony"))) {
+ toCrset.beforeFirst();
+ while (toCrset.next() && rs.next()) {
+ index++;
+ assertEquals(toCrset.getObject(14), rs.getObject(3));
+ }
+ } else {
+ toCrset.afterLast();
+ while (toCrset.previous() && rs.next()) {
+ index++;
+ assertEquals(toCrset.getObject(14), rs.getObject(3));
+ }
+ }
+ assertEquals(6, index);
+
+ /*
+ * The third CachedRowSet
+ */
+ insertDataToCustomerTable();
+ CachedRowSet thirdCrset = newNoInitialInstance();
+ thirdCrset.populate(st.executeQuery("SELECT * FROM CUSTOMER_INFO"));
+ jrs.addRowSet(thirdCrset, 1);
+ toCrset = jrs.toCachedRowSet();
+ // check metadata
+ assertSame(jrs.getMetaData(), toCrset.getMetaData());
+ // check data
+ toCrset.beforeFirst();
+ index = 1;
+ while (toCrset.next()) {
+ if (index == 1) {
+ assertEquals(3, toCrset.getInt(1));
+ index++;
+ } else if (index == 2) {
+ assertEquals(3, toCrset.getInt(1));
+ index++;
+ } else if (index == 3) {
+ assertEquals(4, toCrset.getInt(1));
+ } else {
+ index = -1;
+ }
+ }
+ assertEquals(3, index);
+ }
+
+ public void testToCachedRowSet_acceptChanges() throws Exception {
+ /*
+ * The first CachedRowSet
+ */
+ jrs.addRowSet(crset, 1);
+ CachedRowSet toCrset = jrs.toCachedRowSet();
+ // call crset.acceptChanges()
+ assertTrue(crset.absolute(3));
+ assertEquals("test3", crset.getString(2));
+ crset.updateString(2, "update3");
+ crset.updateRow();
+ crset.acceptChanges();
+ assertTrue(crset.absolute(3));
+ assertEquals("update3", crset.getString(2));
+ // call toCrset.acceptChanges()
+ assertTrue(toCrset.absolute(3));
+ assertEquals("test3", toCrset.getString(2));
+ assertTrue(toCrset.last());
+ assertEquals("test4", toCrset.getString(2));
+ toCrset.updateString(2, "update4");
+ toCrset.updateRow();
+ toCrset.acceptChanges();
+ assertTrue(toCrset.absolute(4));
+ assertEquals("update4", toCrset.getString(2));
+
+ /*
+ * The second CachedRowSet
+ */
+ noInitialCrset.populate(st.executeQuery("SELECT * FROM BOOKS"));
+ jrs.addRowSet(noInitialCrset, 1);
+ toCrset = jrs.toCachedRowSet();
+ // call toCrset.acceptChanges()
+ if ("true".equals(System.getProperty("Testing Harmony"))) {
+ assertTrue(toCrset.last());
+ } else {
+ assertTrue(toCrset.first());
+ }
+ assertEquals(4, toCrset.getInt(1));
+ toCrset.updateString(2, "modify4");
+ toCrset.updateRow();
+ try {
+ toCrset.acceptChanges();
+ fail("should throw exception");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testCancelRowUpdates_Simple() throws Exception {
+ jrs.addRowSet(crset, 1);
+ Listener listener = new Listener();
+ jrs.addRowSetListener(listener);
+
+ jrs.absolute(4);
+ jrs.updateString(2, "Updated");
+ jrs.updateRow();
+ jrs.absolute(4);
+ assertEquals("Updated", jrs.getString(2));
+
+ jrs.cancelRowUpdates();
+ jrs.absolute(4);
+ assertEquals("test4", jrs.getString(2));
+ assertNull(listener.getTag());
+ }
+
+ public void testCancelRowUpdates() throws Exception {
+ jrs.addRowSet(crset, 1);
+ Listener listener = new Listener();
+ jrs.addRowSetListener(listener);
+
+ assertTrue(jrs.absolute(3));
+ jrs.updateString(2, "update3");
+ // call cancelRowUpdates() before updateRow(), no effect here
+ listener.clear();
+ jrs.cancelRowUpdates();
+ assertNull(listener.getTag());
+ assertEquals("update3", jrs.getString(2));
+ jrs.updateRow();
+ jrs.absolute(3);
+ assertEquals("update3", jrs.getString(2));
+
+ assertTrue(jrs.absolute(4));
+ jrs.updateString(2, "update4");
+ assertEquals("update4", jrs.getString(2));
+ jrs.updateRow();
+ assertEquals("update4", jrs.getString(2));
+ // call cancelRowUpdates() after updateRow(), it works here
+ listener.clear();
+ assertEquals("update4", jrs.getString(2));
+ jrs.cancelRowUpdates();
+ assertEquals("test4", jrs.getString(2));
+ assertNull(listener.getTag());
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTestCase.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTestCase.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/JoinRowSetTestCase.java Wed Apr 30 20:14:31 2008
@@ -17,7 +17,9 @@
package org.apache.harmony.sql.tests.internal.rowset;
+import java.sql.PreparedStatement;
import java.sql.SQLException;
+
import javax.sql.RowSet;
import javax.sql.rowset.FilteredRowSet;
import javax.sql.rowset.JdbcRowSet;
@@ -31,6 +33,7 @@
public void setUp() throws Exception {
super.setUp();
createBookTable();
+ createNewTable();
jrs = newJoinRowSet();
}
@@ -72,6 +75,68 @@
.executeUpdate("insert into BOOKS(AUTHORID,SN,NAME) values (5,'sn5-1','test5')");
}
+ public void insertNullDataToBooks() throws Exception {
+ st = conn.createStatement();
+ st
+ .executeUpdate("insert into BOOKS(AUTHORID,SN,NAME) values (1,'sn1-1','null')");
+
+ st
+ .executeUpdate("insert into BOOKS(AUTHORID,SN,NAME) values (2,'sn1-2','null')");
+ st
+
+ .executeUpdate("insert into BOOKS(AUTHORID,SN,NAME) values (3,'sn4-1','null')");
+
+ }
+
+ public void addUnsortableToBooksTable() throws Exception {
+ st = conn.createStatement();
+ st.executeUpdate("alter table BOOKS add VARCHAR_FOR_BIT_T VARCHAR(100) FOR BIT DATA");
+
+ String insertSQL = "INSERT INTO BOOKS(AUTHORID, SN, NAME, VARCHAR_FOR_BIT_T) VALUES(?, ?, ?, ?)";
+ PreparedStatement preStmt = conn.prepareStatement(insertSQL);
+
+ byte[] bs = new byte[] { 1, 2, 3, 4, 5 };
+ preStmt.setInt(1, 10);
+ preStmt.setString(2, "sn10");
+ preStmt.setString(3, "test10");
+ preStmt.setBytes(4, bs);
+ preStmt.executeUpdate();
+
+ byte[] bs2 = new byte[] { 2, 3, 4, 5, 6, 7};
+
+ preStmt.setInt(1, 11);
+ preStmt.setString(2, "sn11");
+ preStmt.setString(3, "test11");
+ preStmt.setBytes(4, bs2);
+ preStmt.executeUpdate();
+
+ preStmt.setInt(1, 12);
+ preStmt.setString(2, "sn12");
+ preStmt.setString(3, "test12");
+ preStmt.setBytes(4, bs);
+ preStmt.executeUpdate();
+
+ preStmt.setInt(1, 13);
+ preStmt.setString(2, "sn13");
+ preStmt.setString(3, "test13");
+ preStmt.setBytes(4, bs2);
+ preStmt.executeUpdate();
+
+
+ if (preStmt != null) {
+ preStmt.close();
+ }
+ }
+
+ public void insertNullDataToUserInfo() throws Exception {
+ st = conn.createStatement();
+ st
+ .executeUpdate("insert into USER_INFO(ID,NAME) values (235,'null')");
+ st
+ .executeUpdate("insert into USER_INFO(ID,NAME) values (357,'null')");
+
+ }
+
protected JoinRowSet newJoinRowSet() throws Exception {
JoinRowSet jrs = null;
try {
@@ -143,4 +208,136 @@
}
return -1;
}
+
+
+
+
+
+ protected boolean dataEqualsIgnoreOrder(RowSet rowSet1, RowSet rowSet2)
+ throws SQLException {
+ // First decides if the column num are equal.
+ int columnNum = rowSet1.getMetaData().getColumnCount();
+ if (rowSet2.getMetaData().getColumnCount() != columnNum) {
+ return false;
+ }
+
+ // Then decides if the row num are equal.
+ rowSet1.beforeFirst();
+ rowSet2.beforeFirst();
+
+ while (rowSet1.next()) {
+ rowSet2.next();
+ }
+ if (!rowSet2.isLast()) {
+ return false;
+ }
+
+ // For each row in rowSet1, try to find an equal row in rowSet2.
+ // If not found, return false.
+ rowSet1.beforeFirst();
+
+ while (rowSet1.next()) {
+ boolean isRowFound = false;
+
+ rowSet2.beforeFirst();
+ while (rowSet2.next()) {
+ int i = 1;
+ for (i = 1; i <= columnNum; i++) {
+ if (rowSet1.getObject(i) == null) {
+ if (rowSet2.getObject(i) != null) {
+ break;
+ }
+ } else if (!rowSet1.getObject(i).equals(
+ rowSet2.getObject(i))) {
+ break;
+ }
+ }
+
+ if (i == columnNum + 1) {
+ // A equal row has found
+ isRowFound = true;
+ break;
+ }
+ }
+
+ if (!isRowFound) {
+ return false;
+ }
+ }
+
+ // Since we have proved that for each row in rowSet1, we can find an
+ // equal row in rowSet2, so the data in these to rowSet2 are equal,
+ // ignoring order.
+ return true;
+ }
+
+
+
+ protected boolean dataEqualsIgnoreOrderAndNullInR2(RowSet rowSet1, RowSet rowSet2, int nullColumn)
+ throws SQLException {
+ // First decides if the column num are equal.
+ int columnNum = rowSet1.getMetaData().getColumnCount();
+ if (rowSet2.getMetaData().getColumnCount() != columnNum) {
+ return false;
+ }
+
+ // Then decides if the row num are equal.
+ rowSet1.beforeFirst();
+ rowSet2.beforeFirst();
+
+ int notNullRowNum = 0;
+
+ while (rowSet1.next()) {
+ notNullRowNum++;
+
+ }
+
+ while (rowSet2.next()) {
+ if (! "null".equals(rowSet2.getObject(nullColumn))) {
+ notNullRowNum--;
+ }
+ }
+ if (notNullRowNum != 0) {
+ return false;
+ }
+
+ // For each row in rowSet1, try to find an equal row in rowSet2.
+ // If not found, return false.
+ rowSet1.beforeFirst();
+
+ while (rowSet1.next()) {
+ boolean isRowFound = false;
+
+ rowSet2.beforeFirst();
+ while (rowSet2.next()) {
+ int i = 1;
+ for (i = 1; i <= columnNum; i++) {
+ if (rowSet1.getObject(i) == null) {
+ if (rowSet2.getObject(i) != null) {
+ break;
+ }
+ } else if (!rowSet1.getObject(i).equals(
+ rowSet2.getObject(i))) {
+ break;
+ }
+ }
+
+ if (i == columnNum + 1) {
+ // A equal row has found
+ isRowFound = true;
+ break;
+ }
+ }
+
+ if (!isRowFound) {
+ return false;
+ }
+ }
+
+ // Since we have proved that for each row in rowSet1, we can find an
+ // equal row in rowSet2, so the data in these to rowSet2 are equal,
+ // ignoring order.
+ return true;
+ }
+
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java Wed Apr 30 20:14:31 2008
@@ -29,6 +29,81 @@
protected WebRowSet another;
+ public void testCreateCopy() throws Exception {
+ webRs = newWebRowSet();
+ webRs.setUrl(DERBY_URL);
+ webRs.setCommand("SELECT * FROM USER_INFO WHERE ID = ?");
+ webRs.setInt(1, 3);
+ webRs.execute();
+
+ CachedRowSet copyWebRs = webRs.createCopy();
+ assertTrue(copyWebRs instanceof WebRowSet);
+ assertEquals("SELECT * FROM USER_INFO WHERE ID = ?", copyWebRs
+ .getCommand());
+ assertEquals(DERBY_URL, copyWebRs.getUrl());
+ }
+
+ public void testCreateCopy2() throws Exception {
+ webRs = newWebRowSet();
+ webRs.setUrl(DERBY_URL);
+ webRs.setCommand("SELECT * FROM USER_INFO WHERE ID = ? AND NAME = ?");
+ webRs.setInt(1, 3);
+ webRs.setString(2, "test3");
+ webRs.execute();
+ // check data
+ assertTrue(webRs.next());
+ assertEquals(3, webRs.getInt(1));
+ assertFalse(webRs.next());
+
+ // deep copy
+ CachedRowSet copyWebRs = webRs.createCopy();
+ copyWebRs.beforeFirst();
+ assertTrue(copyWebRs.next());
+ assertEquals(3, copyWebRs.getInt(1));
+ assertFalse(copyWebRs.next());
+ copyWebRs.execute();
+ assertTrue(copyWebRs.next());
+ assertEquals(3, copyWebRs.getInt(1));
+ assertFalse(copyWebRs.next());
+
+ webRs.setInt(1, 4);
+ webRs.setString(2, "test4");
+ webRs.execute();
+ webRs.beforeFirst();
+ assertTrue(webRs.next());
+ assertEquals(4, webRs.getInt(1));
+ assertFalse(webRs.next());
+
+ copyWebRs.beforeFirst();
+ assertTrue(copyWebRs.next());
+ assertEquals(3, copyWebRs.getInt(1));
+ assertFalse(copyWebRs.next());
+
+ copyWebRs.execute();
+ copyWebRs.beforeFirst();
+ assertTrue(copyWebRs.next());
+ assertEquals(3, copyWebRs.getInt(1));
+ assertFalse(copyWebRs.next());
+
+ copyWebRs.setInt(1, 1);
+ copyWebRs.setString(2, "hermit");
+ copyWebRs.execute();
+ assertTrue(copyWebRs.next());
+ assertEquals(1, copyWebRs.getInt(1));
+ assertFalse(copyWebRs.next());
+
+ webRs.beforeFirst();
+ assertTrue(webRs.next());
+ assertEquals(4, webRs.getInt(1));
+ assertFalse(webRs.next());
+
+ webRs.execute();
+ webRs.beforeFirst();
+ assertTrue(webRs.next());
+ assertEquals(4, webRs.getInt(1));
+ assertFalse(webRs.next());
+ }
+
public void testWriteAndRead() throws Exception {
rs = st.executeQuery("SELECT * FROM USER_INFO");
webRs = newWebRowSet();
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java Wed Apr 30 20:14:31 2008
@@ -19,7 +19,6 @@
import java.io.FileInputStream;
import java.io.FileReader;
-import java.io.FileWriter;
import java.io.Reader;
import java.io.StringWriter;
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=652421&r1=652420&r2=652421&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 30 20:14:31 2008
@@ -86,8 +86,7 @@
HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);
- assertNotNull(event.getCipherSuite());
- assertNull(ses.getCipherSuite());
+ assertEquals(event.getCipherSuite(), ses.getCipherSuite());
}
public final void testGetLocalCertificates() {