Search in sources :

Example 1 with LoadSaveTester

use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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();
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) Test(org.junit.Test)

Example 2 with LoadSaveTester

use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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();
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) Test(org.junit.Test)

Example 3 with LoadSaveTester

use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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();
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) ArrayList(java.util.ArrayList) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) BooleanLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Example 4 with LoadSaveTester

use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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();
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) ArrayList(java.util.ArrayList) BooleanLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Example 5 with LoadSaveTester

use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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();
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) ArrayList(java.util.ArrayList) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) BooleanLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Aggregations

LoadSaveTester (org.pentaho.di.trans.steps.loadsave.LoadSaveTester)149 HashMap (java.util.HashMap)144 FieldLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator)128 Before (org.junit.Before)86 StringLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator)81 ArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator)67 Test (org.junit.Test)62 ArrayList (java.util.ArrayList)56 IntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator)34 PrimitiveIntArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator)24 BooleanLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator)21 PrimitiveBooleanArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveBooleanArrayLoadSaveValidator)15 DatabaseMetaLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.DatabaseMetaLoadSaveValidator)12 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)7 SalesforceMetaTest (org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest)5 ObjectIdLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ObjectIdLoadSaveValidator)4 ObjectLocationSpecificationMethodLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ObjectLocationSpecificationMethodLoadSaveValidator)4 Matchers.anyString (org.mockito.Matchers.anyString)3 NonZeroIntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.NonZeroIntLoadSaveValidator)3 YNLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.YNLoadSaveValidator)3