use of org.pentaho.di.core.variables.Variables 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());
}
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class TransMetaConverterTest method testResolveStepMetaResources.
@Test
public void testResolveStepMetaResources() throws KettleException, MetaStoreException {
Variables variables = new Variables();
TransMeta transMeta = spy(new TransMeta());
transMeta.setParentVariableSpace(variables);
doReturn(transMeta).when(transMeta).realClone(false);
TestMetaResolvableResource testMetaResolvableResource = spy(new TestMetaResolvableResource());
TestMetaResolvableResource testMetaResolvableResourceTwo = spy(new TestMetaResolvableResource());
StepMeta testMeta = new StepMeta("TestMeta", testMetaResolvableResource);
StepMeta testMetaTwo = new StepMeta("TestMeta2", testMetaResolvableResourceTwo);
transMeta.addStep(testMeta);
transMeta.addStep(testMetaTwo);
transMeta.addTransHop(new TransHopMeta(testMeta, testMetaTwo));
TransMetaConverter.convert(transMeta);
verify(testMetaResolvableResource).resolve();
verify(testMetaResolvableResourceTwo).resolve();
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class MergeRowsMetaCheckTest method testCheckInputRowsEmptyAndNonEmpty.
@Test
public void testCheckInputRowsEmptyAndNonEmpty() throws KettleStepException {
when(transMeta.getPrevStepFields(REFERENCE_STEP_NAME)).thenReturn(generateRowMetaEmpty());
when(transMeta.getPrevStepFields(COMPARISON_STEP_NAME)).thenReturn(generateRowMeta10Strings());
meta.check(remarks, transMeta, stepMeta, (RowMeta) null, new String[0], new String[0], (RowMeta) null, new Variables(), (Repository) null, (IMetaStore) null);
assertNotNull(remarks);
assertTrue(remarks.size() >= 2);
assertEquals(remarks.get(1).getType(), CheckResultInterface.TYPE_RESULT_ERROR);
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class MergeRowsMetaCheckTest method testCheckInputRowsBothNonEmpty.
@Test
public void testCheckInputRowsBothNonEmpty() throws KettleStepException {
when(transMeta.getPrevStepFields(REFERENCE_STEP_NAME)).thenReturn(generateRowMeta10Strings());
when(transMeta.getPrevStepFields(COMPARISON_STEP_NAME)).thenReturn(generateRowMeta10Strings());
meta.check(remarks, transMeta, stepMeta, (RowMeta) null, new String[0], new String[0], (RowMeta) null, new Variables(), (Repository) null, (IMetaStore) null);
assertNotNull(remarks);
assertTrue(remarks.size() >= 2);
assertEquals(remarks.get(1).getType(), CheckResultInterface.TYPE_RESULT_OK);
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class DetectLastRowMetaTest method testGetFields.
@Test
public void testGetFields() throws KettleStepException {
DetectLastRowMeta meta = new DetectLastRowMeta();
meta.setDefault();
meta.setResultFieldName("The Result");
RowMeta rowMeta = new RowMeta();
meta.getFields(rowMeta, "this step", null, null, new Variables(), null, null);
assertEquals(1, rowMeta.size());
assertEquals("The Result", rowMeta.getValueMeta(0).getName());
assertEquals(ValueMetaInterface.TYPE_BOOLEAN, rowMeta.getValueMeta(0).getType());
}
Aggregations