Search in sources :

Example 6 with CheckResultInterface

use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.

the class CheckResultDialog method getData.

/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
    wFields.table.removeAll();
    for (int i = 0; i < remarks.size(); i++) {
        CheckResultInterface cr = remarks.get(i);
        if (show_successful_results || cr.getType() != CheckResultInterface.TYPE_RESULT_OK) {
            TableItem ti = new TableItem(wFields.table, SWT.NONE);
            // MB - Support both JobEntry and Step Checking
            // 6/25/07
            CheckResultSourceInterface sourceMeta = cr.getSourceInfo();
            if (sourceMeta != null) {
                ti.setText(1, sourceMeta.getName());
            } else {
                ti.setText(1, "<global>");
            }
            ti.setText(2, cr.getType() + " - " + cr.getTypeDesc());
            ti.setText(3, cr.getText());
            Color col = ti.getBackground();
            switch(cr.getType()) {
                case CheckResultInterface.TYPE_RESULT_OK:
                    col = green;
                    break;
                case CheckResultInterface.TYPE_RESULT_ERROR:
                    col = red;
                    break;
                case CheckResultInterface.TYPE_RESULT_WARNING:
                    col = yellow;
                    break;
                case CheckResultInterface.TYPE_RESULT_COMMENT:
                default:
                    break;
            }
            ti.setBackground(col);
        }
    }
    if (wFields.table.getItemCount() == 0) {
        wFields.clearAll(false);
    }
    wFields.setRowNums();
    wFields.optWidth(true);
    if (show_successful_results) {
        wlFields.setText(STRING_HIDE_REMARKS);
        wNoOK.setText(STRING_HIDE_SUCESSFUL);
    } else {
        wlFields.setText(STRING_SHOW_REMARKS);
        wNoOK.setText(STRING_SHOW_SUCESSFUL);
    }
    shell.layout();
}
Also used : CheckResultSourceInterface(org.pentaho.di.core.CheckResultSourceInterface) TableItem(org.eclipse.swt.widgets.TableItem) Color(org.eclipse.swt.graphics.Color) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Example 7 with CheckResultInterface

use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.

the class SalesforceDeleteMetaTest method testCheck.

@Test
public void testCheck() {
    SalesforceDeleteMeta meta = new SalesforceDeleteMeta();
    meta.setDefault();
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    meta.check(remarks, null, null, null, null, null, null, null, null, null);
    boolean hasError = false;
    for (CheckResultInterface cr : remarks) {
        if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
            hasError = true;
        }
    }
    assertFalse(remarks.isEmpty());
    assertTrue(hasError);
    remarks.clear();
    meta.setDefault();
    meta.setUsername("user");
    meta.check(remarks, null, null, null, null, null, null, null, null, null);
    hasError = false;
    for (CheckResultInterface cr : remarks) {
        if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
            hasError = true;
        }
    }
    assertFalse(remarks.isEmpty());
    assertFalse(hasError);
}
Also used : ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Example 8 with CheckResultInterface

use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.

the class SalesforceInsertMetaTest method testCheck.

@Test
public void testCheck() {
    SalesforceInsertMeta meta = new SalesforceInsertMeta();
    meta.setDefault();
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    meta.check(remarks, null, null, null, null, null, null, null, null, null);
    boolean hasError = false;
    for (CheckResultInterface cr : remarks) {
        if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
            hasError = true;
        }
    }
    assertFalse(remarks.isEmpty());
    assertTrue(hasError);
    remarks.clear();
    meta.setDefault();
    meta.setUsername("user");
    meta.setUpdateLookup(new String[] { "SalesforceField" });
    meta.setUpdateStream(new String[] { "StreamField" });
    meta.setUseExternalId(new Boolean[] { false });
    meta.check(remarks, null, null, null, null, null, null, null, null, null);
    hasError = false;
    for (CheckResultInterface cr : remarks) {
        if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
            hasError = true;
        }
    }
    assertFalse(remarks.isEmpty());
    assertFalse(hasError);
}
Also used : ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Example 9 with CheckResultInterface

use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.

the class MQTTProducerMetaTest method testCheckOptions.

@Test
public void testCheckOptions() {
    List<CheckResultInterface> remarks = new ArrayList<>();
    MQTTProducerMeta meta = new MQTTProducerMeta();
    meta.setMqttServer("theserver:1883");
    meta.setClientId("client100");
    meta.setTopic("newtopic");
    meta.setQOS("2");
    meta.setMessageField("Messages");
    meta.setUsername("testuser");
    meta.setPassword("test");
    meta.setKeepAliveInterval("1000");
    meta.setMaxInflight("2000");
    meta.setConnectionTimeout("3000");
    meta.setCleanSession("true");
    meta.setStorageLevel("/Users/noname/temp");
    meta.setServerUris("mqttHost2:1883");
    meta.setMqttVersion("3");
    meta.setAutomaticReconnect("true");
    meta.check(remarks, null, null, null, null, null, null, new Variables(), null, null);
    assertEquals(0, remarks.size());
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) Test(org.junit.Test)

Example 10 with CheckResultInterface

use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.

the class SalesforceUpdateMetaTest method testCheck.

@Test
public void testCheck() {
    SalesforceUpdateMeta meta = new SalesforceUpdateMeta();
    meta.setDefault();
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    meta.check(remarks, null, null, null, null, null, null, null, null, null);
    boolean hasError = false;
    for (CheckResultInterface cr : remarks) {
        if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
            hasError = true;
        }
    }
    assertFalse(remarks.isEmpty());
    assertTrue(hasError);
    remarks.clear();
    meta.setDefault();
    meta.setUsername("user");
    meta.setUpdateLookup(new String[] { "SalesforceField" });
    meta.setUpdateStream(new String[] { "StreamField" });
    meta.setUseExternalId(new Boolean[] { false });
    meta.check(remarks, null, null, null, null, null, null, null, null, null);
    hasError = false;
    for (CheckResultInterface cr : remarks) {
        if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
            hasError = true;
        }
    }
    assertFalse(remarks.isEmpty());
    assertFalse(hasError);
}
Also used : ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Aggregations

CheckResultInterface (org.pentaho.di.core.CheckResultInterface)37 ArrayList (java.util.ArrayList)33 Test (org.junit.Test)23 Variables (org.pentaho.di.core.variables.Variables)20 TransMeta (org.pentaho.di.trans.TransMeta)8 StepMeta (org.pentaho.di.trans.step.StepMeta)8 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)7 Repository (org.pentaho.di.repository.Repository)6 IMetaStore (org.pentaho.metastore.api.IMetaStore)6 SalesforceMetaTest (org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest)5 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)4 KettleException (org.pentaho.di.core.exception.KettleException)4 VariableSpace (org.pentaho.di.core.variables.VariableSpace)3 Result (org.pentaho.di.core.Result)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)2 Trans (org.pentaho.di.trans.Trans)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 Throwables (com.google.common.base.Throwables)1