use of org.apache.hop.core.row.value.ValueMetaBase in project hop by apache.
the class GreenplumValueMetaBaseTest method setUp.
@Before
public void setUp() {
listener = new StoreLoggingEventListener();
HopLogStore.getAppender().addLoggingEventListener(listener);
dbMeta = spy(DatabaseMeta.class);
dbMeta.setIDatabase(spy(GreenplumDatabaseMeta.class));
valueMetaBase = new ValueMetaBase();
resultSet = mock(ResultSet.class);
variables = spy(new Variables());
}
use of org.apache.hop.core.row.value.ValueMetaBase in project hop by apache.
the class TeradataValueMetaBaseTest method setUp.
@Before
public void setUp() {
listener = new StoreLoggingEventListener();
HopLogStore.getAppender().addLoggingEventListener(listener);
valueMetaBase = new ValueMetaBase();
dbMeta = spy(new DatabaseMeta());
dbMeta.setIDatabase(spy(TeradataDatabaseMeta.class));
resultSet = mock(ResultSet.class);
variables = spy(new Variables());
}
use of org.apache.hop.core.row.value.ValueMetaBase in project hop by apache.
the class SalesforceUpdateTest method testWriteToSalesForceForNullExtIdField_WithExtIdNO.
@Test
public void testWriteToSalesForceForNullExtIdField_WithExtIdNO() throws Exception {
SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceUpdateData data = generateSalesforceUpdateData();
SalesforceUpdate sfInputTransform = new SalesforceUpdate(smh.transformMeta, meta, data, 0, smh.pipelineMeta, smh.pipeline);
sfInputTransform.init();
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
rowMeta.addValueMeta(valueMeta);
data.inputRowMeta = rowMeta;
sfInputTransform.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.apache.hop.core.row.value.ValueMetaBase in project hop by apache.
the class SalesforceUpdateTest method testLogMessageInDetailedModeFotWriteToSalesForce.
@Test
public void testLogMessageInDetailedModeFotWriteToSalesForce() throws HopException {
SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceUpdateData data = generateSalesforceUpdateData();
SalesforceUpdate sfInputTransform = new SalesforceUpdate(smh.transformMeta, meta, data, 0, smh.pipelineMeta, smh.pipeline);
sfInputTransform.init();
when(sfInputTransform.getLogChannel().isDetailed()).thenReturn(true);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
rowMeta.addValueMeta(valueMeta);
data.inputRowMeta = rowMeta;
verify(sfInputTransform.getLogChannel(), never()).logDetailed(anyString());
sfInputTransform.writeToSalesForce(new Object[] { "001i000001c5Nv9AAE" });
verify(sfInputTransform.getLogChannel()).logDetailed("Called writeToSalesForce with 0 out of 2");
}
use of org.apache.hop.core.row.value.ValueMetaBase in project hop by apache.
the class SalesforceUpdateTest method testWriteToSalesForceForNotNullExtIdField_WithExtIdNO.
@Test
public void testWriteToSalesForceForNotNullExtIdField_WithExtIdNO() throws Exception {
SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
SalesforceUpdateData data = generateSalesforceUpdateData();
SalesforceUpdate sfInputTransform = new SalesforceUpdate(smh.transformMeta, meta, data, 0, smh.pipelineMeta, smh.pipeline);
sfInputTransform.init();
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
rowMeta.addValueMeta(valueMeta);
data.inputRowMeta = rowMeta;
sfInputTransform.writeToSalesForce(new Object[] { "001i000001c5Nv9AAE" });
XmlObject[] children = SalesforceConnection.getChildren(data.sfBuffer[0]);
assertNotNull(children);
assertEquals(0, data.sfBuffer[0].getFieldsToNull().length);
assertEquals(1, children.length);
assertEquals(Constants.PARTNER_SOBJECT_NS, children[0].getName().getNamespaceURI());
assertEquals(ACCOUNT_ID, children[0].getName().getLocalPart());
assertEquals("001i000001c5Nv9AAE", children[0].getValue());
assertFalse(children[0].hasChildren());
}
Aggregations