public void testHbm2DDLExportExecution() {
    cleanupOutputDir();
    File baseDir = new File(project.getProperty("build.dir"), "topdown");
    File export = new File(baseDir, "export.sql");
    File update = new File(baseDir, "update.sql");
    File onlydrop = new File(baseDir, "onlydrop.sql");

    assertFalse(export.exists());
    assertFalse(update.exists());
    assertFalse(onlydrop.exists());

    executeTarget("testantcfgExportExecuted");
    assertTrue(getLog(), checkLogWithoutExceptions());

    assertTrue(export.exists());
    assertTrue(update.exists());

    assertNotNull(TestHelper.findFirstString("create", export));
    // if export is executed, update should be empty
    assertEquals(0, update.length());

    export.delete();
    update.delete();
    onlydrop.delete();
  }
  public void testHbm2DDLUpdateExecution() {
    cleanupOutputDir();
    File baseDir = new File(project.getProperty("build.dir"), "topdown");
    File update1 = new File(baseDir, "update1.sql");
    File update2 = new File(baseDir, "update2.sql");
    File onlydrop = new File(baseDir, "onlydrop.sql");

    assertFalse(update1.exists());
    assertFalse(update2.exists());
    assertFalse(onlydrop.exists());

    executeTarget("testantcfgUpdateExecuted");
    assertTrue(getLog(), checkLogWithoutExceptions());

    assertTrue(update1.exists());
    assertTrue(update2.exists());

    assertNotNull(TestHelper.findFirstString("create", update1));
    // if first update is executed, the second should be empty
    assertEquals(0, update2.length());

    update1.delete();
    update2.delete();
    onlydrop.delete();
  }
  public void testEJB3ConfigurationFailureExpected() {
    executeTarget("testantejb3cfg");
    File baseDir = new File(project.getProperty("build.dir"));
    File ejb3 = new File(baseDir, "ejb3.sql");

    assertTrue(ejb3.exists());
    assertEquals(null, TestHelper.findFirstString("drop", ejb3));

    assertFalse(getLog().indexOf("<ejb3configuration> is deprecated") > 0);
  }
  public void testHbm2DDLLogic() {
    cleanupOutputDir();
    File baseDir = new File(project.getProperty("build.dir"), "topdown");
    File onlyCreate = new File(baseDir, "onlycreate.sql");
    File onlyDrop = new File(baseDir, "onlydrop.sql");
    File dropAndCreate = new File(baseDir, "dropandcreate.sql");
    File update = new File(baseDir, "update.sql");

    assertFalse(onlyCreate.exists());
    assertFalse(onlyDrop.exists());
    assertFalse(dropAndCreate.exists());
    assertFalse(update.exists());

    // allow to test creation of script file + delimiter
    // + non execution (test will fail if executed because of crappy delimiter)
    executeTarget("testScriptCreation");
    assertTrue(getLog(), checkLogWithoutExceptions());

    assertTrue(onlyCreate.exists());
    assertTrue(onlyDrop.exists());
    assertTrue(dropAndCreate.exists());
    assertTrue(update.exists());

    assertNotNull(TestHelper.findFirstString("drop", dropAndCreate));
    assertNotNull(TestHelper.findFirstString("create", dropAndCreate));
    assertNotNull(TestHelper.findFirstString("---", dropAndCreate));

    assertEquals(null, TestHelper.findFirstString("create", onlyDrop));
    assertNotNull(TestHelper.findFirstString("drop", onlyDrop));

    assertEquals(null, TestHelper.findFirstString("drop", onlyCreate));
    assertNotNull(TestHelper.findFirstString("create", onlyCreate));
    assertNotNull(TestHelper.findFirstString("---", onlyCreate));

    assertNotNull(TestHelper.findFirstString("create", update));
    assertNotNull(TestHelper.findFirstString("---", update));

    onlyCreate.delete();
    onlyDrop.delete();
    dropAndCreate.delete();
    update.delete();
  }