use of org.dbflute.exception.DfTakeFinallyAssertionFailureException in project dbflute-core by dbflute.
the class DfAlterCheckProcess method reflectTakeFinallyResultToFinalInfo.
protected void reflectTakeFinallyResultToFinalInfo(DfAlterCheckFinalInfo finalInfo, DfTakeFinallyFinalInfo takeFinally) {
final List<String> detailMessageList = takeFinally.getDetailMessageList();
for (String detailMessage : detailMessageList) {
finalInfo.addDetailMessage(detailMessage);
}
final SQLFailureException breakCause = takeFinally.getBreakCause();
if (breakCause != null) {
finalInfo.setBreakCause(breakCause);
}
final DfTakeFinallyAssertionFailureException assertionEx = takeFinally.getAssertionEx();
if (assertionEx != null) {
finalInfo.setTakeFinallyAssertionEx(assertionEx);
}
if (takeFinally.isFailure()) {
finalInfo.setFailure(true);
}
}
use of org.dbflute.exception.DfTakeFinallyAssertionFailureException in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method execute.
// ===================================================================================
// Execute
// =======
public DfTakeFinallyFinalInfo execute() {
final long before = System.currentTimeMillis();
final DfRunnerInformation runInfo = createRunnerInformation();
DfSqlFileFireResult fireResult = null;
DfTakeFinallyAssertionFailureException assertionEx = null;
try {
fireResult = takeFinally(runInfo);
if (_continueIfAssetionFailure && !_continuedExList.isEmpty()) {
// override result with saved exceptions
// this message uses the first exception
fireResult = createFailureFireResult(_continuedExList.get(0), fireResult);
}
} catch (DfTakeFinallyAssertionFailureException e) {
// if take-assert, the exception does not thrown
fireResult = createFailureFireResult(e, null);
assertionEx = e;
}
final DfTakeFinallyFinalInfo finalInfo = createFinalInfo(fireResult, assertionEx);
if (!finalInfo.isFailure()) {
// because it might fail to create sequence
incrementSequenceToDataMax();
}
final long after = System.currentTimeMillis();
final long processPerformanceMillis = after - before;
finalInfo.setProcessPerformanceMillis(processPerformanceMillis);
return finalInfo;
}
use of org.dbflute.exception.DfTakeFinallyAssertionFailureException in project dbflute-core by dbflute.
the class DfAlterCheckProcess method executeAlterSql.
// -----------------------------------------------------
// Alter Fire
// ----------
protected void executeAlterSql(DfAlterCheckFinalInfo finalInfo) {
List<File> alterSqlFileList = findMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
_unreleasedAlterAgent.restoreUnreleasedAlterSql();
alterSqlFileList = findMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
createEmptyAlterSqlFileIfNotExists();
alterSqlFileList = findMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
// no way
throwAlterCheckAlterSqlNotFoundException();
}
}
}
final DfRunnerInformation runInfo = createRunnerInformation();
final DfSqlFileFireMan fireMan = createSqlFileFireMan();
final DfSqlFileRunner runner = createSqlFileRunner(runInfo);
finalInfo.addAlterSqlFileAll(alterSqlFileList);
try {
final DfSqlFileFireResult result = fireMan.fire(runner, alterSqlFileList);
reflectAlterResultToFinalInfo(finalInfo, result);
} catch (DfTakeFinallyAssertionFailureException e) {
handleTakeFinallyAssertionFailureException(finalInfo, e);
}
}
use of org.dbflute.exception.DfTakeFinallyAssertionFailureException in project dbflute-core by dbflute.
the class DfTakeAssertTask method dumpAssertionFailure.
protected void dumpAssertionFailure(List<DfTakeFinallyAssertionFailureException> takeAssertExList) {
final File dumpFile = new File("./log/take-assert.log");
if (dumpFile.exists()) {
dumpFile.delete();
}
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dumpFile), "UTF-8"));
for (DfTakeFinallyAssertionFailureException assertionEx : takeAssertExList) {
bw.write(assertionEx.getMessage());
bw.write(ln() + ln());
}
bw.flush();
} catch (IOException e) {
if (bw != null) {
try {
bw.close();
} catch (IOException ignored) {
}
}
}
}
use of org.dbflute.exception.DfTakeFinallyAssertionFailureException in project dbflute-core by dbflute.
the class DfTakeAssertTask method buildFinalMessage.
protected String buildFinalMessage() {
// might be null
final DfTakeFinallyFinalInfo finalInfo = _finalInfo;
final List<DfTakeFinallyAssertionFailureException> takeAssertExList = _takeAssertExList;
final StringBuilder sb = new StringBuilder();
if (finalInfo != null) {
if (finalInfo.isValidInfo()) {
buildSchemaTaskContents(sb, finalInfo);
}
if (takeAssertExList != null && !takeAssertExList.isEmpty()) {
sb.append(ln()).append(" * * * * * * * * * * *");
sb.append(ln()).append(" * Assertion Failure *");
sb.append(ln()).append(" * * * * * * * * * * *");
}
}
return sb.toString();
}
Aggregations