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);
}
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);
}
Aggregations