/** * @tests {@link javax.sql.RowSetEvent#RowSetEvent(javax.sql.RowSet)}. */ @TestTargetNew( level = TestLevel.SUFFICIENT, notes = "functional test missing but not feasible: no implementation available.", method = "RowSetEvent", args = {javax.sql.RowSet.class} ) public void testConstructor() { try { new RowSetEvent(null); fail("illegal argument exception expected"); } catch (IllegalArgumentException e) { } Impl_RowSet irs = new Impl_RowSet(); RowSetEvent rse = new RowSetEvent(irs); assertSame(irs, rse.getSource()); }
public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { if (numRows <= 0) { // sql.42=Illegal Argument throw new SQLException(Messages.getString("sql.42")); //$NON-NLS-1$ } if (numRows < getFetchSize()) { // rowset.22=Number of rows is less than fetch size throw new SQLException(Messages.getString("rowset.22")); //$NON-NLS-1$ } if (size() == 0 || size() % numRows == 0) { if (isNotifyListener) { notifyRowSetChanged(); } } }
public void testRowSetPopulated_Three() throws Exception { noInitialCrset = newNoInitialInstance(); Listener listener = new Listener(); noInitialCrset.addRowSetListener(listener); noInitialCrset.setMaxRows(10); noInitialCrset.setFetchSize(4); try { noInitialCrset.rowSetPopulated(new RowSetEvent(crset), 3); fail("should throw SQLException"); } catch (SQLException e) { // expected } listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(crset), 4); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); for (int i = 5; i <= 30; i++) { listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(crset), i); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); } }
public void rowChanged(RowSetEvent event) { try { int row = rowSet.getRow(); if (rowSet.rowDeleted()) { fireTableRowsDeleted(row, row); } else if (rowSet.rowInserted()) { fireTableRowsInserted(row, row); } else if (rowSet.rowUpdated()) { fireTableRowsUpdated(row, row); } } catch (SQLException e) { } }
/** * Test method for {@link javax.sql.RowSetListener#cursorMoved(javax.sql.RowSetEvent)}. */ @TestTargetNew( level = TestLevel.NOT_FEASIBLE, notes = "", method = "cursorMoved", args = {javax.sql.RowSetEvent.class} ) public void testCursorMoved() { fail("Not yet implemented"); }
/** * Test method for {@link javax.sql.RowSetListener#rowChanged(javax.sql.RowSetEvent)}. */ @TestTargetNew( level = TestLevel.NOT_FEASIBLE, notes = "", method = "rowChanged", args = {javax.sql.RowSetEvent.class} ) public void testRowChanged() { fail("Not yet implemented"); }
/** * Test method for {@link javax.sql.RowSetListener#rowSetChanged(javax.sql.RowSetEvent)}. */ @TestTargetNew( level = TestLevel.NOT_FEASIBLE, notes = "", method = "rowSetChanged", args = {javax.sql.RowSetEvent.class} ) public void testRowSetChanged() { fail("Not yet implemented"); }
protected void notifyCursorMoved() throws SQLException { if (!(this instanceof RowSet)) { throw new SQLException(); } if (listeners.isEmpty()) { return; } for (RowSetListener listener : listeners) { listener.cursorMoved(new RowSetEvent((RowSet) this)); } }
protected void notifyRowChanged() throws SQLException { if (!(this instanceof RowSet)) { throw new SQLException(); } if (listeners.isEmpty()) { return; } for (RowSetListener listener : listeners) { listener.rowChanged(new RowSetEvent((RowSet) this)); } }
protected void notifyRowSetChanged() throws SQLException { if (!(this instanceof RowSet)) { throw new SQLException(); } if (listeners.isEmpty()) { return; } for (RowSetListener listener : listeners) { listener.rowSetChanged(new RowSetEvent((RowSet) this)); } }
public void testConstructor() { try { new RowSetEvent(null); fail("illegal argument exception expected"); } catch (IllegalArgumentException e) { } Impl_RowSet irs = new Impl_RowSet(); RowSetEvent rse = new RowSetEvent(irs); assertSame(irs, rse.getSource()); }
public void testRowSetPopulated_One() throws Exception { /* * There are 24 rows in database. */ insertMoreData(20); noInitialCrset = newNoInitialInstance(); Listener listener = new Listener(); noInitialCrset.addRowSetListener(listener); assertEquals(0, noInitialCrset.getFetchSize()); noInitialCrset.setMaxRows(10); noInitialCrset.setFetchSize(3); rs = st.executeQuery("SELECT * FROM USER_INFO"); noInitialCrset.populate(rs); listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(noInitialCrset), 3); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(noInitialCrset), 4); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(noInitialCrset), 6); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(noInitialCrset), 8); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(noInitialCrset), 12); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); listener.clear(); noInitialCrset.rowSetPopulated(new RowSetEvent(noInitialCrset), 24); assertEquals(EVENT_ROWSET_CHANGED, listener.getTag()); }
public void rowSetChanged(RowSetEvent theEvent) { if (isPrint) { System.out.println("rowSetChanged"); } tag = CachedRowSetListenerTest.EVENT_ROWSET_CHANGED; eventSource = theEvent.getSource(); }
@Override public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public void rowSetChanged(RowSetEvent event) { flag |= ROWSET_CHANGED; }
@Override public void rowChanged(RowSetEvent event) { flag |= ROW_CHANGED; }
@Override public void cursorMoved(RowSetEvent event) { flag |= CURSOR_MOVED; }