Search in sources :

Example 41 with StringLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator 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 42 with StringLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.

the class SecretKeyGeneratorMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("algorithm", "scheme", "secretKeyLength", "secretKeyCount", "secretKeyFieldName", "secretKeyLengthFieldName", "algorithmFieldName", "outputKeyInBinary");
    Map<String, String> getterMap = new HashMap<String, String>() {

        {
            put("algorithm", "getAlgorithm");
            put("scheme", "getScheme");
            put("secretKeyLength", "getSecretKeyLength");
            put("secretKeyCount", "getSecretKeyCount");
            put("secretKeyFieldName", "getSecretKeyFieldName");
            put("secretKeyLengthFieldName", "getSecretKeyLengthFieldName");
            put("algorithmFieldName", "getAlgorithmFieldName");
            put("outputKeyInBinary", "isOutputKeyInBinary");
        }
    };
    Map<String, String> setterMap = new HashMap<String, String>() {

        {
            put("algorithm", "setFieldAlgorithm");
            put("scheme", "setScheme");
            put("secretKeyLength", "setSecretKeyLength");
            put("secretKeyCount", "setSecretKeyCount");
            put("secretKeyFieldName", "setSecretKeyFieldName");
            put("secretKeyLengthFieldName", "setSecretKeyLengthFieldName");
            put("algorithmFieldName", "setAlgorithmFieldName");
            put("outputKeyInBinary", "setOutputKeyInBinary");
        }
    };
    FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("algorithm", stringArrayLoadSaveValidator);
    attrValidatorMap.put("scheme", stringArrayLoadSaveValidator);
    attrValidatorMap.put("secretKeyLength", stringArrayLoadSaveValidator);
    attrValidatorMap.put("secretKeyCount", stringArrayLoadSaveValidator);
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) 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) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Before(org.junit.Before)

Example 43 with StringLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.

the class TableOutputMetaLoadSaveTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("databaseMeta", "schemaName", "tableName", "commitSize", "truncateTable", "ignoreErrors", "useBatchUpdate", "partitioningEnabled", "partitioningField", "partitioningDaily", "partitioningMonthly", "tableNameInField", "tableNameField", "tableNameInTable", "returningGeneratedKeys", "generatedKeyField", "specifyFields", "fieldStream", "fieldDatabase");
    Map<String, String> getterMap = new HashMap<String, String>() {

        {
            put("truncateTable", "truncateTable");
            put("ignoreErrors", "ignoreErrors");
            put("useBatchUpdate", "useBatchUpdate");
            put("specifyFields", "specifyFields");
        }
    };
    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("fieldStream", stringArrayLoadSaveValidator);
    attrValidatorMap.put("fieldDatabase", stringArrayLoadSaveValidator);
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) 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) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Before(org.junit.Before)

Example 44 with StringLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.

the class TransExecutorMetaTest method setUp.

@Before
public void setUp() throws Exception {
    List<String> attributes = Arrays.asList("fileName", "transName", "directoryPath", "groupSize", "groupField", "groupTime", "executionTimeField", "executionFilesRetrievedField", "executionLogTextField", "executionLogChannelIdField", "executionResultField", "executionNrErrorsField", "executionLinesReadField", "executionLinesWrittenField", "executionLinesInputField", "executionLinesOutputField", "executionLinesRejectedField", "executionLinesUpdatedField", "executionLinesDeletedField", "executionExitStatusField", "outputRowsField", "outputRowsType", "outputRowsLength", "outputRowsPrecision");
    // executionResultTargetStepMeta -? (see for switch case meta)
    Map<String, String> getterMap = new HashMap<String, String>();
    Map<String, String> setterMap = new HashMap<String, String>();
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 1);
    // don't want the random value given by the default getTestObject...
    IntLoadSaveValidator intValidator = spy(new IntLoadSaveValidator());
    doReturn(ValueMetaInterface.TYPE_INTEGER).when(intValidator).getTestObject();
    FieldLoadSaveValidator<int[]> intArrayLoadSaveValidator = new PrimitiveIntArrayLoadSaveValidator(intValidator, 1);
    attrValidatorMap.put("outputRowsField", stringArrayLoadSaveValidator);
    attrValidatorMap.put("outputRowsType", intArrayLoadSaveValidator);
    attrValidatorMap.put("outputRowsLength", intArrayLoadSaveValidator);
    attrValidatorMap.put("outputRowsPrecision", intArrayLoadSaveValidator);
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    typeValidatorMap.put(int[].class.getCanonicalName(), new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 1));
    loadSaveTester = new LoadSaveTester(TransExecutorMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) PrimitiveIntArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator) IntLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) Mockito.anyString(org.mockito.Mockito.anyString) PrimitiveIntArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Before(org.junit.Before)

Example 45 with StringLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.

the class SynchronizeAfterMergeMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("schemaName", "tableName", "databaseMeta", "commitSize", "tableNameInField", "tablenameField", "operationOrderField", "useBatchUpdate", "performLookup", "OrderInsert", "OrderUpdate", "OrderDelete", "keyStream", "keyLookup", "keyCondition", "keyStream2", "updateLookup", "updateStream", "update");
    Map<String, String> getterMap = new HashMap<String, String>() {

        {
            put("tableNameInField", "istablenameInField");
            put("tablenameField", "gettablenameField");
            put("useBatchUpdate", "useBatchUpdate");
        }
    };
    Map<String, String> setterMap = new HashMap<String, String>() {

        {
            put("tableNameInField", "settablenameInField");
            put("tablenameField", "settablenameField");
        }
    };
    FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("keyStream", stringArrayLoadSaveValidator);
    attrValidatorMap.put("keyStream2", stringArrayLoadSaveValidator);
    attrValidatorMap.put("keyLookup", stringArrayLoadSaveValidator);
    attrValidatorMap.put("keyCondition", stringArrayLoadSaveValidator);
    attrValidatorMap.put("updateLookup", stringArrayLoadSaveValidator);
    attrValidatorMap.put("updateStream", stringArrayLoadSaveValidator);
    attrValidatorMap.put("update", new ArrayLoadSaveValidator<Boolean>(new BooleanLoadSaveValidator(), 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);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) 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) Before(org.junit.Before)

Aggregations

StringLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator)91 HashMap (java.util.HashMap)89 FieldLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator)89 LoadSaveTester (org.pentaho.di.trans.steps.loadsave.LoadSaveTester)80 ArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator)68 Before (org.junit.Before)59 ArrayList (java.util.ArrayList)49 IntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator)31 PrimitiveIntArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator)30 Test (org.junit.Test)26 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)8 Random (java.util.Random)6 NonZeroIntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.NonZeroIntLoadSaveValidator)4 SalesforceMetaTest (org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest)4 YNLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.YNLoadSaveValidator)3 Matchers.anyString (org.mockito.Matchers.anyString)2 Mockito.anyString (org.mockito.Mockito.anyString)2