//
  // Find all the objects inside the DataSource and vet them.
  //
  private void vetDataSource(HashSet<String> unsupportedList, HashSet<String> notUnderstoodList)
      throws Exception {
    DataSource ds = JDBCDataSource.getDataSource();
    Connection conn = ds.getConnection();

    vetObject(ds, unsupportedList, notUnderstoodList);

    connectionWorkhorse(conn, unsupportedList, notUnderstoodList);
  }
  /**
   * See DERBY-3875.
   *
   * <p>Steps in the test: 1) Create a database and perform a backup. 2) Shutdown the Derby engine.
   * 3) Corrupt one of the database files. 4) Boot corrupted database. 5) Restore backup.
   *
   * <p>With the bug present, the test failed in step 5. Note that the test did fail only on Windows
   * platforms, which is probably because of differences in the file system code.
   */
  public void testDerby3875() throws SQLException, IOException {
    // Create the database.
    println("Creating database");
    getConnection();
    // Backup the database.
    println("Backing up database");
    String dbBackup = SupportFilesSetup.getReadWrite("dbbackup").getPath();
    CallableStatement cs = prepareCall("CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)");
    cs.setString(1, dbBackup);
    cs.execute();
    cs.close();
    // Shutdown the database.
    getTestConfiguration().shutdownEngine();

    // Corrupt one of the database files.
    File dataDir = new File("system/" + getTestConfiguration().getDefaultDatabaseName(), "seg0");
    File df = new File(dataDir, "c10.dat");
    assertTrue(
        "File to corrupt doesn't exist: " + df.getPath(), PrivilegedFileOpsForTests.exists(df));
    println("Corrupting data file");
    byte[] zeros = new byte[(int) PrivilegedFileOpsForTests.length(df)];
    FileOutputStream fout = PrivilegedFileOpsForTests.getFileOutputStream(df);
    fout.write(zeros);
    fout.flush();
    fout.close();

    // Reboot the database, which should fail.
    try {
      println("Rebooting corrupted database");
      getConnection();
      fail("Reboot of currupted database should have failed");
    } catch (SQLException sqle) {
      assertSQLState("XJ040", sqle);
    }

    // Now try to restore database.
    println("Restoring database");
    String tmp[] = Utilities.split(getTestConfiguration().getDefaultDatabaseName(), '/');
    final String dbName = tmp[tmp.length - 1];
    DataSource ds = JDBCDataSource.getDataSource();
    JDBCDataSource.setBeanProperty(
        ds, "connectionAttributes", ("restoreFrom=" + dbBackup + "/" + dbName));
    assertNotNull(ds.getConnection());
  }