use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class JobEntryPGPEncryptFilesLoadSaveTest method createAttributeValidatorsMap.
@Override
protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() {
Map<String, FieldLoadSaveValidator<?>> validators = new HashMap<String, FieldLoadSaveValidator<?>>();
int count = new Random().nextInt(50) + 1;
validators.put("action_type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(JobEntryPGPEncryptFiles.actionTypeCodes.length), count));
validators.put("source_filefolder", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("userid", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("destination_filefolder", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("wildcard", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
return validators;
}
use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class DatabaseLookupMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("schemaName", "tablename", "databaseMeta", "orderByClause", "cached", "cacheSize", "loadingAllDataInCache", "failingOnMultipleResults", "eatingRowOnLookupFailure", "streamKeyField1", "streamKeyField2", "keyCondition", "tableKeyField", "returnValueField", "returnValueNewName", "returnValueDefault", "returnValueDefaultType");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("streamKeyField1", stringArrayLoadSaveValidator);
attrValidatorMap.put("streamKeyField2", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyCondition", stringArrayLoadSaveValidator);
attrValidatorMap.put("tableKeyField", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueField", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueNewName", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueDefault", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueDefaultType", new PrimitiveIntArrayLoadSaveValidator(new NonZeroIntLoadSaveValidator(7), 5));
attrValidatorMap.put("databaseMeta", new DatabaseMetaLoadSaveValidator());
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class GaInputStepMetaTest method testSerialization.
@Test
public void testSerialization() throws KettleException {
List<String> attributes = Arrays.asList("OAuthServiceAccount", "GaAppName", "OAuthKeyFile", "GaProfileName", "GaProfileTableId", "GaCustomTableId", "UseCustomTableId", "StartDate", "EndDate", "Dimensions", "Metrics", "Filters", "Sort", "UseSegment", "UseCustomSegment", "CustomSegment", "SegmentId", "SegmentName", "SamplingLevel", "RowLimit", "FeedFieldType", "FeedField", "OutputField", "OutputType", "ConversionMask");
Map<String, FieldLoadSaveValidator<?>> attributeMap = new HashMap<>();
Map<String, FieldLoadSaveValidator<?>> typeMap = new HashMap<>();
int maxValueCount = ValueMetaFactory.getAllValueMetaNames().length;
attributeMap.put("FeedField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
attributeMap.put("FeedFieldType", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
attributeMap.put("OutputField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
attributeMap.put("OutputType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(maxValueCount), 25));
attributeMap.put("ConversionMask", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
LoadSaveTester<GaInputStepMeta> tester = new LoadSaveTester<>(GaInputStepMeta.class, attributes, new HashMap<String, String>(), new HashMap<String, String>(), attributeMap, typeMap);
tester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class AnalyticQueryMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("groupField", "aggregateField", "subjectField", "aggregateType", "valueField");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> typeValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
Map<String, FieldLoadSaveValidator<?>> fieldValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldValidators.put("aggregateField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldValidators.put("subjectField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldValidators.put("aggregateType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(AnalyticQueryMeta.typeGroupCode.length), 50));
fieldValidators.put("valueField", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(AnalyticQueryMeta.class, attributes, getterMap, setterMap, fieldValidators, typeValidators);
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class MappingInputMetaCloningTest method setUp.
@Before
public void setUp() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("selectingAndSortingUnspecifiedFields", "fieldName", "fieldType", "fieldLength", "fieldPrecision");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("selectingAndSortingUnspecifiedFields", "isSelectingAndSortingUnspecifiedFields");
put("fieldName", "getFieldName");
put("fieldType", "getFieldType");
put("fieldLength", "getFieldLength");
put("fieldPrecision", "getFieldPrecision");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("selectingAndSortingUnspecifiedFields", "setSelectingAndSortingUnspecifiedFields");
put("fieldName", "setFieldName");
put("fieldType", "setFieldType");
put("fieldLength", "setFieldLength");
put("fieldPrecision", "setFieldPrecision");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
typeValidatorMap.put(int[].class.getCanonicalName(), new PrimitiveIntArrayLoadSaveValidator(new NonZeroIntLoadSaveValidator(6), 5));
loadSaveTester = new LoadSaveTester<MappingInputMeta>(MappingInputMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Aggregations