Example #1
0
  private void closeOutput() throws Exception {

    // Flush the rest of the buffer to disk!
    //
    if (data.byteBuffer.position() > 0) {
      data.byteBuffer.flip();
      data.fileChannel.write(data.byteBuffer);
    }

    // Close the fifo file...
    //
    data.fifoOpener.close();
    data.fileChannel = null;

    // wait for the INSERT statement to finish and check for any
    // error and/or warning...
    //
    data.sqlRunner.join();
    SqlRunner sqlRunner = data.sqlRunner;
    data.sqlRunner = null;
    sqlRunner.checkExcn();

    data.sqlOutputStream.close();
    data.sqlOutputStream = null;
  }
Example #2
0
 private void assertProductsTableExistsAndLoaded() throws IOException, SQLException {
   PooledDataSource ds = createPooledDataSource(JPETSTORE_PROPERTIES);
   try {
     Connection conn = ds.getConnection();
     SqlRunner executor = new SqlRunner(conn);
     List<Map<String, Object>> products = executor.selectAll("SELECT * FROM PRODUCT");
     assertEquals(16, products.size());
   } finally {
     ds.forceCloseAll();
   }
 }