Search in sources :

Example 1 with PipelineUnitTestDatabaseReplacement

use of org.apache.hop.testing.PipelineUnitTestDatabaseReplacement in project hop by apache.

the class PipelineUnitTestEditor method setWidgetsContent.

@Override
public void setWidgetsContent() {
    PipelineUnitTest pipelineUnitTest = this.getMetadata();
    wName.setText(Const.NVL(pipelineUnitTest.getName(), ""));
    wDescription.setText(Const.NVL(pipelineUnitTest.getDescription(), ""));
    wTestType.setText(Const.NVL(DataSetConst.getTestTypeDescription(pipelineUnitTest.getType()), ""));
    wPipelineFilename.setText(Const.NVL(pipelineUnitTest.getPipelineFilename(), ""));
    wFilename.setText(Const.NVL(pipelineUnitTest.getFilename(), ""));
    wBasePath.setText(Const.NVL(pipelineUnitTest.getBasePath(), ""));
    wAutoOpen.setSelection(pipelineUnitTest.isAutoOpening());
    for (int i = 0; i < pipelineUnitTest.getDatabaseReplacements().size(); i++) {
        PipelineUnitTestDatabaseReplacement dbReplacement = pipelineUnitTest.getDatabaseReplacements().get(i);
        wDbReplacements.setText(Const.NVL(dbReplacement.getOriginalDatabaseName(), ""), 1, i);
        wDbReplacements.setText(Const.NVL(dbReplacement.getReplacementDatabaseName(), ""), 2, i);
    }
    for (int i = 0; i < pipelineUnitTest.getVariableValues().size(); i++) {
        VariableValue variableValue = pipelineUnitTest.getVariableValues().get(i);
        wVariableValues.setText(Const.NVL(variableValue.getKey(), ""), 1, i);
        wVariableValues.setText(Const.NVL(variableValue.getValue(), ""), 2, i);
    }
    wDbReplacements.removeEmptyRows();
    wDbReplacements.setRowNums();
}
Also used : VariableValue(org.apache.hop.testing.VariableValue) PipelineUnitTest(org.apache.hop.testing.PipelineUnitTest) PipelineUnitTestDatabaseReplacement(org.apache.hop.testing.PipelineUnitTestDatabaseReplacement)

Example 2 with PipelineUnitTestDatabaseReplacement

use of org.apache.hop.testing.PipelineUnitTestDatabaseReplacement in project hop by apache.

the class PipelineUnitTestEditor method getWidgetsContent.

@Override
public void getWidgetsContent(PipelineUnitTest test) {
    test.setName(wName.getText());
    test.setDescription(wDescription.getText());
    test.setType(DataSetConst.getTestTypeForDescription(wTestType.getText()));
    test.setPipelineFilename(wPipelineFilename.getText());
    test.setFilename(wFilename.getText());
    test.setBasePath(wBasePath.getText());
    test.setAutoOpening(wAutoOpen.getSelection());
    test.getDatabaseReplacements().clear();
    int nrFields = wDbReplacements.nrNonEmpty();
    for (int i = 0; i < nrFields; i++) {
        TableItem item = wDbReplacements.getNonEmpty(i);
        String sourceDb = item.getText(1);
        String replaceDb = item.getText(2);
        PipelineUnitTestDatabaseReplacement dbReplacement = new PipelineUnitTestDatabaseReplacement(sourceDb, replaceDb);
        test.getDatabaseReplacements().add(dbReplacement);
    }
    test.getVariableValues().clear();
    int nrVars = wVariableValues.nrNonEmpty();
    for (int i = 0; i < nrVars; i++) {
        TableItem item = wVariableValues.getNonEmpty(i);
        String key = item.getText(1);
        String value = item.getText(2);
        VariableValue variableValue = new VariableValue(key, value);
        test.getVariableValues().add(variableValue);
    }
}
Also used : VariableValue(org.apache.hop.testing.VariableValue) PipelineUnitTestDatabaseReplacement(org.apache.hop.testing.PipelineUnitTestDatabaseReplacement)

Aggregations

PipelineUnitTestDatabaseReplacement (org.apache.hop.testing.PipelineUnitTestDatabaseReplacement)2 VariableValue (org.apache.hop.testing.VariableValue)2 PipelineUnitTest (org.apache.hop.testing.PipelineUnitTest)1