Search in sources :

Example 6 with Account

use of org.apache.camel.component.salesforce.dto.generated.Account 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());
}
Also used : Account(org.apache.camel.component.salesforce.dto.generated.Account) Asset(org.apache.camel.component.salesforce.dto.generated.Asset) Contact(org.apache.camel.component.salesforce.dto.generated.Contact) Test(org.junit.Test)

Example 7 with Account

use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.

the class SObjectTreeTest method treeWithOneNodeShouldHaveSizeOfOne.

@Test
public void treeWithOneNodeShouldHaveSizeOfOne() {
    final SObjectTree tree = new SObjectTree();
    tree.addObject(new Account());
    assertEquals(1, tree.size());
}
Also used : Account(org.apache.camel.component.salesforce.dto.generated.Account) Test(org.junit.Test)

Example 8 with Account

use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.

the class SObjectTreeTest method treeWithTwoNodesShouldHaveSizeOfTwo.

@Test
public void treeWithTwoNodesShouldHaveSizeOfTwo() {
    final SObjectTree tree = new SObjectTree();
    tree.addObject(new Account());
    tree.addObject(new Account());
    assertEquals(2, tree.size());
}
Also used : Account(org.apache.camel.component.salesforce.dto.generated.Account) Test(org.junit.Test)

Example 9 with Account

use of org.apache.camel.component.salesforce.dto.generated.Account 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);
}
Also used : Account(org.apache.camel.component.salesforce.dto.generated.Account) Asset(org.apache.camel.component.salesforce.dto.generated.Asset) Contact(org.apache.camel.component.salesforce.dto.generated.Contact) Test(org.junit.Test)

Example 10 with Account

use of org.apache.camel.component.salesforce.dto.generated.Account in project camel by apache.

the class CompositeApiBatchIntegrationTest method shouldSupportObjectUpdates.

@Test
public void shouldSupportObjectUpdates() {
    final SObjectBatch batch = new SObjectBatch(version);
    final Account updates = new Account();
    updates.setName("NewName");
    updates.setAccountNumber("AC12345");
    batch.addUpdate("Account", accountId, updates);
    testBatch(batch);
}
Also used : Account(org.apache.camel.component.salesforce.dto.generated.Account) SObjectBatch(org.apache.camel.component.salesforce.api.dto.composite.SObjectBatch) Test(org.junit.Test)

Aggregations

Account (org.apache.camel.component.salesforce.dto.generated.Account)14 Test (org.junit.Test)10 Contact (org.apache.camel.component.salesforce.dto.generated.Contact)5 Asset (org.apache.camel.component.salesforce.dto.generated.Asset)4 CreateSObjectResult (org.apache.camel.component.salesforce.api.dto.CreateSObjectResult)3 SObjectBatch (org.apache.camel.component.salesforce.api.dto.composite.SObjectBatch)3 SObjectBatchResponse (org.apache.camel.component.salesforce.api.dto.composite.SObjectBatchResponse)2 Before (org.junit.Before)2 IOException (java.io.IOException)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 Component (org.apache.camel.Component)1 ComponentConfiguration (org.apache.camel.ComponentConfiguration)1 QueryRecordsReport (org.apache.camel.component.salesforce.api.dto.analytics.reports.QueryRecordsReport)1 SObjectBatchResult (org.apache.camel.component.salesforce.api.dto.composite.SObjectBatchResult)1 SObjectTree (org.apache.camel.component.salesforce.api.dto.composite.SObjectTree)1 Document (org.apache.camel.component.salesforce.dto.generated.Document)1