Search in sources :

Example 1 with IDescribeGlobalSObjectResult

use of com.sforce.soap.partner.IDescribeGlobalSObjectResult in project components by Talend.

the class SalesforceRuntimeCommonTest method testGetSchemaNames.

@Test
public void testGetSchemaNames() throws Exception {
    DescribeGlobalResult result = new DescribeGlobalResult();
    DescribeGlobalSObjectResult sObjectResult1 = new DescribeGlobalSObjectResult();
    sObjectResult1.setName("Account");
    sObjectResult1.setLabel("Account");
    DescribeGlobalSObjectResult sObjectResult2 = new DescribeGlobalSObjectResult();
    sObjectResult2.setName("Contact");
    sObjectResult2.setLabel("Contact");
    DescribeGlobalSObjectResult sObjectResult3 = new DescribeGlobalSObjectResult();
    sObjectResult3.setName("Campaign");
    sObjectResult3.setLabel("Campaign");
    result.setSobjects(new IDescribeGlobalSObjectResult[] { sObjectResult1, sObjectResult2, sObjectResult3 });
    PartnerConnection conn = mock(PartnerConnection.class);
    doReturn(result).when(conn).describeGlobal();
    List<NamedThing> schemaNames = SalesforceRuntimeCommon.getSchemaNames(conn);
    assertThat(schemaNames, containsInAnyOrder((NamedThing) new SimpleNamedThing("Account", "Account"), new SimpleNamedThing("Contact", "Contact"), new SimpleNamedThing("Campaign", "Campaign")));
}
Also used : DescribeGlobalResult(com.sforce.soap.partner.DescribeGlobalResult) IDescribeGlobalSObjectResult(com.sforce.soap.partner.IDescribeGlobalSObjectResult) DescribeGlobalSObjectResult(com.sforce.soap.partner.DescribeGlobalSObjectResult) PartnerConnection(com.sforce.soap.partner.PartnerConnection) SimpleNamedThing(org.talend.daikon.SimpleNamedThing) NamedThing(org.talend.daikon.NamedThing) SimpleNamedThing(org.talend.daikon.SimpleNamedThing) Test(org.junit.Test)

Aggregations

DescribeGlobalResult (com.sforce.soap.partner.DescribeGlobalResult)1 DescribeGlobalSObjectResult (com.sforce.soap.partner.DescribeGlobalSObjectResult)1 IDescribeGlobalSObjectResult (com.sforce.soap.partner.IDescribeGlobalSObjectResult)1 PartnerConnection (com.sforce.soap.partner.PartnerConnection)1 Test (org.junit.Test)1 NamedThing (org.talend.daikon.NamedThing)1 SimpleNamedThing (org.talend.daikon.SimpleNamedThing)1