コード例 #1
0
  @Test
  public void testGetInfoResultSet() {
    try {
      stmt = conn.prepareStatement(ALLEGATO5_FIND_BYPK);
      stmt.setInt(1, 6);
      ResultSet rs = stmt.executeQuery();
      rs.next();
      allegato5 = Allegato5Assembler.getInfo(rs);

      stmt.close();
      db.closeConnection(conn);

    } catch (SQLException e) {
      fail(e.getMessage());
    } catch (DBAccessException e) {
      fail(e.getMessage());
    }
  }
コード例 #2
0
  @Test
  public void testGetPreparedStatement() {
    try {
      // testo il getPrearedStatement facendo una query di creazione
      // MANCA TESTO QUERY IN ALLEGATO5_CREATE
      stmt = conn.prepareStatement(ALLEGATO5_CREATE);
      Allegato5Assembler.getPreparedStatement(allegato5, stmt);
      stmt.executeUpdate();
      db.rollbackConnection(conn);

      stmt.close();
      db.closeConnection(conn);

    } catch (SQLException e) {
      fail(e.getMessage());
    } catch (DBAccessException e) {
      fail(e.getMessage());
    }
  }
コード例 #3
0
  @Test
  public void testGetInfoRowSet() {
    CachedRowSet rws;
    try {
      rws = new CachedRowSetImpl();

      rws.setCommand(ALLEGATO5_FIND_BYPK);
      rws.setInt(1, 6);
      rws.execute(conn);
      rws.next();
      allegato5 = Allegato5Assembler.getInfo(rws);
      rws.close();
      db.closeConnection(conn);

    } catch (SQLException e) {
      fail(e.getMessage());
    } catch (DBAccessException e) {
      fail(e.getMessage());
    }
  }