doTestBridge();
}
protected void doTestBridge() throws Exception
{
QueryRunner queryRunner = jdbcConnector.getQueryRunner();
Connection connection = jdbcConnector.getConnection();
for (int i = 0; i < TEST_ROWS; i++)
{
queryRunner.update(connection, "INSERT INTO TEST(TYPE, DATA) VALUES (1, 'Test " + i + "')");
}
List<?> results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 1", new ArrayListHandler());
assertEquals(TEST_ROWS, results.size());
long t0 = System.currentTimeMillis();
while (true)
{
results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST_OUT", new ArrayListHandler());
logger.info("Results found: " + results.size());
if (results.size() >= TEST_ROWS)
{
break;
}
results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 2", new ArrayListHandler());
logger.info("Locked records found: " + results.size());
assertTrue(TEST_ROWS >= results.size());
results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 1", new ArrayListHandler());
logger.info("Original records found: " + results.size());
assertTrue(TEST_ROWS >= results.size());
assertTrue(System.currentTimeMillis() - t0 < 20000);
Thread.sleep(500);