use of org.wildfly.camel.test.salesforce.dto.Opportunity in project wildfly-camel by wildfly-extras.
the class SalesforceIntegrationTest method testSalesforceTopicConsumer.
@Test
public void testSalesforceTopicConsumer() 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("salesforce:CamelTestTopic?notifyForFields=ALL&" + "notifyForOperationCreate=true¬ifyForOperationDelete=true¬ifyForOperationUpdate=true&" + "sObjectName=Opportunity&" + "updateTopic=true&sObjectQuery=SELECT Id, Name FROM Opportunity").to("mock:result");
}
});
Opportunity opportunity = new Opportunity();
opportunity.setName("test");
opportunity.setStageName(Opportunity_StageNameEnum.PROSPECTING);
opportunity.setCloseDate(ZonedDateTime.now());
MockEndpoint mockEndpoint = camelctx.getEndpoint("mock:result", MockEndpoint.class);
mockEndpoint.expectedMinimumMessageCount(1);
camelctx.start();
try {
ProducerTemplate template = camelctx.createProducerTemplate();
template.sendBody("salesforce:upsertSObject?SObjectIdName=Name", opportunity);
mockEndpoint.assertIsSatisfied(5000);
} finally {
camelctx.stop();
}
}
Aggregations