Exemple #1
0
  @Test
  public void testExperiments() {
    try {
      // get row count of experiments in the dataset
      int expected = getDataSet().getTable("Experiment").getRowCount();

      // get number of experiments from the DAO
      int actual = getExperimentDAO().count();

      // test data contains 2 experiments, check size of returned list
      TestCase.assertEquals("Wrong number of experiments", expected, actual);

      System.out.println("Expected number of experiments: " + expected + ", actual: " + actual);

      for (Experiment d : random(getExperimentDAO(), actual, 5)) {
        TestCase.assertNotNull(d);
        TestCase.assertNotNull(d.getId());
      }
    } catch (Exception e) {
      e.printStackTrace();
      TestCase.fail();
    }
  }
  public CellLine getCells(Experiment expt) throws SQLException, UnknownRoleException {

    java.sql.Connection cxn = loader.getConnection();
    PreparedStatement ps = cxn.prepareStatement("select cells from experiment" + " where id=?");
    ps.setInt(1, expt.getDBID());
    ResultSet rs = ps.executeQuery();
    int cellsID = -1;
    if (rs.next()) {
      cellsID = rs.getInt(1);
    }
    rs.close();
    ps.close();

    return chipLoader.loadCellLine(cellsID);
  }