Search in sources :

Example 1 with DefaultFieldErrorHandler

use of com.qlangtech.tis.runtime.module.misc.impl.DefaultFieldErrorHandler in project plugins by qlangtech.

the class DataXFtpReader method getSelectedTabs.

@Override
public List<ParseColsResult.DataXReaderTabMeta> getSelectedTabs() {
    DefaultContext context = new DefaultContext();
    ParseColsResult parseColsResult = ParseColsResult.parseColsCfg(new DefaultFieldErrorHandler(), context, StringUtils.EMPTY, this.column);
    if (!parseColsResult.success) {
        throw new IllegalStateException("parseColsResult must be success");
    }
    return Collections.singletonList(parseColsResult.tabMeta);
}
Also used : DefaultContext(com.alibaba.citrus.turbine.impl.DefaultContext) DefaultFieldErrorHandler(com.qlangtech.tis.runtime.module.misc.impl.DefaultFieldErrorHandler)

Example 2 with DefaultFieldErrorHandler

use of com.qlangtech.tis.runtime.module.misc.impl.DefaultFieldErrorHandler in project tis by qlangtech.

the class TestValidator method testValidateIdentity.

public void testValidateIdentity() {
    Validator identityValidator = Validator.identity;
    DefaultFieldErrorHandler fEHandler = new DefaultFieldErrorHandler();
    DefaultContext context = new DefaultContext();
    context.put(DefaultFieldErrorHandler.KEY_VALIDATE_PLUGIN_INDEX, new Integer(2));
    assertTrue("error shall none error", identityValidator.validate(fEHandler, context, field1Name, "base123"));
    assertFalse(identityValidator.validate(fEHandler, context, field1Name, "_base123"));
    List<List<List<DefaultFieldErrorHandler.FieldError>>> pluginErrorList = (List<List<List<DefaultFieldErrorHandler.FieldError>>>) context.get(IFieldErrorHandler.ACTION_ERROR_FIELDS);
    assertEquals(3, pluginErrorList.size());
    DefaultFieldErrorHandler.FieldError fError = pluginErrorList.get(2).get(0).get(0);
    assertEquals(field1Name, fError.getFieldName());
    assertEquals(ValidatorCommons.MSG_IDENTITY_ERROR, fError.getMsg());
    assertNull(fError.itemsErrorList);
}
Also used : List(java.util.List) DefaultContext(com.alibaba.citrus.turbine.impl.DefaultContext) DefaultFieldErrorHandler(com.qlangtech.tis.runtime.module.misc.impl.DefaultFieldErrorHandler)

Aggregations

DefaultContext (com.alibaba.citrus.turbine.impl.DefaultContext)2 DefaultFieldErrorHandler (com.qlangtech.tis.runtime.module.misc.impl.DefaultFieldErrorHandler)2 List (java.util.List)1