use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.
the class CompositeApiTreeIntegrationTest method shouldSubmitTreeUsingCompositeApi.
@Test
public void shouldSubmitTreeUsingCompositeApi() {
final Account simpleAccount = new Account();
final Contact smith = new Contact();
final Contact evans = new Contact();
final Account simpleAccount2 = new Account();
simpleAccount.setName("SampleAccount");
simpleAccount.setPhone("1234567890");
simpleAccount.setWebsite("www.salesforce.com");
simpleAccount.setNumberOfEmployees(100);
simpleAccount.setIndustry(Account_IndustryEnum.BANKING);
smith.setLastName("Smith");
smith.setTitle("President");
smith.setEmail("sample@salesforce.com");
evans.setLastName("Evans");
evans.setTitle("Vice President");
evans.setEmail("sample@salesforce.com");
simpleAccount2.setName("SampleAccount2");
simpleAccount2.setPhone("1234567890");
simpleAccount2.setWebsite("www.salesforce2.com");
simpleAccount2.setNumberOfEmployees(100);
simpleAccount2.setIndustry(Account_IndustryEnum.BANKING);
final SObjectTree tree = new SObjectTree();
tree.addObject(simpleAccount).addChildren("Contacts", smith, evans);
tree.addObject(simpleAccount2);
final Account simpleAccount3 = new Account();
simpleAccount3.setName("SimpleAccount3");
final Contact contact = new Contact();
contact.setFirstName("Simple");
contact.setLastName("Contact");
final Asset asset = new Asset();
asset.setName("Asset Name");
asset.setDescription("Simple asset");
tree.addObject(simpleAccount3).addChild("Contacts", contact).addChild("Assets", asset);
final SObjectTree response = template.requestBody("salesforce:composite-tree?format=" + format, tree, SObjectTree.class);
assertNotNull("Response should be provided", response);
assertNotNull("First account should have Id set", simpleAccount.getId());
assertNotNull("President of the first account should have Id set", smith.getId());
assertNotNull("Vice president of the first account should have Id set", evans.getId());
assertNotNull("Second account should have Id set", simpleAccount2.getId());
assertNotNull("Third account should have Id set", simpleAccount3.getId());
assertNotNull("Simple contact on third account should have Id set", contact.getId());
assertNotNull("Simple asset on the contact of the third account should have Id set", asset.getId());
}
use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.
the class CompoundTypesIntegrationTest method doTestTypes.
private void doTestTypes(String suffix) {
Account account = new Account();
account.setName("Camel Test Account");
account.setBillingCity("San Francisco");
account.setBillingCountry("USA");
account.setBillingPostalCode("94105");
account.setBillingState("CA");
account.setBillingStreet("1 Market St #300");
account.setBillingLatitude(37.793779);
account.setBillingLongitude(-122.39448);
account.setShippingCity("San Francisco");
account.setShippingCountry("USA");
account.setShippingPostalCode("94105");
account.setShippingState("CA");
account.setShippingStreet("1 Market St #300");
account.setShippingLatitude(37.793779);
account.setShippingLongitude(-122.39448);
account.setShipping_Location__Latitude__s(37.793779);
account.setShipping_Location__Longitude__s(-122.39448);
CreateSObjectResult result = template().requestBody("direct:createSObject" + suffix, account, CreateSObjectResult.class);
assertNotNull(result);
assertTrue("Create success", result.getSuccess());
LOG.debug("Create: " + result);
try {
// get account with compound fields
account = template().requestBody("direct:getSObject" + suffix, result.getId(), Account.class);
assertNotNull(account);
assertNotNull("Billing Address", account.getBillingAddress());
assertNotNull("Shipping Address", account.getShippingAddress());
assertNotNull("Shipping Location", account.getShippingAddress());
LOG.debug("Retrieved fields billing address: {}, shipping location: {}", account.getBillingAddress(), account.getShipping_Location__c());
} finally {
// delete the test SObject
assertNull(template().requestBody("direct:deleteSObject" + suffix, result.getId()));
LOG.debug("Delete successful");
}
}
use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.
the class RecentIntegrationTest method account.
static Account account(final int ord) {
final Account account = new Account();
account.setName("recent-" + ord);
return account;
}
use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.
the class SObjectTreeTest method treeWithTwoNestedNodesShouldHaveSizeOfTwo.
@Test
public void treeWithTwoNestedNodesShouldHaveSizeOfTwo() {
final SObjectTree tree = new SObjectTree();
final SObjectNode accountNode = tree.addObject(new Account());
accountNode.addChild("Contacts", new Contact());
assertEquals(2, tree.size());
}
Aggregations