Search in sources :

Example 21 with CheckResultInterface

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

the class JobEntryCreateFile method main.

public static void main(String[] args) {
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    new JobEntryCreateFile().check(remarks, null, new Variables(), null, null);
    System.out.printf("Remarks: %s\n", remarks);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Example 22 with CheckResultInterface

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

the class JobEntryDeleteFile method main.

public static void main(String[] args) {
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    new JobEntryDeleteFile().check(remarks, null, new Variables(), null, null);
    System.out.printf("Remarks: %s\n", remarks);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Example 23 with CheckResultInterface

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

the class TransMetaTest method testTransWithOneStepIsConsideredUsed.

@Test
public void testTransWithOneStepIsConsideredUsed() throws Exception {
    TransMeta transMeta = new TransMeta(getClass().getResource("one-step-trans.ktr").getPath());
    assertEquals(1, transMeta.getUsedSteps().size());
    Repository rep = mock(Repository.class);
    ProgressMonitorListener monitor = mock(ProgressMonitorListener.class);
    List<CheckResultInterface> remarks = new ArrayList<>();
    IMetaStore metaStore = mock(IMetaStore.class);
    transMeta.checkSteps(remarks, false, monitor, new Variables(), rep, metaStore);
    assertEquals(4, remarks.size());
    for (CheckResultInterface remark : remarks) {
        assertEquals(CheckResultInterface.TYPE_RESULT_OK, remark.getType());
    }
}
Also used : Variables(org.pentaho.di.core.variables.Variables) Repository(org.pentaho.di.repository.Repository) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) ProgressMonitorListener(org.pentaho.di.core.ProgressMonitorListener) IMetaStore(org.pentaho.metastore.api.IMetaStore) Test(org.junit.Test)

Example 24 with CheckResultInterface

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

the class UnivariateStatsMetaTest method testCheckEmptyPrev.

@Test
public void testCheckEmptyPrev() {
    UnivariateStatsMeta meta = new UnivariateStatsMeta();
    RowMetaInterface mockRowMetaInterface = mock(RowMetaInterface.class);
    when(mockRowMetaInterface.size()).thenReturn(0);
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    meta.check(remarks, null, null, mockRowMetaInterface, new String[0], null, null, null, null, null);
    assertEquals(2, remarks.size());
    assertEquals("Not receiving any fields from previous steps!", remarks.get(0).getText());
}
Also used : ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) Test(org.junit.Test)

Example 25 with CheckResultInterface

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

the class WebServiceMetaTest method testCheck.

@Test
public void testCheck() throws Exception {
    WebServiceMeta webServiceMeta = new WebServiceMeta();
    TransMeta transMeta = mock(TransMeta.class);
    StepMeta stepMeta = mock(StepMeta.class);
    RowMetaInterface prev = mock(RowMetaInterface.class);
    RowMetaInterface info = mock(RowMetaInterface.class);
    Repository rep = mock(Repository.class);
    IMetaStore metastore = mock(IMetaStore.class);
    String[] input = { "one" };
    ArrayList<CheckResultInterface> remarks = new ArrayList<>();
    webServiceMeta.check(remarks, transMeta, stepMeta, null, input, null, info, new Variables(), rep, metastore);
    assertEquals(2, remarks.size());
    assertEquals("Not receiving any fields from previous steps!", remarks.get(0).getText());
    assertEquals("Step is receiving info from other steps.", remarks.get(1).getText());
    remarks.clear();
    webServiceMeta.setInFieldArgumentName("ifan");
    when(prev.size()).thenReturn(2);
    webServiceMeta.check(remarks, transMeta, stepMeta, prev, new String[] {}, null, info, new Variables(), rep, metastore);
    assertEquals(2, remarks.size());
    assertEquals("Step is connected to previous one, receiving 2 fields", remarks.get(0).getText());
    assertEquals("No input received from other steps!", remarks.get(1).getText());
}
Also used : Variables(org.pentaho.di.core.variables.Variables) Repository(org.pentaho.di.repository.Repository) TransMeta(org.pentaho.di.trans.TransMeta) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) IMetaStore(org.pentaho.metastore.api.IMetaStore) 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