@Test
public void testWorkflowDispatcherRunProgressState() throws Exception {

  service.activate(cc);
  InputStream stream = GoogleSpeechTranscriptionServiceTest.class.getResourceAsStream("/" + PULLED_TRANSCRIPTION_FILE);
  database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, TranscriptionJobControl.Status.InProgress.name(), 0, null, PROVIDER);
  database.storeJobControl("mpId2", "audioTrack2", "jobId2", TranscriptionJobControl.Status.InProgress.name(),
          TRACK_DURATION, DATE_EXPECTED, PROVIDER);
  EasyMock.expect(workspace.putInCollection(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class),
          EasyMock.anyObject(InputStream.class))).andReturn(new URI("http://anything"));
  EasyMock.replay(workspace);
  HttpEntity httpEntity = EasyMock.createNiceMock(HttpEntity.class);
  EasyMock.expect(httpEntity.getContent()).andReturn(stream);
  CloseableHttpResponse response = EasyMock.createNiceMock(CloseableHttpResponse.class);
  StatusLine status = EasyMock.createNiceMock(StatusLine.class);
  EasyMock.expect(response.getStatusLine()).andReturn(status).anyTimes();
  EasyMock.expect(response.getEntity()).andReturn(httpEntity).anyTimes();
  EasyMock.expect(status.getStatusCode()).andReturn(HttpStatus.SC_OK).anyTimes();
  EasyMock.replay(httpEntity, response, status);
  Capture<HttpGet> capturedGet = Capture.newInstance();
  EasyMock.expect(httpClient.execute(EasyMock.capture(capturedGet))).andReturn(response);
  EasyMock.replay(httpClient);
  Capture<Set<String>> capturedMpIds = mockAssetManagerAndWorkflow(GoogleSpeechTranscriptionService.DEFAULT_WF_DEF,
          true);
  WorkflowDispatcher dispatcher = service.new WorkflowDispatcher();
  dispatcher.run();
  // Check if it called the external service to get the results
  Assert.assertEquals(RESULT_URL + JOB_ID,
          capturedGet.getValue().getURI().toString());
  // Check if only one mp has a workflow created for it
  Assert.assertEquals(1, capturedMpIds.getValue().size());
  // And if it was the correct one
  Assert.assertEquals(MP_ID, capturedMpIds.getValue().iterator().next());
  // Check if status in db was updated
  TranscriptionJobControl job = database.findByJob(JOB_ID);
  Assert.assertNotNull(job);
  Assert.assertEquals(TranscriptionJobControl.Status.Closed.name(), job.getStatus());
}