use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class JobEntryLogTable method getRecommendedIndexes.
public List<RowMetaInterface> getRecommendedIndexes() {
List<RowMetaInterface> indexes = new ArrayList<RowMetaInterface>();
LogTableField keyField = getKeyField();
if (keyField.isEnabled()) {
RowMetaInterface batchIndex = new RowMeta();
ValueMetaInterface keyMeta = new ValueMetaBase(keyField.getFieldName(), keyField.getDataType());
keyMeta.setLength(keyField.getLength());
batchIndex.addValueMeta(keyMeta);
indexes.add(batchIndex);
}
return indexes;
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class JobLogTable method getRecommendedIndexes.
public List<RowMetaInterface> getRecommendedIndexes() {
List<RowMetaInterface> indexes = new ArrayList<RowMetaInterface>();
//
if (isBatchIdUsed()) {
RowMetaInterface batchIndex = new RowMeta();
LogTableField keyField = getKeyField();
ValueMetaInterface keyMeta = new ValueMetaBase(keyField.getFieldName(), keyField.getDataType());
keyMeta.setLength(keyField.getLength());
batchIndex.addValueMeta(keyMeta);
indexes.add(batchIndex);
}
// The next index includes : ERRORS, STATUS, JOBNAME:
RowMetaInterface lookupIndex = new RowMeta();
LogTableField errorsField = findField(ID.ERRORS);
if (errorsField != null) {
ValueMetaInterface valueMeta = new ValueMetaBase(errorsField.getFieldName(), errorsField.getDataType());
valueMeta.setLength(errorsField.getLength());
lookupIndex.addValueMeta(valueMeta);
}
LogTableField statusField = findField(ID.STATUS);
if (statusField != null) {
ValueMetaInterface valueMeta = new ValueMetaBase(statusField.getFieldName(), statusField.getDataType());
valueMeta.setLength(statusField.getLength());
lookupIndex.addValueMeta(valueMeta);
}
LogTableField transNameField = findField(ID.JOBNAME);
if (transNameField != null) {
ValueMetaInterface valueMeta = new ValueMetaBase(transNameField.getFieldName(), transNameField.getDataType());
valueMeta.setLength(transNameField.getLength());
lookupIndex.addValueMeta(valueMeta);
}
indexes.add(lookupIndex);
return indexes;
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class BaseStepTest method emptyFieldName.
@Test(expected = KettleStepException.class)
public void emptyFieldName() throws KettleStepException {
BaseStep baseStep = new BaseStep(mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans);
baseStep.setRowHandler(rowHandler);
RowMetaInterface rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaBase("", ValueMetaInterface.TYPE_INTEGER));
baseStep.putRow(rowMeta, new Object[] { 0 });
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class SalesforceUpdateTest method testWriteToSalesForceForNotNullExtIdField_WithExtIdNO.
@Test
public void testWriteToSalesForceForNotNullExtIdField_WithExtIdNO() throws Exception {
SalesforceUpdate sfInputStep = new SalesforceUpdate(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceUpdateData data = generateSalesforceUpdateData();
sfInputStep.init(meta, data);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
rowMeta.addValueMeta(valueMeta);
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce(new Object[] { "001i000001c5Nv9AAE" });
assertEquals(0, data.sfBuffer[0].getFieldsToNull().length);
assertEquals(1, SalesforceConnection.getChildren(data.sfBuffer[0]).length);
assertEquals(Constants.PARTNER_SOBJECT_NS, SalesforceConnection.getChildren(data.sfBuffer[0])[0].getName().getNamespaceURI());
assertEquals(ACCOUNT_ID, SalesforceConnection.getChildren(data.sfBuffer[0])[0].getName().getLocalPart());
assertEquals("001i000001c5Nv9AAE", SalesforceConnection.getChildren(data.sfBuffer[0])[0].getValue());
assertFalse(SalesforceConnection.getChildren(data.sfBuffer[0])[0].hasChildren());
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class SalesforceUpdateTest method testLogMessageInDetailedModeFotWriteToSalesForce.
@Test
public void testLogMessageInDetailedModeFotWriteToSalesForce() throws KettleException {
SalesforceUpdate sfInputStep = new SalesforceUpdate(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceUpdateData data = generateSalesforceUpdateData();
sfInputStep.init(meta, data);
when(sfInputStep.getLogChannel().isDetailed()).thenReturn(true);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
rowMeta.addValueMeta(valueMeta);
smh.initStepDataInterface.inputRowMeta = rowMeta;
verify(sfInputStep.getLogChannel(), never()).logDetailed(anyString());
sfInputStep.writeToSalesForce(new Object[] { "001i000001c5Nv9AAE" });
verify(sfInputStep.getLogChannel()).logDetailed("Called writeToSalesForce with 0 out of 2");
}
Aggregations