Search in sources :

Example 1 with DfXlsDataHandlerImpl

use of org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl in project dbflute-core by dbflute.

the class DfXlsDataHandlerImplTest method test_processBoolean.

// -----------------------------------------------------
// Boolean
// -------
public void test_processBoolean() throws Exception {
    // ## Arrange ##
    final DfXlsDataHandlerImpl impl = new DfXlsDataHandlerImpl(null, null) {

        @Override
        protected Class<?> getBindType(String tableName, DfColumnMeta columnMetaInfo) {
            return BigDecimal.class;
        }
    };
    Map<String, DfColumnMeta> columnMetaInfoMap = StringKeyMap.createAsCaseInsensitive();
    DfColumnMeta info = new DfColumnMeta();
    info.setColumnName("foo");
    info.setColumnSize(3);
    info.setJdbcDefValue(Types.NUMERIC);
    columnMetaInfoMap.put("foo", info);
    // ## Act ##
    boolean actual = impl.processBoolean("tbl", "foo", "0", null, null, 0, columnMetaInfoMap, 3);
    // ## Assert ##
    log("actual=" + actual);
    assertFalse(actual);
}
Also used : DfColumnMeta(org.dbflute.logic.jdbc.metadata.info.DfColumnMeta) DfXlsDataHandlerImpl(org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl) BigDecimal(java.math.BigDecimal)

Example 2 with DfXlsDataHandlerImpl

use of org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl in project dbflute-core by dbflute.

the class DfXlsDataHandlerImplTest method test_DfXlsDataHandlerImpl_isNotNullNotString.

// ===================================================================================
// Process per Type
// ================
// -----------------------------------------------------
// NotNull NotString
// -----------------
public void test_DfXlsDataHandlerImpl_isNotNullNotString() {
    // ## Arrange ##
    final DfXlsDataHandlerImpl impl = createHandler();
    // ## Act & Assert ##
    assertFalse(impl.isNotNullNotString(null));
    assertFalse(impl.isNotNullNotString("abc"));
    assertTrue(impl.isNotNullNotString(new Date()));
    assertTrue(impl.isNotNullNotString(new Timestamp(System.currentTimeMillis())));
}
Also used : Timestamp(java.sql.Timestamp) DfXlsDataHandlerImpl(org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl) Date(java.util.Date)

Example 3 with DfXlsDataHandlerImpl

use of org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl in project dbflute-core by dbflute.

the class DfXlsDataHandlerImplTest method test_DfXlsDataHandlerImpl_setSkipSheet_SyntaxError.

// ===================================================================================
// Skip Sheet
// ==========
public void test_DfXlsDataHandlerImpl_setSkipSheet_SyntaxError() {
    // ## Arrange ##
    final DfXlsDataHandlerImpl impl = createHandler();
    // ## Act & Assert ##
    try {
        impl.setSkipSheet("MST.*+`*`+*P*`+*}+");
        fail();
    } catch (IllegalStateException e) {
        // OK
        log(e.getMessage());
        assertNotNull(e.getCause());
        log(e.getCause().getMessage());
        assertTrue(e.getCause() instanceof PatternSyntaxException);
    }
}
Also used : DfXlsDataHandlerImpl(org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Aggregations

DfXlsDataHandlerImpl (org.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl)3 BigDecimal (java.math.BigDecimal)1 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)1