Search in sources :

Example 1 with DfTakeFinallyFinalInfo

use of org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo in project dbflute-core by dbflute.

the class DfAlterCheckProcess method takeFinally.

// -----------------------------------------------------
// Take Finally
// ------------
protected void takeFinally(DfAlterCheckFinalInfo finalInfo) {
    // alter-take-finally.sql for assertion
    final String sqlRootDir = getMigrationAlterDirectory();
    final DfTakeFinallyProcess process = DfTakeFinallyProcess.createAsAlterSchema(sqlRootDir, _dataSource);
    final DfTakeFinallyFinalInfo takeFinally = process.execute();
    finalInfo.addAlterSqlFileAll(takeFinally.getTakeFinallySqlFileList());
    reflectTakeFinallyResultToFinalInfo(finalInfo, takeFinally);
}
Also used : DfTakeFinallyFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)

Example 2 with DfTakeFinallyFinalInfo

use of org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo 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;
}
Also used : DfTakeFinallyAssertionFailureException(org.dbflute.exception.DfTakeFinallyAssertionFailureException) DfTakeFinallyFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo) DfSqlFileFireResult(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation)

Example 3 with DfTakeFinallyFinalInfo

use of org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo in project dbflute-core by dbflute.

the class DfTakeFinallyProcess method createFinalInfo.

// ===================================================================================
// Final Info
// ==========
protected DfTakeFinallyFinalInfo createFinalInfo(DfSqlFileFireResult fireResult, DfTakeFinallyAssertionFailureException assertionEx) {
    final DfTakeFinallyFinalInfo finalInfo = new DfTakeFinallyFinalInfo();
    finalInfo.addTakeFinallySqlFileAll(_executedSqlFileList);
    if (fireResult != null) {
        finalInfo.setResultMessage(fireResult.getResultMessage());
        final List<String> detailMessageList = extractDetailMessageList(fireResult);
        for (String detailMessage : detailMessageList) {
            finalInfo.addDetailMessage(detailMessage);
        }
        finalInfo.setBreakCause(fireResult.getBreakCause());
        finalInfo.setFailure(fireResult.isExistsError());
    }
    finalInfo.setAssertionEx(assertionEx);
    // finalInfo.setProcessPerformanceMillis(processPerformanceMillis);
    return finalInfo;
}
Also used : DfTakeFinallyFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)

Example 4 with DfTakeFinallyFinalInfo

use of org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo in project dbflute-core by dbflute.

the class DfAlterCheckProcess method takeFinally.

// -----------------------------------------------------
// Take Finally
// ------------
protected void takeFinally(DfAlterCheckFinalInfo finalInfo) {
    // alter-take-finally.sql for assertion
    final String sqlRootDir = getMigrationAlterDirectory();
    final DfTakeFinallyProcess process = DfTakeFinallyProcess.createAsAlterSchema(sqlRootDir, _dataSource);
    final DfTakeFinallyFinalInfo takeFinally = process.execute();
    finalInfo.addAlterSqlFileAll(takeFinally.getTakeFinallySqlFileList());
    reflectTakeFinallyResultToFinalInfo(finalInfo, takeFinally);
}
Also used : DfTakeFinallyProcess(org.dbflute.logic.replaceschema.process.DfTakeFinallyProcess) DfTakeFinallyFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)

Example 5 with DfTakeFinallyFinalInfo

use of org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo 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();
}
Also used : DfTakeFinallyAssertionFailureException(org.dbflute.exception.DfTakeFinallyAssertionFailureException) DfTakeFinallyFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)

Aggregations

DfTakeFinallyFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)6 DfTakeFinallyAssertionFailureException (org.dbflute.exception.DfTakeFinallyAssertionFailureException)2 DfRunnerInformation (org.dbflute.helper.jdbc.DfRunnerInformation)1 DfSqlFileFireResult (org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult)1 DfAlterCheckFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfAlterCheckFinalInfo)1 DfCreateSchemaFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfCreateSchemaFinalInfo)1 DfLoadDataFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfLoadDataFinalInfo)1 DfReplaceSchemaFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfReplaceSchemaFinalInfo)1 DfTakeFinallyProcess (org.dbflute.logic.replaceschema.process.DfTakeFinallyProcess)1