use of org.apache.camel.component.salesforce.dto.generated.Contact in project camel by apache.
the class SalesforceComponentConfigurationIntegrationTest method testEndpointCompletion.
@Test
public void testEndpointCompletion() throws Exception {
Component component = context().getComponent(componentName);
ComponentConfiguration configuration = component.createComponentConfiguration();
// get operation names
assertCompletionOptions(configuration.completeEndpointPath(""), "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription", "getSObject", "createSObject", "updateSObject", "deleteSObject", "getSObjectWithId", "upsertSObject", "deleteSObjectWithId", "getBlobField", "query", "queryMore", "queryAll", "search", "apexCall", "recent", "createJob", "getJob", "closeJob", "abortJob", "createBatch", "getBatch", "getAllBatches", "getRequest", "getResults", "createBatchQuery", "getQueryResultIds", "getQueryResult", "getRecentReports", "getReportDescription", "executeSyncReport", "executeAsyncReport", "getReportInstances", "getReportResults", "limits", "approval", "approvals", "composite-batch", "composite-tree", "[PushTopicName]");
// get filtered operation names
assertCompletionOptions(configuration.completeEndpointPath("get"), "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription", "getSObject", "getSObjectWithId", "getBlobField", "getJob", "getBatch", "getAllBatches", "getRequest", "getResults", "getQueryResultIds", "getQueryResult", "getRecentReports", "getReportDescription", "getReportInstances", "getReportResults");
/* TODO support parameter completion
// get ALL REST operation parameters
// TODO support operation specific parameter completion
assertCompletionOptions(configuration.completeEndpointPath("getSObject?"),
"apiVersion", "httpClient", "format", "sObjectName", "sObjectId", "sObjectFields",
"sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery", "sObjectSearch");
// get filtered REST parameters
assertCompletionOptions(configuration.completeEndpointPath("getSObject?format=XML&"),
"apiVersion", "httpClient", "sObjectName", "sObjectId", "sObjectFields",
"sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery", "sObjectSearch");
// get ALL Bulk operation parameters
// TODO support operation specific parameter completion
assertCompletionOptions(configuration.completeEndpointPath("createJob?"),
"apiVersion", "httpClient", "sObjectQuery", "contentType", "jobId", "batchId", "resultId");
// get filtered Bulk operation parameters
assertCompletionOptions(configuration.completeEndpointPath("createJob?contentType=XML&"),
"apiVersion", "httpClient", "sObjectQuery", "jobId", "batchId", "resultId");
// get ALL topic parameters for consumers
assertCompletionOptions(configuration.completeEndpointPath("myTopic?"),
"apiVersion", "httpClient", "updateTopic", "notifyForFields", "notifyForOperations");
// get filtered topic parameters for consumers
assertCompletionOptions(configuration.completeEndpointPath("myTopic?updateTopic=true&"),
"apiVersion", "httpClient", "notifyForFields", "notifyForOperations");
// get parameters from partial name
assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObject"),
"sObjectName", "sObjectId", "sObjectFields",
"sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery", "sObjectSearch");
*/
// get sObjectName values, from scanned DTO packages
assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectName="), "Account", "Asset", "Contact", "Task", "Line_Item__c", "Merchandise__c", "Document", "MSPTest");
// get sObjectFields values, from scanned DTO
assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectName=Merchandise__c&sObjectFields="), "Description__c", "Price__c", "Total_Inventory__c", "attributes", "Id", "OwnerId", "IsDeleted", "Name", "CreatedDate", "CreatedById", "LastModifiedDate", "LastModifiedById", "SystemModstamp", "LastActivityDate", "LastViewedDate", "LastReferencedDate");
// get sObjectClass values, from scanned DTO packages
assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectClass="), Account.class.getName(), Asset.class.getName(), Contact.class.getName(), Task.class.getName(), Line_Item__c.class.getName(), Merchandise__c.class.getName(), Document.class.getName(), MSPTest.class.getName(), QueryRecordsLine_Item__c.class.getName());
}
use of org.apache.camel.component.salesforce.dto.generated.Contact in project camel by apache.
the class SObjectTreeTest method shouldSetIdByReferencesForNestedObjects.
@Test
public void shouldSetIdByReferencesForNestedObjects() {
final SObjectTree tree = new SObjectTree();
final Account account = new Account();
final SObjectNode accountNode = new SObjectNode(tree, account);
tree.addNode(accountNode);
final Contact contact = new Contact();
final SObjectNode contactNode = new SObjectNode(tree, contact);
accountNode.addChild("Contacts", contactNode);
final Asset asset = new Asset();
final SObjectNode assetNode = new SObjectNode(tree, asset);
contactNode.addChild("Assets", assetNode);
assertEquals("ref1", accountNode.getAttributes().getReferenceId());
assertEquals("ref2", contactNode.getAttributes().getReferenceId());
assertEquals("ref3", assetNode.getAttributes().getReferenceId());
tree.setIdFor("ref1", "id1");
tree.setIdFor("ref3", "id3");
tree.setIdFor("ref2", "id2");
assertEquals("id1", account.getId());
assertEquals("id2", contact.getId());
assertEquals("id3", asset.getId());
}
use of org.apache.camel.component.salesforce.dto.generated.Contact in project camel by apache.
the class SObjectTreeTest method shouldCollectAllObjectTypesInTheTree.
@Test
public void shouldCollectAllObjectTypesInTheTree() {
final SObjectTree tree = new SObjectTree();
tree.addObject(new Account()).addChild(new Contact()).addChild("Assets", new Asset());
tree.addObject(new Account());
final Class[] types = tree.objectTypes();
Arrays.sort(types, (final Class l, final Class r) -> l.getName().compareTo(r.getName()));
assertArrayEquals(new Class[] { Account.class, Asset.class, Contact.class }, types);
}
use of org.apache.camel.component.salesforce.dto.generated.Contact 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.Contact 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