コード例 #1
0
ファイル: ExportLogicTest.java プロジェクト: bsvdev/bsv
  /** Set up a clean database before we do the testing on it. */
  @Before
  public void setup() {
    // create workding dir
    (new File(this.path)).mkdirs();

    // make sure the old file is deleted
    new File(this.dbFile).delete();
    arff.delete();
    csv.delete();

    try {
      this.database = new Database(this.dbFile);
      this.selCon = new SelectionController();
      this.subCon = new SubspaceController(database);
      this.grCon = new GroupController(database, subCon);
      this.daHub = new DataHub(database, grCon, subCon);
      arff.createNewFile();
      csv.createNewFile();
    } catch (IllegalArgumentException e) {
      Assert.fail("Database setup failed; path is invalid: " + e.getMessage());
    } catch (InvalidDriverException e) {
      Assert.fail("Database setup failed; SQL driver is invalid: " + e.getMessage());
    } catch (DatabaseAccessException e) {
      Assert.fail("Database setup failed; connection could not be created: " + e.getMessage());
    } catch (IncompatibleVersionException e) {
      Assert.fail("Database setup failed; connection could not be created: " + e.getMessage());
    } catch (IOException e) {
      Assert.fail(e.getClass().toString());
    }
  }