summaryrefslogtreecommitdiff
path: root/dbaccess/qa/complex/dbaccess/RowSet.java
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-08-26 10:09:17 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-08-26 10:09:17 +0000
commit89ca2412500ba32d18c94dee9630f6df8d74ced2 (patch)
treed40909ad7737babfcb9acca178902593ed830f2a /dbaccess/qa/complex/dbaccess/RowSet.java
parentb7002f10a38c89573bc2a0b260762df9a4642277 (diff)
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected 2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte 2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name 2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard 2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus 2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up 2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up 2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct 2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0 2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected 2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string 2009-07-20 11:40:39 +0200 fs r274117 : removed unused include 2009-07-20 11:40:01 +0200 fs r274116 : class name corrected 2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path 2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst 2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar 2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well 2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths 2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality 2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52) 2009-07-01 21:41:50 +0200 fs r273614 : #i10000# 2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents 2009-07-01 12:10:31 +0200 fs r273562 : updated 2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names 2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays 2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder 2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb 2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d 2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions 2009-06-29 10:01:13 +0200 fs r273453 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays 2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899# 2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes 2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes 2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log 2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts 2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string 2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime 2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata 2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge 2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved 2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set 2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge 2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge 2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing 2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d 2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries? 2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed 2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix 2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section 2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox 2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop 2009-06-19 13:18:26 +0200 oj r273157 : remove unused param 2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50) 2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e 2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e 2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e 2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50 2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text 2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any 2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid 2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ... 2009-06-10 09:53:20 +0200 oj r272797 : add lic text 2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618 2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed 2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property 2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases 2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases 2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases 2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid 2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing 2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType 2009-06-08 13:51:20 +0200 oj r272730 : add tests 2009-06-05 14:38:01 +0200 oj r272686 : add dep 2009-06-05 14:35:00 +0200 oj r272684 : add new tests 2009-06-05 13:41:18 +0200 oj r272681 : code clean ups 2009-06-05 12:40:51 +0200 oj r272678 : code cleanup 2009-06-05 12:02:57 +0200 oj r272677 : code cleanup 2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML 2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard 2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
Diffstat (limited to 'dbaccess/qa/complex/dbaccess/RowSet.java')
-rw-r--r--dbaccess/qa/complex/dbaccess/RowSet.java846
1 files changed, 463 insertions, 383 deletions
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index 8e0161187c3e..d9145d7aaee8 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -29,102 +29,128 @@
************************************************************************/
package complex.dbaccess;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexAccess;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.beans.*;
-import com.sun.star.lang.*;
-import com.sun.star.sdbcx.*;
-import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdb.XParametersSupplier;
+import com.sun.star.sdb.XResultSetAccess;
+import com.sun.star.sdb.XRowSetApproveBroadcaster;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XParameters;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetUpdate;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbc.XRowSet;
+import com.sun.star.sdbc.XRowUpdate;
+import com.sun.star.sdbcx.XColumnsSupplier;
+import com.sun.star.sdbcx.XDeleteRows;
+import com.sun.star.sdbcx.XRowLocate;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XRefreshable;
-import connectivity.tools.HsqlDatabase;
-
import complexlib.ComplexTestCase;
-import complexlib.Assurance.AssureException;
-
+import connectivity.tools.DataSource;
+import connectivity.tools.HsqlDatabase;
+import java.lang.reflect.Method;
+import java.util.Random;
-public class RowSet extends ComplexTestCase {
+public class RowSet extends ComplexTestCase
+{
static final int MAX_TABLE_ROWS = 100;
static final int MAX_FETCH_ROWS = 10;
-
- HsqlDatabase m_database;
- connectivity.tools.DataSource
- m_dataSource;
- XRowSet m_rowSet;
- XResultSet m_resultSet;
- XResultSetUpdate m_resultSetUpdate;
- XRow m_row;
- XRowLocate m_rowLocate;
- XPropertySet m_rowSetProperties;
+ private static final String NEXT = "next";
+ private static final String TEST21 = "Test21";
+ HsqlDatabase m_database;
+ DataSource m_dataSource;
+ XRowSet m_rowSet;
+ XResultSet m_resultSet;
+ XResultSetUpdate m_resultSetUpdate;
+ XRow m_row;
+ XRowLocate m_rowLocate;
+ XPropertySet m_rowSetProperties;
XParametersSupplier m_paramsSupplier;
// --------------------------------------------------------------------------------------------------------
class ResultSetMovementStress implements Runnable
{
- XResultSet m_resultSet;
- XRow m_row;
- int m_id;
- public ResultSetMovementStress(XResultSet _resultSet,int _id) throws java.lang.Exception {
+
+ XResultSet m_resultSet;
+ XRow m_row;
+ int m_id;
+
+ public ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception
+ {
m_resultSet = _resultSet;
- m_row = (XRow)UnoRuntime.queryInterface(XRow.class,m_resultSet);
+ m_row = (XRow) UnoRuntime.queryInterface(XRow.class, m_resultSet);
m_id = _id;
}
+
public void run()
{
try
{
m_resultSet.beforeFirst();
- for ( int i = 0; m_resultSet.next(); ++i )
+ for (int i = 0; m_resultSet.next(); ++i)
{
int pos = m_resultSet.getRow();
- int val = m_row.getInt(1);
+ // final int val = m_row.getInt(1);
// log.println("Clone Move(" + m_id +") before i: " + (i+1) + " Pos: " + pos + " Val: " + val);
- testPosition( m_resultSet, m_row, i + 1, "clone move(" + m_id +")" );
+ testPosition(m_resultSet, m_row, i + 1, "clone move(" + m_id + ")");
// val = m_row.getInt(1);
// log.println("Clone Move(" + m_id +") after i: " + (i+1) + " Pos: " + pos + " Val: " + val);
int pos2 = m_resultSet.getRow();
- assure("ResultSetMovementStress wrong position: " + i + " Pos1: " + pos + " Pos2: " + pos2,pos == pos2);
+ assure("ResultSetMovementStress wrong position: " + i + " Pos1: " + pos + " Pos2: " + pos2, pos == pos2);
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("ResultSetMovementStress(" + m_id + ") failed: " + e,false);
+ }
+ catch (Exception e)
+ {
+ assure("ResultSetMovementStress(" + m_id + ") failed: " + e, false);
}
}
}
// --------------------------------------------------------------------------------------------------------
- public String[] getTestMethodNames() {
+
+ public String[] getTestMethodNames()
+ {
return new String[]
- {
- "testRowSet",
- "testRowSetEvents",
- "testDeleteBehavior",
- "testCloneMovesPlusDeletions",
- "testCloneMovesPlusInsertions",
- "testParameters"
- };
+ {
+ "testRowSet",
+ "testRowSetEvents",
+ "testDeleteBehavior",
+ "testCloneMovesPlusDeletions",
+ "testCloneMovesPlusInsertions",
+ "testParameters"
+ };
}
// --------------------------------------------------------------------------------------------------------
- public String getTestObjectName() {
+ public String getTestObjectName()
+ {
return "RowSet";
}
// --------------------------------------------------------------------------------------------------------
- private void createTestCase( boolean _defaultRowSet )
+ private void createTestCase(boolean _defaultRowSet)
{
- if ( m_database == null )
+ if (m_database == null)
{
try
{
- CRMDatabase database = new CRMDatabase( getFactory() );
+ final CRMDatabase database = new CRMDatabase(getFactory());
m_database = database.getDatabase();
m_dataSource = m_database.getDataSource();
}
- catch(Exception e)
+ catch (Exception e)
{
- assure( "could not create the embedded HSQL database: " + e.getMessage(), false );
+ assure("could not create the embedded HSQL database: " + e.getMessage(), false);
}
}
@@ -132,20 +158,21 @@ public class RowSet extends ComplexTestCase {
{
createStruture();
}
- catch( SQLException e )
+ catch (SQLException e)
{
- assure( "could not connect to the database/table structure, error message:\n" + e.getMessage(), false );
+ assure("could not connect to the database/table structure, error message:\n" + e.getMessage(), false);
}
- if ( _defaultRowSet )
- createRowSet( "TEST1", CommandType.TABLE, true, true );
+ if (_defaultRowSet)
+ {
+ createRowSet("TEST1", CommandType.TABLE, true, true);
+ }
}
-
// --------------------------------------------------------------------------------------------------------
private XMultiServiceFactory getFactory()
{
- return (XMultiServiceFactory)param.getMSF();
+ return (XMultiServiceFactory) param.getMSF();
}
// --------------------------------------------------------------------------------------------------------
@@ -157,9 +184,9 @@ public class RowSet extends ComplexTestCase {
* @param execute
* determines whether the RowSet should be executed
*/
- private void createRowSet( String command, int commandType, boolean execute )
+ private void createRowSet(String command, int commandType, boolean execute)
{
- createRowSet( command, commandType, execute, false );
+ createRowSet(command, commandType, execute, false);
}
// --------------------------------------------------------------------------------------------------------
@@ -173,50 +200,55 @@ public class RowSet extends ComplexTestCase {
* @param execute
* determines whether the RowSet should be executed
*/
- private void createRowSet( String command, int commandType, boolean execute, boolean limitFetchSize )
+ private void createRowSet(String command, int commandType, boolean execute, boolean limitFetchSize)
{
try
{
- m_rowSet = (XRowSet)UnoRuntime.queryInterface(XRowSet.class,
- getFactory().createInstance("com.sun.star.sdb.RowSet"));
- XPropertySet rowSetProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_rowSet );
- rowSetProperties.setPropertyValue( "Command", command );
- rowSetProperties.setPropertyValue( "CommandType", new Integer( commandType ) );
- rowSetProperties.setPropertyValue( "ActiveConnection",m_database.defaultConnection() );
- if ( limitFetchSize )
- rowSetProperties.setPropertyValue( "FetchSize", new Integer( MAX_FETCH_ROWS ) );
-
- m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_rowSet );
- m_resultSetUpdate = (XResultSetUpdate)UnoRuntime.queryInterface( XResultSetUpdate.class, m_rowSet );
- m_row = (XRow)UnoRuntime.queryInterface( XRow.class, m_rowSet );
- m_rowLocate = (XRowLocate)UnoRuntime.queryInterface( XRowLocate.class, m_resultSet );
- m_rowSetProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_rowSet );
- m_paramsSupplier = (XParametersSupplier)UnoRuntime.queryInterface( XParametersSupplier.class, m_rowSet );
-
- if ( execute )
+ m_rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
+ getFactory().createInstance("com.sun.star.sdb.RowSet"));
+ final XPropertySet rowSetProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_rowSet);
+ rowSetProperties.setPropertyValue("Command", command);
+ rowSetProperties.setPropertyValue("CommandType", Integer.valueOf(commandType));
+ rowSetProperties.setPropertyValue("ActiveConnection", m_database.defaultConnection());
+ if (limitFetchSize)
+ {
+ rowSetProperties.setPropertyValue("FetchSize", Integer.valueOf(MAX_FETCH_ROWS));
+ }
+
+ m_resultSet = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, m_rowSet);
+ m_resultSetUpdate = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_rowSet);
+ m_row = (XRow) UnoRuntime.queryInterface(XRow.class, m_rowSet);
+ m_rowLocate = (XRowLocate) UnoRuntime.queryInterface(XRowLocate.class, m_resultSet);
+ m_rowSetProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_rowSet);
+ m_paramsSupplier = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, m_rowSet);
+
+ if (execute)
+ {
m_rowSet.execute();
+ }
}
- catch ( java.lang.Exception e )
+ catch (Exception e)
{
- assure( "caught an exception while creating the RowSet. Type:\n" + e.getClass().toString() + "\nMessage:\n" + e.getMessage(), false );
+ assure("caught an exception while creating the RowSet. Type:\n" + e.getClass().toString() + "\nMessage:\n" + e.getMessage(), false);
}
}
// --------------------------------------------------------------------------------------------------------
- public void testRowSet() throws java.lang.Exception {
+ public void testRowSet() throws java.lang.Exception
+ {
log.println("testing testRowSet");
- createTestCase( true );
+ createTestCase(true);
// sequential postioning
m_resultSet.beforeFirst();
- testSequentialPositining(m_resultSet,m_row);
+ testSequentialPositining(m_resultSet, m_row);
// absolute positioning
- testAbsolutePositioning(m_resultSet,m_row);
+ testAbsolutePositioning(m_resultSet, m_row);
// 3rd test
- test3(createClone(),m_resultSet);
+ test3(createClone(), m_resultSet);
// 4th test
test4(m_resultSet);
@@ -227,201 +259,213 @@ public class RowSet extends ComplexTestCase {
// --------------------------------------------------------------------------------------------------------
XResultSet createClone() throws SQLException
{
- XResultSetAccess rowAcc = (XResultSetAccess)UnoRuntime.queryInterface( XResultSetAccess.class, m_rowSet );
+ final XResultSetAccess rowAcc = (XResultSetAccess) UnoRuntime.queryInterface(XResultSetAccess.class, m_rowSet);
return rowAcc.createResultSet();
}
// --------------------------------------------------------------------------------------------------------
void createStruture() throws SQLException
{
- m_database.executeSQL( "DROP TABLE \"TEST1\" IF EXISTS" );
- m_database.executeSQL( "CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )" );
-
- XConnection connection = m_database.defaultConnection();
- XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
- XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,prep);
- for(int i=1 ; i <= MAX_TABLE_ROWS ; ++i){
- para.setInt(1, i );
+ m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS");
+ m_database.executeSQL("CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )");
+
+ final XConnection connection = m_database.defaultConnection();
+ final XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
+ final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, prep);
+ for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
+ {
+ para.setInt(1, i);
para.setString(2, "Test" + i);
prep.executeUpdate();
}
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class, connection );
- XRefreshable refresh = (XRefreshable)UnoRuntime.queryInterface( XRefreshable.class, suppTables.getTables() );
+ final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
+ final XRefreshable refresh = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, suppTables.getTables());
refresh.refresh();
}
// --------------------------------------------------------------------------------------------------------
- void testPosition(XResultSet m_resultSet,XRow m_row,int expectedValue,String location) throws SQLException
+ void testPosition(XResultSet m_resultSet, XRow m_row, int expectedValue, String location) throws SQLException
{
- int val = m_row.getInt(1);
- int pos = m_resultSet.getRow();
- assure( location + ": value/position do not match: " + pos + " (pos) != " + val + " (val)", val == pos );
- assure( location + ": value/position are not as expected: " + val + " (val) != " + expectedValue + " (expected)", val == expectedValue );
+ final int val = m_row.getInt(1);
+ final int pos = m_resultSet.getRow();
+ assure(location + ": value/position do not match: " + pos + " (pos) != " + val + " (val)", val == pos);
+ assure(location + ": value/position are not as expected: " + val + " (val) != " + expectedValue + " (expected)", val == expectedValue);
}
// --------------------------------------------------------------------------------------------------------
- void testSequentialPositining(XResultSet _resultSet,XRow _row)
+ void testSequentialPositining(XResultSet _resultSet, XRow _row)
{
try
{
// 1st test
- int i=1;
- while(_resultSet.next())
+ int i = 1;
+ while (_resultSet.next())
{
- testPosition( _resultSet, _row, i, "testSequentialPositining" );
+ testPosition(_resultSet, _row, i, "testSequentialPositining");
++i;
}
}
- catch(AssureException e)
- {
- }
- catch(Exception e)
+ catch (Exception e)
{
- assure("testSequentialPositining failed: " + e,false);
+ assure("testSequentialPositining failed: " + e, false);
}
}
// --------------------------------------------------------------------------------------------------------
- void testAbsolutePositioning(XResultSet _resultSet,XRow _row){
- try{
- for(int i = 1 ; i <= MAX_FETCH_ROWS ; ++i){
- int calcPos = (MAX_TABLE_ROWS % i) + 1;
- assure( "testAbsolutePositioning failed", _resultSet.absolute(calcPos) );
- testPosition( _resultSet, _row, calcPos, "testAbsolutePositioning" );
+ void testAbsolutePositioning(XResultSet _resultSet, XRow _row)
+ {
+ try
+ {
+ for (int i = 1; i <= MAX_FETCH_ROWS; ++i)
+ {
+ final int calcPos = (MAX_TABLE_ROWS % i) + 1;
+ assure("testAbsolutePositioning failed", _resultSet.absolute(calcPos));
+ testPosition(_resultSet, _row, calcPos, "testAbsolutePositioning");
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("testAbsolutePositioning failed: " + e,false);
- }
+ }
+ catch (Exception e)
+ {
+ assure("testAbsolutePositioning failed: " + e, false);
+ }
}
// --------------------------------------------------------------------------------------------------------
- void test3(XResultSet clone,XResultSet _resultSet){
- try{
- XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
- XRow cloneRow = (XRow)UnoRuntime.queryInterface(XRow.class,clone);
- for(int i = 1 ; i <= MAX_FETCH_ROWS ; ++i){
- int calcPos = (MAX_TABLE_ROWS % i) + 1;
- if ( clone.absolute(calcPos) )
+ void test3(XResultSet clone, XResultSet _resultSet)
+ {
+ try
+ {
+ final XRow _row = (XRow) UnoRuntime.queryInterface(XRow.class, _resultSet);
+ final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ for (int i = 1; i <= MAX_FETCH_ROWS; ++i)
+ {
+ final int calcPos = (MAX_TABLE_ROWS % i) + 1;
+ if (clone.absolute(calcPos))
{
- testPosition( clone, cloneRow, calcPos, "test3" );
- testAbsolutePositioning(_resultSet,_row);
- testAbsolutePositioning(clone,cloneRow);
+ testPosition(clone, cloneRow, calcPos, "test3");
+ testAbsolutePositioning(_resultSet, _row);
+ testAbsolutePositioning(clone, cloneRow);
}
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("test3 failed: " + e,false);
- }
+ }
+ catch (Exception e)
+ {
+ assure("test3 failed: " + e, false);
+ }
}
// --------------------------------------------------------------------------------------------------------
- void test4(XResultSet _resultSet){
- try{
- XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
+ void test4(XResultSet _resultSet)
+ {
+ try
+ {
+ final XRow _row = (XRow) UnoRuntime.queryInterface(XRow.class, _resultSet);
_resultSet.beforeFirst();
- for(int i = 1 ; i <= MAX_TABLE_ROWS ; ++i){
+ for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
+ {
_resultSet.next();
- XResultSet clone = createClone();
- XRow cloneRow = (XRow)UnoRuntime.queryInterface(XRow.class,clone);
- int calcPos = MAX_TABLE_ROWS - 1;
- if ( calcPos != 0 && clone.absolute(calcPos) )
+ final XResultSet clone = createClone();
+ final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ final int calcPos = MAX_TABLE_ROWS - 1;
+ if (calcPos != 0 && clone.absolute(calcPos))
{
- testPosition( clone, cloneRow, calcPos, "test4: clone" );
- testPosition( _resultSet, _row, i, "test4: rowset" );
+ testPosition(clone, cloneRow, calcPos, "test4: clone");
+ testPosition(_resultSet, _row, i, "test4: rowset");
}
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("test4 failed: " + e,false);
- }
+ }
+ catch (Exception e)
+ {
+ assure("test4 failed: " + e, false);
+ }
}
// --------------------------------------------------------------------------------------------------------
- void testConcurrentAccess(XResultSet _resultSet)
- {
+ void testConcurrentAccess(XResultSet _resultSet)
+ {
log.println("testing Thread");
try
{
- XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
+ // final XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
_resultSet.beforeFirst();
final int numberOfThreads = 10;
- Thread threads[] = new Thread[numberOfThreads];
- for ( int i=0; i<numberOfThreads; ++i )
+ final Thread threads[] = new Thread[numberOfThreads];
+ for (int i = 0; i < numberOfThreads; ++i)
{
- threads[i] = new Thread( new ResultSetMovementStress( createClone(), i ) );
- System.out.println( "starting thread " + String.valueOf(i+1) + " of " + String.valueOf( numberOfThreads ) );
+ threads[i] = new Thread(new ResultSetMovementStress(createClone(), i));
+ log.println("starting thread " + (i + 1) + " of " + (numberOfThreads));
threads[i].start();
}
- for ( int i=0; i<numberOfThreads; ++i )
+ for (int i = 0; i < numberOfThreads; ++i)
+ {
threads[i].join();
+ }
}
- catch(AssureException e)
- {
- }
- catch(Exception e)
+ catch (Exception e)
{
- e.printStackTrace();
- assure("testConcurrentAccess failed: " + e,false);
+ assure("testConcurrentAccess failed: " + e, false);
}
}
// --------------------------------------------------------------------------------------------------------
- public void testRowSetEvents() throws java.lang.Exception {
+
+ public void testRowSetEvents() throws java.lang.Exception
+ {
log.println("testing RowSet Events");
- createTestCase( true );
+ createTestCase(true);
// first we create our RowSet object
- RowSetEventListener pRow = new RowSetEventListener(this);
+ final RowSetEventListener pRow = new RowSetEventListener();
- XColumnsSupplier colSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class,m_rowSet);
- XPropertySet col = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,colSup.getColumns().getByName("ID"));
+ final XColumnsSupplier colSup = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, m_rowSet);
+ final XPropertySet col = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, colSup.getColumns().getByName("ID"));
col.addPropertyChangeListener("Value", pRow);
m_rowSetProperties.addPropertyChangeListener("IsModified", pRow);
m_rowSetProperties.addPropertyChangeListener("IsNew", pRow);
m_rowSetProperties.addPropertyChangeListener("IsRowCountFinal", pRow);
m_rowSetProperties.addPropertyChangeListener("RowCount", pRow);
- XRowSetApproveBroadcaster xApBroad = (XRowSetApproveBroadcaster)UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class,m_resultSet);
+ final XRowSetApproveBroadcaster xApBroad = (XRowSetApproveBroadcaster) UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class, m_resultSet);
xApBroad.addRowSetApproveListener(pRow);
m_rowSet.addRowSetListener(pRow);
// do some movements to check if we got all notifications
- Class cResSet = java.lang.Class.forName("com.sun.star.sdbc.XResultSet");
- boolean moves[] = new boolean[9];
- for( int i = 0; i < moves.length; ++i)
+ final Class cResSet = Class.forName("com.sun.star.sdbc.XResultSet");
+ final boolean moves[] = new boolean[9];
+ for (int i = 0; i < moves.length; ++i)
+ {
moves[i] = false;
+ }
moves[RowSetEventListener.APPROVE_CURSOR_MOVE] = true;
moves[RowSetEventListener.COLUMN_VALUE] = true;
moves[RowSetEventListener.CURSOR_MOVED] = true;
moves[RowSetEventListener.IS_ROW_COUNT_FINAL] = true;
moves[RowSetEventListener.ROW_COUNT] = true;
- testCursorMove(m_resultSet,cResSet.getMethod("afterLast",(Class[])null),pRow,moves,null);
+ testCursorMove(m_resultSet, cResSet.getMethod("afterLast", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_ROW_COUNT_FINAL] = false;
moves[RowSetEventListener.ROW_COUNT] = false;
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("last",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("first",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("previous",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod("last", (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod("first", (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod("previous", (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = true;
- XRowUpdate updRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,m_resultSet);
- updRow.updateString(2,"Test21");
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
+ final XRowUpdate updRow = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
+ updRow.updateString(2, TEST21);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = false;
- Class cupd = java.lang.Class.forName("com.sun.star.sdbc.XResultSetUpdate");
- XResultSetUpdate upd = (XResultSetUpdate)UnoRuntime.queryInterface(XResultSetUpdate.class,m_resultSet);
- testCursorMove(upd,cupd.getMethod("moveToInsertRow",(Class[])null),pRow,moves,null);
+ final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
+ final XResultSetUpdate upd = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_resultSet);
+ testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);
updRow.updateInt(1, MAX_TABLE_ROWS + 2);
updRow.updateString(2, "HHHH");
@@ -432,108 +476,110 @@ public class RowSet extends ComplexTestCase {
moves[RowSetEventListener.ROW_COUNT] = true;
moves[RowSetEventListener.APPROVE_ROW_CHANGE] = true;
moves[RowSetEventListener.ROW_CHANGED] = true;
- testCursorMove(upd,cupd.getMethod("insertRow",(Class[])null),pRow,moves,null);
+ testCursorMove(upd, cupd.getMethod("insertRow", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_NEW] = false;
moves[RowSetEventListener.ROW_COUNT] = false;
m_resultSet.first();
updRow.updateInt(1, MAX_TABLE_ROWS + 3);
updRow.updateString(2, "__");
- testCursorMove(upd,cupd.getMethod("updateRow",(Class[])null),pRow,moves,null);
+ testCursorMove(upd, cupd.getMethod("updateRow", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_NEW] = true;
moves[RowSetEventListener.ROW_COUNT] = true;
m_resultSet.first();
- testCursorMove(upd,cupd.getMethod("deleteRow",(Class[])null),pRow,moves,null);
+ testCursorMove(upd, cupd.getMethod("deleteRow", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_NEW] = false;
moves[RowSetEventListener.COLUMN_VALUE] = true;
moves[RowSetEventListener.ROW_COUNT] = false;
m_resultSet.first();
- updRow.updateString(2,"Test21");
- testCursorMove(m_resultSet,cResSet.getMethod("refreshRow",(Class[])null),pRow,moves,null);
+ updRow.updateString(2, TEST21);
+ testCursorMove(m_resultSet, cResSet.getMethod("refreshRow", (Class[]) null), pRow, moves, null);
m_resultSet.first();
- updRow.updateString(2,"Test21");
- testCursorMove(upd,cupd.getMethod("cancelRowUpdates",(Class[])null),pRow,moves,null);
+ updRow.updateString(2, TEST21);
+ testCursorMove(upd, cupd.getMethod("cancelRowUpdates", (Class[]) null), pRow, moves, null);
- for( int i = 0; i < moves.length; ++i)
+ for (int i = 0; i < moves.length; ++i)
+ {
moves[i] = false;
+ }
moves[RowSetEventListener.APPROVE_CURSOR_MOVE] = true;
moves[RowSetEventListener.COLUMN_VALUE] = true;
moves[RowSetEventListener.CURSOR_MOVED] = true;
- Class cloc = java.lang.Class.forName("com.sun.star.sdbcx.XRowLocate");
+ final Class cloc = Class.forName("com.sun.star.sdbcx.XRowLocate");
m_resultSet.first();
- Object bookmark = m_rowLocate.getBookmark();
+ final Object bookmark = m_rowLocate.getBookmark();
m_resultSet.next();
- Object temp[] = new Object[1];
+ final Object temp[] = new Object[1];
temp[0] = bookmark;
Class ctemp[] = new Class[1];
ctemp[0] = Object.class;
- testCursorMove(m_rowLocate,cloc.getMethod("moveToBookmark",ctemp),pRow,moves,temp);
+ testCursorMove(m_rowLocate, cloc.getMethod("moveToBookmark", ctemp), pRow, moves, temp);
- Object temp2[] = new Object[2];
+ final Object temp2[] = new Object[2];
temp2[0] = bookmark;
- temp2[1] = new Integer(1);
- Class ctemp2[] = new Class[2];
+ temp2[1] = Integer.valueOf(1);
+ final Class ctemp2[] = new Class[2];
ctemp2[0] = Object.class;
ctemp2[1] = int.class;
- testCursorMove(m_rowLocate,cloc.getMethod("moveRelativeToBookmark",ctemp2),pRow,moves,temp2);
+ testCursorMove(m_rowLocate, cloc.getMethod("moveRelativeToBookmark", ctemp2), pRow, moves, temp2);
- for( int i = 0; i < moves.length; ++i)
+ for (int i = 0; i < moves.length; ++i)
+ {
moves[i] = false;
+ }
moves[RowSetEventListener.APPROVE_ROW_CHANGE] = true;
moves[RowSetEventListener.ROW_CHANGED] = true;
moves[RowSetEventListener.ROW_COUNT] = true;
- Class cdelRows = java.lang.Class.forName("com.sun.star.sdbcx.XDeleteRows");
+ final Class cdelRows = Class.forName("com.sun.star.sdbcx.XDeleteRows");
ctemp[0] = Object[].class;
- XDeleteRows delRows = (XDeleteRows)UnoRuntime.queryInterface(XDeleteRows.class,m_resultSet);
- Object bookmarks[] = new Object[5];
+ final XDeleteRows delRows = (XDeleteRows) UnoRuntime.queryInterface(XDeleteRows.class, m_resultSet);
+ final Object bookmarks[] = new Object[5];
m_resultSet.first();
- for ( int i = 0; i < bookmarks.length ; ++i ){
+ for (int i = 0; i < bookmarks.length; ++i)
+ {
m_resultSet.next();
bookmarks[i] = m_rowLocate.getBookmark();
}
temp[0] = bookmarks;
- testCursorMove(delRows,cdelRows.getMethod("deleteRows",ctemp),pRow,moves,temp);
+ testCursorMove(delRows, cdelRows.getMethod("deleteRows", ctemp), pRow, moves, temp);
// now destroy the RowSet
- XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,m_resultSet);
+ final XComponent xComp = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_resultSet);
xComp.dispose();
}
// --------------------------------------------------------------------------------------------------------
- private void testCursorMove(Object res
- ,java.lang.reflect.Method _method
- , RowSetEventListener _evt
- , boolean _must[]
- , Object args[]) throws java.lang.Exception {
+ private void testCursorMove(Object res, Method _method, RowSetEventListener _evt, boolean _must[], Object args[]) throws java.lang.Exception
+ {
_evt.clearCalling();
- _method.invoke(res,args);
+ _method.invoke(res, args);
log.println("testing events for " + _method.getName());
- int calling[] = _evt.getCalling();
+ final int calling[] = _evt.getCalling();
int pos = 1;
- assure("Callings are not in the correct order for APPROVE_CURSOR_MOVE " ,
- ( !_must[RowSetEventListener.APPROVE_CURSOR_MOVE] || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == -1) || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == pos++ );
- assure("Callings are not in the correct order for APPROVE_ROW_CHANGE" ,
- ( !_must[ RowSetEventListener.APPROVE_ROW_CHANGE] || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == -1) || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == pos++);
- assure("Callings are not in the correct order for COLUMN_VALUE" ,
- ( !_must[RowSetEventListener.COLUMN_VALUE] || calling[RowSetEventListener.COLUMN_VALUE] == -1) || calling[RowSetEventListener.COLUMN_VALUE] == pos++);
- assure("Callings are not in the correct order for CURSOR_MOVED" ,
- ( !_must[RowSetEventListener.CURSOR_MOVED] || calling[RowSetEventListener.CURSOR_MOVED] == -1) || calling[RowSetEventListener.CURSOR_MOVED] == pos++);
- assure("Callings are not in the correct order for ROW_CHANGED" ,
- ( !_must[ RowSetEventListener.ROW_CHANGED] || calling[RowSetEventListener.ROW_CHANGED] == -1) || calling[RowSetEventListener.ROW_CHANGED] == pos++);
- assure("Callings are not in the correct order for IS_MODIFIED" ,
- ( !_must[ RowSetEventListener.IS_MODIFIED] || calling[RowSetEventListener.IS_MODIFIED] == -1) || calling[RowSetEventListener.IS_MODIFIED] == pos++);
- assure("Callings are not in the correct order for IS_NEW" ,
- ( !_must[ RowSetEventListener.IS_NEW] || calling[RowSetEventListener.IS_NEW] == -1) || calling[RowSetEventListener.IS_NEW] == pos++);
- assure("Callings are not in the correct order for ROW_COUNT" ,
- ( !_must[ RowSetEventListener.ROW_COUNT] || calling[RowSetEventListener.ROW_COUNT] == -1) || calling[RowSetEventListener.ROW_COUNT] == pos++);
- assure("Callings are not in the correct order for IS_ROW_COUNT_FINAL" ,
- ( !_must[ RowSetEventListener.IS_ROW_COUNT_FINAL] || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == -1) || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == pos++);
+ assure("Callings are not in the correct order for APPROVE_CURSOR_MOVE ",
+ (!_must[RowSetEventListener.APPROVE_CURSOR_MOVE] || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == -1) || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == pos++);
+ assure("Callings are not in the correct order for APPROVE_ROW_CHANGE",
+ (!_must[RowSetEventListener.APPROVE_ROW_CHANGE] || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == -1) || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == pos++);
+ assure("Callings are not in the correct order for COLUMN_VALUE",
+ (!_must[RowSetEventListener.COLUMN_VALUE] || calling[RowSetEventListener.COLUMN_VALUE] == -1) || calling[RowSetEventListener.COLUMN_VALUE] == pos++);
+ assure("Callings are not in the correct order for CURSOR_MOVED",
+ (!_must[RowSetEventListener.CURSOR_MOVED] || calling[RowSetEventListener.CURSOR_MOVED] == -1) || calling[RowSetEventListener.CURSOR_MOVED] == pos++);
+ assure("Callings are not in the correct order for ROW_CHANGED",
+ (!_must[RowSetEventListener.ROW_CHANGED] || calling[RowSetEventListener.ROW_CHANGED] == -1) || calling[RowSetEventListener.ROW_CHANGED] == pos++);
+ assure("Callings are not in the correct order for IS_MODIFIED",
+ (!_must[RowSetEventListener.IS_MODIFIED] || calling[RowSetEventListener.IS_MODIFIED] == -1) || calling[RowSetEventListener.IS_MODIFIED] == pos++);
+ assure("Callings are not in the correct order for IS_NEW",
+ (!_must[RowSetEventListener.IS_NEW] || calling[RowSetEventListener.IS_NEW] == -1) || calling[RowSetEventListener.IS_NEW] == pos++);
+ assure("Callings are not in the correct order for ROW_COUNT",
+ (!_must[RowSetEventListener.ROW_COUNT] || calling[RowSetEventListener.ROW_COUNT] == -1) || calling[RowSetEventListener.ROW_COUNT] == pos++);
+ assure("Callings are not in the correct order for IS_ROW_COUNT_FINAL",
+ (!_must[RowSetEventListener.IS_ROW_COUNT_FINAL] || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == -1) || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == pos);
_evt.clearCalling();
}
@@ -543,7 +589,7 @@ public class RowSet extends ComplexTestCase {
*/
private int currentRowCount() throws UnknownPropertyException, WrappedTargetException
{
- Integer rowCount = (Integer)m_rowSetProperties.getPropertyValue( "RowCount" );
+ final Integer rowCount = (Integer) m_rowSetProperties.getPropertyValue("RowCount");
return rowCount.intValue();
}
@@ -552,9 +598,9 @@ public class RowSet extends ComplexTestCase {
*/
private int positionRandom() throws SQLException, UnknownPropertyException, WrappedTargetException
{
- int position = (new java.util.Random()).nextInt( currentRowCount() - 2 ) + 2;
- assure( "sub task failed: could not position to row no. " + (new Integer( position )).toString(),
- m_resultSet.absolute( position ) );
+ final int position = (new Random()).nextInt(currentRowCount() - 2) + 2;
+ assure("sub task failed: could not position to row no. " + (Integer.valueOf(position)).toString(),
+ m_resultSet.absolute(position));
return m_resultSet.getRow();
}
@@ -568,16 +614,16 @@ public class RowSet extends ComplexTestCase {
private int deleteRandom() throws SQLException, UnknownPropertyException, WrappedTargetException
{
// check if the current position and the row count in the result set is changed by a deletion (it should not)
- int positionBefore = positionRandom();
- int rowCountBefore = currentRowCount();
+ final int positionBefore = positionRandom();
+ final int rowCountBefore = currentRowCount();
m_resultSetUpdate.deleteRow();
- int positionAfter = m_resultSet.getRow();
- int rowCountAfter = currentRowCount();
- assure( "position changed during |deleteRow| (it should not)", positionAfter == positionBefore );
- assure( "row count changed with a |deleteRow| (it should not)", rowCountBefore == rowCountAfter );
- assure( "RowSet does not report the current row as deleted after |deleteRow|", m_resultSet.rowDeleted() );
+ final int positionAfter = m_resultSet.getRow();
+ final int rowCountAfter = currentRowCount();
+ assure("position changed during |deleteRow| (it should not)", positionAfter == positionBefore);
+ assure("row count changed with a |deleteRow| (it should not)", rowCountBefore == rowCountAfter);
+ assure("RowSet does not report the current row as deleted after |deleteRow|", m_resultSet.rowDeleted());
return positionBefore;
}
@@ -585,11 +631,11 @@ public class RowSet extends ComplexTestCase {
// --------------------------------------------------------------------------------------------------------
public void testDeleteBehavior() throws Exception
{
- createTestCase( true );
+ createTestCase(true);
// ensure that all records are known
m_resultSet.last();
- int initialRowCount = currentRowCount();
+ final int initialRowCount = currentRowCount();
// delete a random row
int deletedRow = deleteRandom();
@@ -597,92 +643,119 @@ public class RowSet extends ComplexTestCase {
// .....................................................................................................
// asking for the bookmark of a deleted row should fail
boolean caughtException = false;
- try { m_rowLocate.getBookmark(); }
- catch ( SQLException e ) { caughtException = true; }
- assure( "asking for the bookmark of a deleted row should throw an exception", caughtException );
+ try
+ {
+ m_rowLocate.getBookmark();
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("asking for the bookmark of a deleted row should throw an exception", caughtException);
// .....................................................................................................
// isXXX methods should return |false| on a deleted row
- assure( "one of the isFoo failed after |deleteRow|", !m_resultSet.isBeforeFirst() && !m_resultSet.isAfterLast() && !m_resultSet.isFirst() && !m_resultSet.isLast() );
- // note that we can assume that isFirst / isLast also return |false|, since deleteRandom did
- // not position on the first or last record, but inbetween
+ assure("one of the isFoo failed after |deleteRow|", !m_resultSet.isBeforeFirst() && !m_resultSet.isAfterLast() && !m_resultSet.isFirst() && !m_resultSet.isLast());
+ // note that we can assume that isFirst / isLast also return |false|, since deleteRandom did
+ // not position on the first or last record, but inbetween
// .....................................................................................................
// check if moving away from this row in either direction yields the expected results
- assure( "|previous| after |deleteRow| failed", m_resultSet.previous() );
- int positionPrevious = m_resultSet.getRow();
- assure( "position after |previous| after |deleteRow| is not as expected", positionPrevious == deletedRow - 1 );
+ assure("|previous| after |deleteRow| failed", m_resultSet.previous());
+ final int positionPrevious = m_resultSet.getRow();
+ assure("position after |previous| after |deleteRow| is not as expected", positionPrevious == deletedRow - 1);
deletedRow = deleteRandom();
- assure( "|next| after |deleteRow| failed", m_resultSet.next() );
- int positionAfter = m_resultSet.getRow();
- assure( "position after |next| after |deleteRow| is not as expected", positionAfter == deletedRow );
- // since the deleted record "vanishs" as soon as the cursor is moved away from it, the absolute position does
- // not change with a |next| call here
+ assure("|next| after |deleteRow| failed", m_resultSet.next());
+ final int positionAfter = m_resultSet.getRow();
+ assure("position after |next| after |deleteRow| is not as expected", positionAfter == deletedRow);
+ // since the deleted record "vanishs" as soon as the cursor is moved away from it, the absolute position does
+ // not change with a |next| call here
// .....................................................................................................
// check if the deleted rows really vanished after moving away from them
- assure( "row count did not change as expected after two deletions", initialRowCount - 2 == currentRowCount() );
+ assure("row count did not change as expected after two deletions", initialRowCount - 2 == currentRowCount());
// .....................................................................................................
// check if the deleted row vanishes after moving to the insertion row
- int rowCountBefore = currentRowCount();
- int deletedPos = deleteRandom();
+ final int rowCountBefore = currentRowCount();
+ final int deletedPos = deleteRandom();
m_resultSetUpdate.moveToInsertRow();
- assure( "moving to the insertion row immediately after |deleteRow| does not adjust the row count", rowCountBefore == currentRowCount() + 1 );
+ assure("moving to the insertion row immediately after |deleteRow| does not adjust the row count", rowCountBefore == currentRowCount() + 1);
m_resultSetUpdate.moveToCurrentRow();
- assure( "|moveToCurrentRow| after |deleteRow| + |moveToInsertRow| results in unexpected position",
- ( m_resultSet.getRow() == deletedPos ) && !m_resultSet.rowDeleted() );
+ assure("|moveToCurrentRow| after |deleteRow| + |moveToInsertRow| results in unexpected position",
+ (m_resultSet.getRow() == deletedPos) && !m_resultSet.rowDeleted());
// the same, but this time with deleting the first row (which is not covered by deleteRandom)
m_resultSet.last();
m_resultSetUpdate.deleteRow();
m_resultSetUpdate.moveToInsertRow();
m_resultSetUpdate.moveToCurrentRow();
- assure( "|last| + |deleteRow| + |moveToInsertRow| + |moveToCurrentRow| results in wrong state", m_resultSet.isAfterLast() );
+ assure("|last| + |deleteRow| + |moveToInsertRow| + |moveToCurrentRow| results in wrong state", m_resultSet.isAfterLast());
// .....................................................................................................
// check if deleting a deleted row fails as expected
deleteRandom();
caughtException = false;
- try { m_resultSetUpdate.deleteRow(); }
- catch( SQLException e ) { caughtException = true; }
- assure( "deleting a deleted row succeeded - it shouldn't", caughtException );
+ try
+ {
+ m_resultSetUpdate.deleteRow();
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("deleting a deleted row succeeded - it shouldn't", caughtException);
// .....................................................................................................
// check if deleteRows fails if it contains the bookmark of a previously-deleted row
m_resultSet.first();
- Object firstBookmark = m_rowLocate.getBookmark();
+ final Object firstBookmark = m_rowLocate.getBookmark();
positionRandom();
- Object deleteBookmark = m_rowLocate.getBookmark();
+ final Object deleteBookmark = m_rowLocate.getBookmark();
m_resultSetUpdate.deleteRow();
- XDeleteRows multiDelete = (XDeleteRows)UnoRuntime.queryInterface( XDeleteRows.class, m_resultSet );
- int[] deleteSuccess = multiDelete.deleteRows(new Object[]{firstBookmark, deleteBookmark});
- assure( "XDeleteRows::deleteRows with the bookmark of an already-deleted row failed",
- ( deleteSuccess.length == 2 ) && ( deleteSuccess[0] != 0 ) && ( deleteSuccess[1] == 0 ) );
+ final XDeleteRows multiDelete = (XDeleteRows) UnoRuntime.queryInterface(XDeleteRows.class, m_resultSet);
+ final int[] deleteSuccess = multiDelete.deleteRows(new Object[]
+ {
+ firstBookmark, deleteBookmark
+ });
+ assure("XDeleteRows::deleteRows with the bookmark of an already-deleted row failed",
+ (deleteSuccess.length == 2) && (deleteSuccess[0] != 0) && (deleteSuccess[1] == 0));
// .....................................................................................................
// check if refreshing a deleted row fails as expected
deleteRandom();
caughtException = false;
- try { m_resultSet.refreshRow(); }
- catch( SQLException e ) { caughtException = true; }
- assure( "refreshing a deleted row succeeded - it shouldn't", caughtException );
+ try
+ {
+ m_resultSet.refreshRow();
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("refreshing a deleted row succeeded - it shouldn't", caughtException);
// .....................................................................................................
// rowUpdated/rowDeleted
deleteRandom();
- assure( "rowDeleted and/or rowUpdated are wrong on a deleted row", !m_resultSet.rowUpdated() && !m_resultSet.rowInserted() );
+ assure("rowDeleted and/or rowUpdated are wrong on a deleted row", !m_resultSet.rowUpdated() && !m_resultSet.rowInserted());
// .....................................................................................................
// updating values in a deleted row should fail
deleteRandom();
- XRowUpdate rowUpdated = (XRowUpdate)UnoRuntime.queryInterface( XRowUpdate.class, m_resultSet );
+ final XRowUpdate rowUpdated = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
caughtException = false;
- try { rowUpdated.updateString( 2, "Test21" ); }
- catch( SQLException e ) { caughtException = true; }
- assure( "updating values in a deleted row should not succeed", caughtException );
+ try
+ {
+ rowUpdated.updateString(2, TEST21);
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("updating values in a deleted row should not succeed", caughtException);
}
// --------------------------------------------------------------------------------------------------------
@@ -691,67 +764,66 @@ public class RowSet extends ComplexTestCase {
*/
public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException
{
- createTestCase( true );
+ createTestCase(true);
// ensure that all records are known
m_resultSet.last();
- XResultSet clone = createClone();
- XRowLocate cloneRowLocate = (XRowLocate)UnoRuntime.queryInterface( XRowLocate.class, clone );
+ final XResultSet clone = createClone();
+ final XRowLocate cloneRowLocate = (XRowLocate) UnoRuntime.queryInterface(XRowLocate.class, clone);
positionRandom();
// .....................................................................................................
// move the clone to the same record as the RowSet, and delete this record
- cloneRowLocate.moveToBookmark( m_rowLocate.getBookmark() );
- int clonePosition = clone.getRow();
+ cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark());
+ final int clonePosition = clone.getRow();
m_resultSetUpdate.deleteRow();
- assure( "clone doesn't know that its current row has been deleted via the RowSet", clone.rowDeleted() );
- assure( "clone's position changed somehow during deletion", clonePosition == clone.getRow() );
+ assure("clone doesn't know that its current row has been deleted via the RowSet", clone.rowDeleted());
+ assure("clone's position changed somehow during deletion", clonePosition == clone.getRow());
// .....................................................................................................
// move the row set away from the deleted record. This should still not touch the state of the clone
m_resultSet.previous();
- assure( "clone doesn't know (anymore) that its current row has been deleted via the RowSet", clone.rowDeleted() );
- assure( "clone's position changed somehow during deletion and RowSet-movement", clonePosition == clone.getRow() );
+ assure("clone doesn't know (anymore) that its current row has been deleted via the RowSet", clone.rowDeleted());
+ assure("clone's position changed somehow during deletion and RowSet-movement", clonePosition == clone.getRow());
// .....................................................................................................
// move the clone away from the deleted record
clone.next();
- assure( "clone still assumes that its row is deleted - but we already moved it", !clone.rowDeleted() );
+ assure("clone still assumes that its row is deleted - but we already moved it", !clone.rowDeleted());
// .....................................................................................................
// check whether deleting the extremes (first / last) work
m_resultSet.first();
- cloneRowLocate.moveToBookmark( m_rowLocate.getBookmark() );
+ cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark());
m_resultSetUpdate.deleteRow();
clone.previous();
- assure( "deleting the first record left the clone in a strange state (after |previous|)", clone.isBeforeFirst() );
+ assure("deleting the first record left the clone in a strange state (after |previous|)", clone.isBeforeFirst());
clone.next();
- assure( "deleting the first record left the clone in a strange state (after |previous| + |next|)", clone.isFirst() );
+ assure("deleting the first record left the clone in a strange state (after |previous| + |next|)", clone.isFirst());
m_resultSet.last();
- cloneRowLocate.moveToBookmark( m_rowLocate.getBookmark() );
+ cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark());
m_resultSetUpdate.deleteRow();
clone.next();
- assure( "deleting the last record left the clone in a strange state (after |next|)", clone.isAfterLast() );
+ assure("deleting the last record left the clone in a strange state (after |next|)", clone.isAfterLast());
clone.previous();
- assure( "deleting the first record left the clone in a strange state (after |next| + |previous|)", clone.isLast() );
+ assure("deleting the first record left the clone in a strange state (after |next| + |previous|)", clone.isLast());
// .....................................................................................................
// check whether movements of the clone interfere with movements of the RowSet, if the latter is on a deleted row
- int positionBefore = positionRandom();
+ final int positionBefore = positionRandom();
m_resultSetUpdate.deleteRow();
- assure( "|deleteRow|, but no |rowDeleted| (this should have been found much earlier!)", m_resultSet.rowDeleted() );
+ assure("|deleteRow|, but no |rowDeleted| (this should have been found much earlier!)", m_resultSet.rowDeleted());
clone.beforeFirst();
- while ( clone.next() )
- ;
- assure( "row set forgot that the current row is deleted", m_resultSet.rowDeleted() );
+ while (clone.next());
+ assure("row set forgot that the current row is deleted", m_resultSet.rowDeleted());
- assure( "moving to the next record after |deleteRow| and clone moves failed", m_resultSet.next() );
- assure( "wrong position after |deleteRow| and clone movement", !m_resultSet.isAfterLast() && !m_resultSet.isBeforeFirst() );
- assure( "wrong absolute position after |deleteRow| and clone movement", m_resultSet.getRow() == positionBefore );
+ assure("moving to the next record after |deleteRow| and clone moves failed", m_resultSet.next());
+ assure("wrong position after |deleteRow| and clone movement", !m_resultSet.isAfterLast() && !m_resultSet.isBeforeFirst());
+ assure("wrong absolute position after |deleteRow| and clone movement", m_resultSet.getRow() == positionBefore);
}
// --------------------------------------------------------------------------------------------------------
@@ -760,99 +832,102 @@ public class RowSet extends ComplexTestCase {
*/
public void testCloneMovesPlusInsertions() throws SQLException, UnknownPropertyException, WrappedTargetException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException
{
- createTestCase( true );
+ createTestCase(true);
// ensure that all records are known
- m_rowSetProperties.setPropertyValue( "FetchSize", new Integer( 10 ) );
+ m_rowSetProperties.setPropertyValue("FetchSize", Integer.valueOf(10));
- XResultSet clone = createClone();
- XRow cloneRow = (XRow)UnoRuntime.queryInterface( XRow.class, clone );
+ final XResultSet clone = createClone();
+ final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
// .....................................................................................................
// first check the basic scenario without the |moveToInsertRow| |moveToCurrentRow|, to ensure that
// really those are broken, if at all
m_resultSet.last();
clone.first();
- clone.absolute( 11 );
+ clone.absolute(11);
clone.first();
- int rowValue1 = m_row.getInt(1);
- int rowPos = m_resultSet.getRow();
- int rowValue2 = m_row.getInt(1);
- assure( "repeated query for the same column value delivers different values (" + rowValue1 + " and " + rowValue2 + ") on row: " + rowPos,
- rowValue1 == rowValue2 );
+ final int rowValue1 = m_row.getInt(1);
+ final int rowPos = m_resultSet.getRow();
+ final int rowValue2 = m_row.getInt(1);
+ assure("repeated query for the same column value delivers different values (" + rowValue1 + " and " + rowValue2 + ") on row: " + rowPos,
+ rowValue1 == rowValue2);
- testPosition( clone, cloneRow, 1, "mixed clone/rowset move: clone check" );
- testPosition( m_resultSet, m_row, MAX_TABLE_ROWS, "mixed clone/rowset move: rowset check" );
+ testPosition(clone, cloneRow, 1, "mixed clone/rowset move: clone check");
+ testPosition(m_resultSet, m_row, MAX_TABLE_ROWS, "mixed clone/rowset move: rowset check");
// .....................................................................................................
// now the complete scenario
m_resultSet.last();
m_resultSetUpdate.moveToInsertRow();
clone.first();
- clone.absolute( 11 );
+ clone.absolute(11);
clone.first();
m_resultSetUpdate.moveToCurrentRow();
- testPosition( clone, cloneRow, 1, "mixed clone/rowset move/insertion: clone check" );
- testPosition( m_resultSet, m_row, 100, "mixed clone/rowset move/insertion: rowset check" );
+ testPosition(clone, cloneRow, 1, "mixed clone/rowset move/insertion: clone check");
+ testPosition(m_resultSet, m_row, 100, "mixed clone/rowset move/insertion: rowset check");
}
// --------------------------------------------------------------------------------------------------------
private void testTableParameters()
{
// for a row set simply based on a table, there should be not parameters at all
- createRowSet( "products", CommandType.TABLE, false );
+ createRowSet("products", CommandType.TABLE, false);
try
{
- verifyParameters( new String[] {}, "testTableParameters" );
+ verifyParameters(new String[]
+ {
+ }, "testTableParameters");
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters of a table failed" + e.getMessage(), false );
+ assure("testing the parameters of a table failed" + e.getMessage(), false);
}
}
// --------------------------------------------------------------------------------------------------------
+
private void testParametersAfterNormalExecute()
{
try
{
- createRowSet( "SELECT * FROM \"customers\"", CommandType.COMMAND, true );
- m_rowSetProperties.setPropertyValue( "Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
- XParameters rowsetParams = (XParameters)UnoRuntime.queryInterface( XParameters.class,
- m_rowSet );
- rowsetParams.setString( 1, "London" );
+ createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, true);
+ m_rowSetProperties.setPropertyValue("Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
+ final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
+ m_rowSet);
+ rowsetParams.setString(1, "London");
m_rowSet.execute();
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters of a table failed" + e.getMessage(), false );
+ assure("testing the parameters of a table failed" + e.getMessage(), false);
}
}
// --------------------------------------------------------------------------------------------------------
- private void verifyParameters( String[] _paramNames, String _context ) throws com.sun.star.uno.Exception
+ private void verifyParameters(String[] _paramNames, String _context) throws com.sun.star.uno.Exception
{
- XIndexAccess params = m_paramsSupplier.getParameters();
- int expected = _paramNames.length;
- int found = params != null ? params.getCount() : 0;
+ final XIndexAccess params = m_paramsSupplier.getParameters();
+ final int expected = _paramNames.length;
+ final int found = params != null ? params.getCount() : 0;
- assure( "wrong number of parameters (expected: " + expected + ", found: " + found + ") in " + _context,
- found == expected );
+ assure("wrong number of parameters (expected: " + expected + ", found: " + found + ") in " + _context,
+ found == expected);
- if ( found == 0 )
+ if (found == 0)
+ {
return;
+ }
- for ( int i=0; i<expected; ++i )
+ for (int i = 0; i < expected; ++i)
{
- XPropertySet parameter = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
- params.getByIndex(i) );
+ final XPropertySet parameter = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
+ params.getByIndex(i));
- String expectedName = _paramNames[i];
- String foundName = (String)parameter.getPropertyValue( "Name" );
- assure( "wrong parameter name (expected: " + expectedName + ", found: " + foundName + ") in" + _context,
- expectedName.equals( foundName ) );
+ final String expectedName = _paramNames[i];
+ final String foundName = (String) parameter.getPropertyValue("Name");
+ assure("wrong parameter name (expected: " + expectedName + ", found: " + foundName + ") in" + _context,
+ expectedName.equals(foundName));
}
}
@@ -863,14 +938,16 @@ public class RowSet extends ComplexTestCase {
{
// for a row set based on a parametrized query, those parameters should be properly
// recognized
- m_dataSource.createQuery( "products like", "SELECT * FROM \"products\" WHERE \"Name\" LIKE :product_name" );
- createRowSet( "products like", CommandType.QUERY, false );
- verifyParameters( new String[] { "product_name" }, "testParametrizedQuery" );
+ m_dataSource.createQuery("products like", "SELECT * FROM \"products\" WHERE \"Name\" LIKE :product_name");
+ createRowSet("products like", CommandType.QUERY, false);
+ verifyParameters(new String[]
+ {
+ "product_name"
+ }, "testParametrizedQuery");
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters of a parametrized query failed" + e.getMessage(), false );
+ assure("testing the parameters of a parametrized query failed" + e.getMessage(), false);
}
}
@@ -879,38 +956,37 @@ public class RowSet extends ComplexTestCase {
{
try
{
- createRowSet( "products like", CommandType.QUERY, false );
+ createRowSet("products like", CommandType.QUERY, false);
// let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container
- XParameters rowsetParams = (XParameters)UnoRuntime.queryInterface( XParameters.class,
- m_rowSet );
- rowsetParams.setString( 1, "Apples" );
+ final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
+ m_rowSet);
+ rowsetParams.setString(1, "Apples");
XIndexAccess params = m_paramsSupplier.getParameters();
- XPropertySet firstParam = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex(0) );
- Object firstParamValue = firstParam.getPropertyValue( "Value" );
+ XPropertySet firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
+ Object firstParamValue = firstParam.getPropertyValue("Value");
- assure( "XParameters and the parameters container do not properly interact",
- firstParamValue.equals( "Apples" ) );
+ assure("XParameters and the parameters container do not properly interact",
+ "Apples".equals(firstParamValue));
// let's see whether this also survices an execute of the row set
- rowsetParams.setString( 1, "Oranges" );
+ rowsetParams.setString(1, "Oranges");
m_rowSet.execute();
{
// TODO: the following would not be necessary if the parameters container would *survive*
// the execution of the row set. It currently doesn't (though the values it represents do).
// It would be nice, but not strictly necessary, if it would.
params = m_paramsSupplier.getParameters();
- firstParam = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex(0) );
+ firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
}
- firstParamValue = firstParam.getPropertyValue( "Value" );
- assure( "XParameters and the parameters container do not properly interact, after the row set has been executed",
- firstParamValue.equals( "Oranges" ) );
+ firstParamValue = firstParam.getPropertyValue("Value");
+ assure("XParameters and the parameters container do not properly interact, after the row set has been executed",
+ "Oranges".equals(firstParamValue));
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "could not text the relationship between XParameters and XParametersSupplier" + e.getMessage(), false );
+ assure("could not text the relationship between XParameters and XParametersSupplier" + e.getMessage(), false);
}
}
@@ -919,19 +995,23 @@ public class RowSet extends ComplexTestCase {
{
try
{
- createRowSet( "SELECT * FROM \"customers\"", CommandType.COMMAND, false );
- m_rowSetProperties.setPropertyValue( "Filter", "\"City\" = :city" );
-
- m_rowSetProperties.setPropertyValue( "ApplyFilter", new Boolean( true ) );
- verifyParameters( new String[] { "city" }, "testParametersInFilter" );
-
- m_rowSetProperties.setPropertyValue( "ApplyFilter", new Boolean( false ) );
- verifyParameters( new String[] {}, "testParametersInFilter" );
+ createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, false);
+ m_rowSetProperties.setPropertyValue("Filter", "\"City\" = :city");
+
+ m_rowSetProperties.setPropertyValue("ApplyFilter", Boolean.TRUE);
+ verifyParameters(new String[]
+ {
+ "city"
+ }, "testParametersInFilter");
+
+ m_rowSetProperties.setPropertyValue("ApplyFilter", Boolean.FALSE);
+ verifyParameters(new String[]
+ {
+ }, "testParametersInFilter");
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters within a WHERE clause failed" + e.getMessage(), false );
+ assure("testing the parameters within a WHERE clause failed" + e.getMessage(), false);
}
}
@@ -940,8 +1020,8 @@ public class RowSet extends ComplexTestCase {
*/
public void testParameters()
{
- createTestCase( false );
- // use an own RowSet instance, not the one which is also used for the other cases
+ createTestCase(false);
+ // use an own RowSet instance, not the one which is also used for the other cases
testTableParameters();
testParametrizedQuery();
@@ -950,6 +1030,6 @@ public class RowSet extends ComplexTestCase {
testParametersAfterNormalExecute();
testParametersInteraction();
- }
+ }
}