use of org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult in project dbflute-core by dbflute.
the class DfAlterCheckProcess method executeAlterSql.
// -----------------------------------------------------
// Alter Fire
// ----------
protected void executeAlterSql(DfAlterCheckFinalInfo finalInfo) {
List<File> alterSqlFileList = getMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
restoreLatestCheckedAlterSql();
alterSqlFileList = getMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
createEmptyAlterSqlFileIfNotExists();
alterSqlFileList = getMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
// no way
throwAlterCheckAlterSqlNotFoundException();
}
}
}
final DfRunnerInformation runInfo = createRunnerInformation();
final DfSqlFileFireMan fireMan = createSqlFileFireMan();
fireMan.setExecutorName("Alter Schema");
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.helper.jdbc.sqlfile.DfSqlFileFireResult in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method takeFinally.
// ===================================================================================
// Take Finally
// ============
protected DfSqlFileFireResult takeFinally(DfRunnerInformation runInfo) {
_log.info("");
_log.info("* * * * * * * **");
_log.info("* *");
_log.info("* Take Finally *");
_log.info("* *");
_log.info("* * * * * * * **");
final DfSqlFileFireMan fireMan = createSqlFileFireMan();
final DfSqlFileFireResult result = fireMan.fire(getSqlFileRunner4TakeFinally(runInfo), getTakeFinallySqlFileList());
conventionalTakeAssertIfNeeds();
return result;
}
use of org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult in project dbflute-core by dbflute.
the class DfOutsideSqlTestTask method buildFinalMessage.
protected String buildFinalMessage() {
if (_fireResult == null) {
return null;
}
final DfSqlFileFireResult fireResult = _fireResult;
int countOK = 0;
int countSkipped = 0;
int countFailure = 0;
final StringBuilder sb = new StringBuilder();
sb.append(" {Checked SQL}");
final List<DfSqlFileRunnerResult> runnerResultList = fireResult.getRunnerResultList();
for (DfSqlFileRunnerResult runnerResult : runnerResultList) {
final File sqlFile = runnerResult.getSqlFile();
final List<ErrorContinuedSql> continuedSqlList = runnerResult.getErrorContinuedSqlList();
sb.append(ln());
if (continuedSqlList.isEmpty()) {
if (_nonTargetSqlFileSet.contains(sqlFile)) {
// accurately 'v' means the SQL file may have skipped SQLs
// however SQL file for OutsideSqlTest has only one SQL normally
sb.append(" v ");
++countSkipped;
} else {
sb.append(" o ");
++countOK;
}
} else {
// you can say same as 'v'
// (anyway, look at the log for detail)
sb.append(" x ");
++countFailure;
}
sb.append(sqlFile.getName());
for (ErrorContinuedSql errorContinuedSql : continuedSqlList) {
final SQLException sqlEx = errorContinuedSql.getSqlEx();
String sqlMsg = sqlEx.getMessage();
if (sqlMsg != null) {
sqlMsg = sqlMsg.trim();
if (sqlMsg.contains(ln())) {
sqlMsg = Srl.substringFirstFront(sqlMsg, ln()).trim() + "...";
}
}
sb.append(ln()).append(" -> ").append(sqlMsg);
}
}
if (!runnerResultList.isEmpty()) {
sb.append(ln());
sb.append(ln()).append(" o: OK (").append(countOK).append(")");
if (countSkipped > 0) {
sb.append(ln()).append(" v: Skipped exists (").append(countSkipped).append(")");
}
if (countFailure > 0) {
sb.append(ln()).append(" x: Failure exists (").append(countFailure).append(")");
}
}
return sb.toString();
}
Aggregations