private void getAndInitializeFlows() throws InitialisationException {
    // Flow for creating opportunities in sfdc A instance
    createOpportunityInAFlow = getSubFlow("createOpportunityInAFlow");
    createOpportunityInAFlow.initialise();

    // Flow for creating opportunities in sfdc B instance
    createOpportunityInBFlow = getSubFlow("createOpportunityInBFlow");
    createOpportunityInBFlow.initialise();

    // Flow for deleting opportunities in sfdc A instance
    deleteOpportunityFromAFlow = getSubFlow("deleteOpportunityFromAFlow");
    deleteOpportunityFromAFlow.initialise();

    // Flow for deleting opportunities in sfdc B instance
    deleteOpportunityFromBFlow = getSubFlow("deleteOpportunityFromBFlow");
    deleteOpportunityFromBFlow.initialise();

    // Flow for querying opportunities in sfdc A instance
    queryOpportunityFromAFlow = getSubFlow("queryOpportunityFromAFlow");
    queryOpportunityFromAFlow.initialise();

    // Flow for querying opportunities in sfdc B instance
    queryOpportunityFromBFlow = getSubFlow("queryOpportunityFromBFlow");
    queryOpportunityFromBFlow.initialise();
  }
 private Object queryOpportunity(
     Map<String, Object> opportunity, InterceptingChainLifecycleWrapper queryOpportunityFlow)
     throws MuleException, Exception {
   return queryOpportunityFlow
       .process(getTestEvent(opportunity, MessageExchangePattern.REQUEST_RESPONSE))
       .getMessage()
       .getPayload();
 }
  private String createTestOpportunitiesInSfdcSandbox(
      Map<String, Object> opportunity, InterceptingChainLifecycleWrapper createOpportunityFlow)
      throws MuleException, Exception {
    List<Map<String, Object>> salesforceOpportunities = new ArrayList<Map<String, Object>>();
    salesforceOpportunities.add(opportunity);

    final List<SaveResult> payloadAfterExecution =
        (List<SaveResult>)
            createOpportunityFlow
                .process(
                    getTestEvent(salesforceOpportunities, MessageExchangePattern.REQUEST_RESPONSE))
                .getMessage()
                .getPayload();
    return payloadAfterExecution.get(0).getId();
  }