/**
   * Use the provided databaseTester to prep the database with the provided prep dataset. See {@link
   * org.dbunit.IDatabaseTester#onSetup()}.
   *
   * @throws Exception
   */
  public void setupData() throws Exception {
    LOG.debug("setupData: setting prep dataset and inserting rows");
    if (databaseTester == null) {
      throw new IllegalStateException("databaseTester is null; must configure or set it first");
    }

    databaseTester.setDataSet(prepDs);
    databaseTester.onSetup();
  }
示例#2
0
  protected void setUp() throws Exception {
    logger.debug("setUp() - start");

    super.setUp();
    final IDatabaseTester databaseTester = getDatabaseTester();
    assertNotNull("DatabaseTester is not set", databaseTester);
    databaseTester.setSetUpOperation(getSetUpOperation());
    databaseTester.setDataSet(getDataSet());
    databaseTester.setOperationListener(getOperationListener());
    databaseTester.onSetup();
  }
  /** {@inheritDoc} */
  public void cleanupData() throws Exception {
    IDataSet dataset = new CompositeDataSet(prepDs, expectedDs);
    String tableNames[] = dataset.getTableNames();
    int count = tableNames.length;
    LOG.info("cleanupData: about to clean up {} tables={}", new Integer(count), tableNames);

    if (databaseTester == null) {
      throw new IllegalStateException("databaseTester is null; must configure or set it first");
    }

    databaseTester.setDataSet(dataset);
    databaseTester.onTearDown();
    LOG.debug("cleanupData: Clean up done");
  }
示例#4
0
  protected void tearDown() throws Exception {
    logger.debug("tearDown() - start");

    try {
      final IDatabaseTester databaseTester = getDatabaseTester();
      assertNotNull("DatabaseTester is not set", databaseTester);
      databaseTester.setTearDownOperation(getTearDownOperation());
      databaseTester.setDataSet(getDataSet());
      databaseTester.setOperationListener(getOperationListener());
      databaseTester.onTearDown();
    } finally {
      tester = null;
      super.tearDown();
    }
  }