Search in sources :

Example 1 with QueryRecordsOpportunity

use of org.wildfly.camel.test.salesforce.dto.QueryRecordsOpportunity in project wildfly-camel by wildfly-extras.

the class SalesforceIntegrationTest method testSalesforceQueryProducer.

@Test
public void testSalesforceQueryProducer() throws Exception {
    Map<String, Object> salesforceOptions = createSalesforceOptions();
    Assume.assumeTrue("[#1676] Enable Salesforce testing in Jenkins", salesforceOptions.size() == SalesforceOption.values().length);
    SalesforceLoginConfig loginConfig = new SalesforceLoginConfig();
    IntrospectionSupport.setProperties(loginConfig, salesforceOptions);
    SalesforceComponent component = new SalesforceComponent();
    component.setPackages("org.wildfly.camel.test.salesforce.dto");
    component.setLoginConfig(loginConfig);
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addComponent("salesforce", component);
    camelctx.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("direct:query").to("salesforce:query?sObjectQuery=SELECT id,name from Opportunity&sObjectClass=" + QueryRecordsOpportunity.class.getName());
        }
    });
    camelctx.start();
    try {
        ProducerTemplate template = camelctx.createProducerTemplate();
        QueryRecordsOpportunity queryRecords = template.requestBody("direct:query", null, QueryRecordsOpportunity.class);
        Assert.assertNotNull("Expected query records result to not be null", queryRecords);
    } finally {
        camelctx.stop();
    }
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) ProducerTemplate(org.apache.camel.ProducerTemplate) RouteBuilder(org.apache.camel.builder.RouteBuilder) QueryRecordsOpportunity(org.wildfly.camel.test.salesforce.dto.QueryRecordsOpportunity) SalesforceLoginConfig(org.apache.camel.component.salesforce.SalesforceLoginConfig) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SalesforceComponent(org.apache.camel.component.salesforce.SalesforceComponent) Test(org.junit.Test)

Aggregations

CamelContext (org.apache.camel.CamelContext)1 ProducerTemplate (org.apache.camel.ProducerTemplate)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 SalesforceComponent (org.apache.camel.component.salesforce.SalesforceComponent)1 SalesforceLoginConfig (org.apache.camel.component.salesforce.SalesforceLoginConfig)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 Test (org.junit.Test)1 QueryRecordsOpportunity (org.wildfly.camel.test.salesforce.dto.QueryRecordsOpportunity)1