use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class SalesforceUpsertTest method testWriteToSalesForceForNullExtIdField_WithExtIdYES.
@Test
public void testWriteToSalesForceForNullExtIdField_WithExtIdYES() throws Exception {
SalesforceUpsert sfInputStep = new SalesforceUpsert(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
SalesforceUpsertMeta meta = generateSalesforceUpsertMeta(new String[] { ACCOUNT_EXT_ID_ACCOUNT_ID_C_ACCOUNT }, new Boolean[] { true });
SalesforceUpsertData data = generateSalesforceUpsertData();
sfInputStep.init(meta, data);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccExtId");
rowMeta.addValueMeta(valueMeta);
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce(new Object[] { null });
assertEquals(1, data.sfBuffer[0].getFieldsToNull().length);
assertEquals(ACCOUNT_ID, data.sfBuffer[0].getFieldsToNull()[0]);
assertNull(SalesforceConnection.getChildren(data.sfBuffer[0]));
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class SalesforceInsertTest method testWriteToSalesForceForNullExtIdField_WithExtIdNO.
@Test
public void testWriteToSalesForceForNullExtIdField_WithExtIdNO() throws Exception {
SalesforceInsert sfInputStep = new SalesforceInsert(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
SalesforceInsertMeta meta = generateSalesforceInsertMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceInsertData data = generateSalesforceInsertData();
sfInputStep.init(meta, data);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
rowMeta.addValueMeta(valueMeta);
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce(new Object[] { null });
assertEquals(1, data.sfBuffer[0].getFieldsToNull().length);
assertEquals(ACCOUNT_ID, data.sfBuffer[0].getFieldsToNull()[0]);
assertNull(SalesforceConnection.getChildren(data.sfBuffer[0]));
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class SalesforceInsertTest method testWriteToSalesForcePentahoIntegerValue.
@Test
public void testWriteToSalesForcePentahoIntegerValue() throws Exception {
SalesforceInsert sfInputStep = new SalesforceInsert(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
SalesforceInsertMeta meta = generateSalesforceInsertMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceInsertData data = generateSalesforceInsertData();
sfInputStep.init(meta, data);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaInteger("IntValue");
rowMeta.addValueMeta(valueMeta);
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce(new Object[] { 1L });
XmlObject sObject = data.sfBuffer[0].getChild(ACCOUNT_ID);
Assert.assertEquals(sObject.getValue(), 1);
}
use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.
the class BaseStepTest method notEmptyFieldName.
@Test
public void notEmptyFieldName() 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("name", 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 BaseStepTest method blankFieldName.
@Test(expected = KettleStepException.class)
public void blankFieldName() 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 });
}
Aggregations