private void executeWaitAndAssertBatchJob(String flowConstructName) throws Exception { // Execute synchronization runSchedulersOnce(flowConstructName); // Wait for the batch job execution to finish batchTestHelper.awaitJobTermination(TIMEOUT_MILLIS * 1000, 500); batchTestHelper.assertJobWasSuccessful(); }
@SuppressWarnings("unchecked") @Test public void testMainFlow() throws Exception { Thread.sleep(20000); runSchedulersOnce(POLL_FLOW_NAME); waitForPollToRun(); helper.awaitJobTermination(TIMEOUT_MILLIS, DELAY_MILLIS); helper.assertJobWasSuccessful(); SubflowInterceptingChainLifecycleWrapper flow = getSubFlow("getWorkdayEmployee"); flow.initialise(); MuleEvent response = flow.process(getTestEvent(getEmployee(), MessageExchangePattern.REQUEST_RESPONSE)); EmployeeType workerRes = (EmployeeType) response.getMessage().getPayload(); logger.info("worker id:" + workerRes.getEmployeeData().get(0).getEmployeeID()); flow = getSubFlow("retrieveCaseSFDC"); flow.initialise(); ConsumerIterator<Map<String, Object>> iterator = (ConsumerIterator<Map<String, Object>>) flow.process( getTestEvent( workerRes.getEmployeeData().get(0).getEmployeeID(), MessageExchangePattern.REQUEST_RESPONSE)) .getMessage() .getPayload(); Map<String, Object> caseMap = iterator.next(); SFDC_ID = caseMap.get("Id").toString(); ACCOUNT_ID = caseMap.get("AccountId").toString(); CONTACT_ID = caseMap.get("ContactId").toString(); assertEquals( "Subject should be synced", employee.getGivenName() + " " + employee.getFamilyName() + " Case", caseMap.get("Subject")); assertEquals("Email should be synced", EMAIL, caseMap.get("SuppliedEmail")); }