use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class AddXMLMetaTest method loadSaveTest.
@Test
public void loadSaveTest() throws KettleException {
List<String> attributes = Arrays.asList("omitXMLheader", "omitNullValues", "encoding", "valueName", "rootNode", "outputFields");
XMLField xmlField = new XMLField();
xmlField.setFieldName("TEST_FIELD");
xmlField.setType(0);
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorTypeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidatorTypeMap.put(XMLField[].class.getCanonicalName(), new ArrayLoadSaveValidator<>(new XMLFieldLoadSaveValidator(xmlField), 1));
LoadSaveTester tester = new LoadSaveTester(AddXMLMeta.class, attributes, new HashMap<String, String>(), new HashMap<String, String>(), new HashMap<String, FieldLoadSaveValidator<?>>(), fieldLoadSaveValidatorTypeMap);
tester.testRepoRoundTrip();
tester.testXmlRoundTrip();
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class XsdValidatorMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("xdsfilename", "xmlstream", "resultfieldname", "addvalidationmsg", "validationmsgfield", "ifxmlunvalid", "ifxmlvalid", "outputstringfield", "xmlsourcefile", "xsddefinedfield", "xsdsource");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("xdsfilename", "getXSDFilename");
getterMap.put("xmlstream", "getXMLStream");
getterMap.put("resultfieldname", "getResultfieldname");
getterMap.put("addvalidationmsg", "useAddValidationMessage");
getterMap.put("validationmsgfield", "getValidationMessageField");
getterMap.put("ifxmlunvalid", "getIfXmlInvalid");
getterMap.put("ifxmlvalid", "getIfXmlValid");
getterMap.put("outputstringfield", "getOutputStringField");
getterMap.put("xmlsourcefile", "getXMLSourceFile");
getterMap.put("xsddefinedfield", "getXSDDefinedField");
getterMap.put("xsdsource", "getXSDSource");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("xdsfilename", "setXSDfilename");
setterMap.put("xmlstream", "setXMLStream");
setterMap.put("resultfieldname", "setResultfieldname");
setterMap.put("addvalidationmsg", "setAddValidationMessage");
setterMap.put("validationmsgfield", "setValidationMessageField");
setterMap.put("ifxmlunvalid", "setIfXmlInvalid");
setterMap.put("ifxmlvalid", "setIfXMLValid");
setterMap.put("outputstringfield", "setOutputStringField");
setterMap.put("xmlsourcefile", "setXMLSourceFile");
setterMap.put("xsddefinedfield", "setXSDDefinedField");
setterMap.put("xsdsource", "setXSDSource");
LoadSaveTester loadSaveTester = new LoadSaveTester(XsdValidatorMeta.class, attributes, getterMap, setterMap, new HashMap<String, FieldLoadSaveValidator<?>>(), new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class SalesforceDeleteMetaTest method testLoadSave.
@Test
public void testLoadSave() throws KettleException {
List<String> attributes = new ArrayList<String>();
attributes.addAll(SalesforceMetaTest.getDefaultAttributes());
attributes.addAll(Arrays.asList("deleteField", "batchSize", "rollbackAllChangesOnError"));
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidators.put("updateLookup", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("updateStream", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("useExternalId", new ArrayLoadSaveValidator<Boolean>(new BooleanLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(SalesforceDeleteMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidators, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class SalesforceInsertMetaTest method testSalesforceInsertMeta.
@Test
public void testSalesforceInsertMeta() throws KettleException {
List<String> attributes = new ArrayList<String>();
attributes.addAll(SalesforceMetaTest.getDefaultAttributes());
attributes.addAll(Arrays.asList("batchSize", "salesforceIDFieldName", "updateLookup", "updateStream", "useExternalId", "rollbackAllChangesOnError"));
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidators.put("updateLookup", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("updateStream", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("useExternalId", new ArrayLoadSaveValidator<Boolean>(new BooleanLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(SalesforceInsertMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidators, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class SalesforceUpdateMetaTest method testSalesforceUpdateMeta.
@Test
public void testSalesforceUpdateMeta() throws KettleException {
List<String> attributes = new ArrayList<String>();
attributes.addAll(SalesforceMetaTest.getDefaultAttributes());
attributes.addAll(Arrays.asList("batchSize", "updateLookup", "updateStream", "useExternalId", "rollbackAllChangesOnError"));
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidators.put("updateLookup", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("updateStream", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("useExternalId", new ArrayLoadSaveValidator<Boolean>(new BooleanLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(SalesforceUpdateMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidators, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
Aggregations