use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class MergeRowsMetaCheckTest method testCheckInputRowsDifferentRowMetaTypes.
@Test
public void testCheckInputRowsDifferentRowMetaTypes() throws KettleStepException {
when(transMeta.getPrevStepFields(REFERENCE_STEP_NAME)).thenReturn(generateRowMeta10MixedTypes());
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 NamedClusterEmbedManagerTest method testPassEmbeddedMetastoreKey.
@Test
public void testPassEmbeddedMetastoreKey() {
Variables mockVariables = mock(Variables.class);
namedClusterEmbedManager.passEmbeddedMetastoreKey(mockVariables, "key");
verify(mockVariables).setVariable(anyString(), anyString());
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class BasePropertyParsingTest method setFields.
/**
* Declare fields for test.
*/
protected void setFields(PropertyInputField... fields) throws Exception {
meta.setInputFields(fields);
meta.getFields(data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null);
data.convertRowMeta = data.outputRowMeta.cloneToType(ValueMetaInterface.TYPE_STRING);
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class RestMetaTest method testStepChecks.
@Test
public void testStepChecks() {
RestMeta meta = new RestMeta();
List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
TransMeta transMeta = new TransMeta();
StepMeta step = new StepMeta();
RowMetaInterface prev = new RowMeta();
RowMetaInterface info = new RowMeta();
String[] input = new String[0];
String[] output = new String[0];
VariableSpace variables = new Variables();
Repository repo = null;
IMetaStore metaStore = null;
// In a default configuration, it's expected that some errors will occur.
// For this, we'll grab a baseline count of the number of errors
// as the error count should decrease as we change configuration settings to proper values.
remarks.clear();
meta.check(remarks, transMeta, step, prev, input, output, info, variables, repo, metaStore);
final int errorsDefault = getCheckResultErrorCount(remarks);
assertTrue(errorsDefault > 0);
// Setting the step to read the URL from a field should fix one of the check() errors
meta.setUrlInField(true);
meta.setUrlField("urlField");
prev.addValueMeta(new ValueMetaString("urlField"));
remarks.clear();
meta.check(remarks, transMeta, step, prev, input, output, info, variables, repo, metaStore);
int errorsCurrent = getCheckResultErrorCount(remarks);
assertTrue(errorsDefault > errorsCurrent);
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class GetSubFoldersMetaTest method getFieldsTest.
@Test
public void getFieldsTest() throws KettleStepException {
GetSubFoldersMeta stepMeta = new GetSubFoldersMeta();
String stepName = UUID.randomUUID().toString();
RowMeta rowMeta = new RowMeta();
stepMeta.getFields(rowMeta, stepName, null, null, new Variables(), null, null);
assertFalse(stepMeta.includeRowNumber());
assertEquals(10, rowMeta.size());
assertEquals("folderName", rowMeta.getValueMeta(0).getName());
assertEquals("short_folderName", rowMeta.getValueMeta(1).getName());
assertEquals("path", rowMeta.getValueMeta(2).getName());
assertEquals("ishidden", rowMeta.getValueMeta(3).getName());
assertEquals("isreadable", rowMeta.getValueMeta(4).getName());
assertEquals("iswriteable", rowMeta.getValueMeta(5).getName());
assertEquals("lastmodifiedtime", rowMeta.getValueMeta(6).getName());
assertEquals("uri", rowMeta.getValueMeta(7).getName());
assertEquals("rooturi", rowMeta.getValueMeta(8).getName());
assertEquals("childrens", rowMeta.getValueMeta(9).getName());
stepMeta.setIncludeRowNumber(true);
rowMeta = new RowMeta();
stepMeta.getFields(rowMeta, stepName, null, null, new Variables(), null, null);
assertTrue(stepMeta.includeRowNumber());
assertEquals(11, rowMeta.size());
assertEquals("folderName", rowMeta.getValueMeta(0).getName());
assertEquals("short_folderName", rowMeta.getValueMeta(1).getName());
assertEquals("path", rowMeta.getValueMeta(2).getName());
assertEquals("ishidden", rowMeta.getValueMeta(3).getName());
assertEquals("isreadable", rowMeta.getValueMeta(4).getName());
assertEquals("iswriteable", rowMeta.getValueMeta(5).getName());
assertEquals("lastmodifiedtime", rowMeta.getValueMeta(6).getName());
assertEquals("uri", rowMeta.getValueMeta(7).getName());
assertEquals("rooturi", rowMeta.getValueMeta(8).getName());
assertEquals("childrens", rowMeta.getValueMeta(9).getName());
assertEquals(null, rowMeta.getValueMeta(10).getName());
stepMeta.setRowNumberField("MyRowNumber");
rowMeta = new RowMeta();
stepMeta.getFields(rowMeta, stepName, null, null, new Variables(), null, null);
assertEquals("MyRowNumber", stepMeta.getRowNumberField());
assertEquals(11, rowMeta.size());
assertEquals("MyRowNumber", rowMeta.getValueMeta(10).getName());
}
Aggregations