use of org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator in project pentaho-kettle by pentaho.
the class SortedMergeMetaTest method testRoundTrips.
@Test
public void testRoundTrips() throws KettleException {
List<String> attributes = Arrays.asList("name", "ascending");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("name", "getFieldName");
getterMap.put("ascending", "getAscending");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("name", "setFieldName");
setterMap.put("ascending", "setAscending");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25);
FieldLoadSaveValidator<boolean[]> booleanArrayLoadSaveValidator = new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 25);
fieldLoadSaveValidatorAttributeMap.put("name", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("ascending", booleanArrayLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(SortedMergeMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator in project pentaho-kettle by pentaho.
the class FieldSplitterMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("splitfield", "delimiter", "enclosure", "name", "id", "idrem", "type", "format", "group", "decimal", "currency", "length", "precision", "nullif", "ifnull", "trimtype");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("splitfield", "getSplitField");
getterMap.put("delimiter", "getDelimiter");
getterMap.put("enclosure", "getEnclosure");
getterMap.put("name", "getFieldName");
getterMap.put("id", "getFieldID");
getterMap.put("idrem", "getFieldRemoveID");
getterMap.put("type", "getFieldType");
getterMap.put("format", "getFieldFormat");
getterMap.put("group", "getFieldGroup");
getterMap.put("decimal", "getFieldDecimal");
getterMap.put("currency", "getFieldCurrency");
getterMap.put("length", "getFieldLength");
getterMap.put("precision", "getFieldPrecision");
getterMap.put("nullif", "getFieldNullIf");
getterMap.put("ifnull", "getFieldIfNull");
getterMap.put("trimtype", "getFieldTrimType");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("splitfield", "setSplitField");
setterMap.put("delimiter", "setDelimiter");
setterMap.put("enclosure", "setEnclosure");
setterMap.put("name", "setFieldName");
setterMap.put("id", "setFieldID");
setterMap.put("idrem", "setFieldRemoveID");
setterMap.put("type", "setFieldType");
setterMap.put("format", "setFieldFormat");
setterMap.put("group", "setFieldGroup");
setterMap.put("decimal", "setFieldDecimal");
setterMap.put("currency", "setFieldCurrency");
setterMap.put("length", "setFieldLength");
setterMap.put("precision", "setFieldPrecision");
setterMap.put("nullif", "setFieldNullIf");
setterMap.put("ifnull", "setFieldIfNull");
setterMap.put("trimtype", "setFieldTrimType");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidatorAttributeMap.put("name", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("id", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("idrem", new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(ValueMetaFactory.getAllValueMetaNames().length), 5));
fieldLoadSaveValidatorAttributeMap.put("format", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("group", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("decimal", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("currency", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("length", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("precision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("nullif", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("ifnull", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("trimtype", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(ValueMetaBase.getTrimTypeCodes().length), 5));
LoadSaveTester loadSaveTester = new LoadSaveTester(FieldSplitterMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator 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.BooleanLoadSaveValidator 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();
}
use of org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator 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();
}
Aggregations