Search in sources :

Example 6 with DfOutsideSqlChecker

use of org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker in project dbflute-core by dbflute.

the class OutsideSqlCheckerTest method test_check_ifCommentExpression_unsupported.

public void test_check_ifCommentExpression_unsupported() {
    // ## Arrange ##
    DfOutsideSqlChecker ker = new DfOutsideSqlChecker();
    String fn = "test.sql";
    // ## Act & Assert ##
    try {
        ker.check(fn, "/*IF (pmb.memberId != null && pmb.memberName != null) || pmb.exists*/bar/*END*/");
    } catch (IfCommentUnsupportedExpressionException e) {
        // OK
        log(e.getMessage());
    }
    try {
        ker.check(fn, "/*IF pmb.memberId != null && pmb.memberName != null || pmb.exists*/bar/*END*/");
    } catch (IfCommentUnsupportedExpressionException e) {
        // OK
        log(e.getMessage());
    }
    try {
        ker.check(fn, "/*IF pmb.memberId = null && pmb.memberName != null*/bar/*END*/");
    } catch (IfCommentUnsupportedExpressionException e) {
        // OK
        log(e.getMessage());
    }
    try {
        ker.check(fn, "/*IF pmb.memberId <> null && pmb.memberName != null*/bar/*END*/");
    } catch (IfCommentUnsupportedExpressionException e) {
        // OK
        log(e.getMessage());
    }
    try {
        ker.check(fn, "/*IF pmb.memberName == \"abc\"*/bar/*END*/");
    } catch (IfCommentUnsupportedExpressionException e) {
        // OK
        log(e.getMessage());
    }
}
Also used : IfCommentUnsupportedExpressionException(org.dbflute.twowaysql.exception.IfCommentUnsupportedExpressionException) DfOutsideSqlChecker(org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)

Example 7 with DfOutsideSqlChecker

use of org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker in project dbflute-core by dbflute.

the class OutsideSqlCheckerTest method test_check_ifCommentExpression_basic.

public void test_check_ifCommentExpression_basic() {
    // ## Arrange ##
    DfOutsideSqlChecker ker = new DfOutsideSqlChecker();
    String fn = "test.sql";
    // ## Act & Assert ##
    ker.check(fn, "/*IF pmb.memberId != null && pmb.memberName != null*/bar/*END*/");
    ker.check(fn, "/*IF pmb.memberId != null || pmb.memberName != null*/bar/*END*/");
    ker.check(fn, "/*IF pmb.getMemberId() != null || pmb.memberName != null*/bar/*END*/");
}
Also used : DfOutsideSqlChecker(org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)

Example 8 with DfOutsideSqlChecker

use of org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker in project dbflute-core by dbflute.

the class DfOutsideSqlTestTask method createOutsideSqlChecker.

protected DfOutsideSqlChecker createOutsideSqlChecker(DfOutsideSqlProperties outsideSqlProp) {
    final DfOutsideSqlChecker checker = new DfOutsideSqlChecker();
    if (outsideSqlProp.isRequiredSqlTitle()) {
        checker.enableRequiredTitleCheck();
    }
    if (outsideSqlProp.isSuppressSqlTitleUniqueCheck()) {
        checker.suppressTitleUniqueCheck();
    }
    if (outsideSqlProp.isRequiredSqlDescription()) {
        checker.enableRequiredDescriptionCheck();
    }
    if (outsideSqlProp.isSuppressSqlDescriptionUniqueCheck()) {
        checker.suppressDescriptionUniqueCheck();
    }
    final DfLanguageImplStyle languageImplStyle = getBasicProperties().getLanguageDependency().getLanguageImplStyle();
    if (languageImplStyle.isIfCommentExpressionCheckEnabled()) {
        // might be different specification between language
        checker.enableIfCommentExpressionCheck();
    }
    return checker;
}
Also used : DfOutsideSqlChecker(org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Aggregations

DfOutsideSqlChecker (org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)8 File (java.io.File)1 DBDef (org.dbflute.dbway.DBDef)1 DfCustomizeEntityMarkInvalidException (org.dbflute.exception.DfCustomizeEntityMarkInvalidException)1 DfParameterBeanMarkInvalidException (org.dbflute.exception.DfParameterBeanMarkInvalidException)1 DfSqlFileRunnerExecute (org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunnerExecute)1 DfLanguageImplStyle (org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)1 DfOutsideSqlProperties (org.dbflute.properties.DfOutsideSqlProperties)1 DfSpecifiedSqlFile (org.dbflute.task.bs.assistant.DfSpecifiedSqlFile)1 EndCommentNotFoundException (org.dbflute.twowaysql.exception.EndCommentNotFoundException)1 IfCommentConditionEmptyException (org.dbflute.twowaysql.exception.IfCommentConditionEmptyException)1 IfCommentUnsupportedExpressionException (org.dbflute.twowaysql.exception.IfCommentUnsupportedExpressionException)1 ScopeInfo (org.dbflute.util.Srl.ScopeInfo)1