doTestCreateUpdateDeleteWithId("Xml");
}
private void doTestCreateUpdateDeleteWithId(String suffix) throws InterruptedException {
// get line item with Name 1
Line_Item__c lineItem = template().requestBody("direct:getSObjectWithId" + suffix, TEST_LINE_ITEM_ID,
Line_Item__c.class);
assertNotNull(lineItem);
LOG.debug("GetWithId: {}", lineItem);
// test insert with id
// set the unit price and sold
lineItem.setUnit_Price__c(1000.0);
lineItem.setUnits_Sold__c(50.0);
// update line item with Name NEW_LINE_ITEM_ID
lineItem.setName(NEW_LINE_ITEM_ID);
CreateSObjectResult result = template().requestBodyAndHeader("direct:upsertSObject" + suffix,
lineItem, SalesforceEndpointConfig.SOBJECT_EXT_ID_VALUE, NEW_LINE_ITEM_ID,
CreateSObjectResult.class);
assertNotNull(result);
assertTrue(result.getSuccess());
LOG.debug("CreateWithId: {}", result);
// clear read only parent type fields
lineItem.setInvoice_Statement__c(null);
lineItem.setMerchandise__c(null);
// change the units sold
lineItem.setUnits_Sold__c(25.0);
// update line item with Name NEW_LINE_ITEM_ID
result = template().requestBodyAndHeader("direct:upsertSObject" + suffix,
lineItem, SalesforceEndpointConfig.SOBJECT_EXT_ID_VALUE, NEW_LINE_ITEM_ID,
CreateSObjectResult.class);