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 RowGeneratorMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("neverEnding", "intervalInMs", "rowTimeField", "lastTimeField", "rowLimit", "currency", "decimal", "group", "value", "fieldName", "fieldType", "fieldFormat", "fieldLength", "fieldPrecision");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("neverEnding", "isNeverEnding");
put("intervalInMs", "getIntervalInMs");
put("rowTimeField", "getRowTimeField");
put("lastTimeField", "getLastTimeField");
put("rowLimit", "getRowLimit");
put("currency", "getCurrency");
put("decimal", "getDecimal");
put("group", "getGroup");
put("value", "getValue");
put("fieldName", "getFieldName");
put("fieldType", "getFieldType");
put("fieldFormat", "getFieldFormat");
put("fieldLength", "getFieldLength");
put("fieldPrecision", "getFieldPrecision");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("neverEnding", "setNeverEnding");
put("intervalInMs", "setIntervalInMs");
put("rowTimeField", "setRowTimeField");
put("lastTimeField", "setLastTimeField");
put("rowLimit", "setRowLimit");
put("currency", "setCurrency");
put("decimal", "setDecimal");
put("group", "setGroup");
put("value", "setValue");
put("fieldName", "setFieldName");
put("fieldType", "setFieldType");
put("fieldFormat", "setFieldFormat");
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("currency", stringArrayLoadSaveValidator);
attrValidatorMap.put("decimal", stringArrayLoadSaveValidator);
attrValidatorMap.put("group", stringArrayLoadSaveValidator);
attrValidatorMap.put("value", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldType", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldFormat", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldLength", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(100), 5));
attrValidatorMap.put("fieldPrecision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(9), 5));
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 RowsFromResultMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldname", "type", "length", "precision");
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("fieldname", stringArrayLoadSaveValidator);
attrValidatorMap.put("type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(7), 5));
attrValidatorMap.put("length", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(100), 5));
attrValidatorMap.put("precision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(9), 5));
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 ScriptMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldname", "rename", "type", "length", "precision", "replace", "jsScripts");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fieldname", "getFieldname");
put("rename", "getRename");
put("type", "getType");
put("length", "getLength");
put("precision", "getPrecision");
put("replace", "getReplace");
put("jsScripts", "getJSScripts");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fieldname", "setFieldname");
put("rename", "setRename");
put("type", "setType");
put("length", "setLength");
put("precision", "setPrecision");
put("replace", "setReplace");
put("jsScripts", "setJSScripts");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<ScriptValuesScript[]> svsArrayLoadSaveValidator = new ArrayLoadSaveValidator<ScriptValuesScript>(new ScriptValuesScriptLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldname", stringArrayLoadSaveValidator);
attrValidatorMap.put("rename", stringArrayLoadSaveValidator);
attrValidatorMap.put("type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(9), 5));
attrValidatorMap.put("length", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(100), 5));
attrValidatorMap.put("precision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(6), 5));
attrValidatorMap.put("replace", new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 5));
attrValidatorMap.put("jsScripts", svsArrayLoadSaveValidator);
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 ScriptValuesMetaModTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldname", "rename", "type", "length", "precision", "replace", "jsScripts", "compatible", "optimizationLevel");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fieldname", "getFieldname");
put("rename", "getRename");
put("type", "getType");
put("length", "getLength");
put("precision", "getPrecision");
put("replace", "getReplace");
put("compatible", "isCompatible");
put("optimizationLevel", "getOptimizationLevel");
put("jsScripts", "getJSScripts");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fieldname", "setFieldname");
put("rename", "setRename");
put("type", "setType");
put("length", "setLength");
put("precision", "setPrecision");
put("replace", "setReplace");
put("compatible", "setCompatible");
put("optimizationLevel", "setOptimizationLevel");
put("jsScripts", "setJSScripts");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<ScriptValuesScript[]> svsArrayLoadSaveValidator = new ArrayLoadSaveValidator<ScriptValuesScript>(new ScriptValuesScriptLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldname", stringArrayLoadSaveValidator);
attrValidatorMap.put("rename", stringArrayLoadSaveValidator);
attrValidatorMap.put("type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(9), 5));
attrValidatorMap.put("length", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(100), 5));
attrValidatorMap.put("precision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(6), 5));
attrValidatorMap.put("replace", new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 5));
attrValidatorMap.put("jsScripts", svsArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Aggregations