@Test public void testTranscriptionError() throws Exception { service.activate(cc); InputStream stream = IBMWatsonTranscriptionServiceTest.class.getResourceAsStream("/" + PUSHED_TRANSCRIPTION_FILE); database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, TranscriptionJobControl.Status.InProgress.name(), TRACK_DURATION, DATE_EXPECTED, PROVIDER); JSONObject obj = (JSONObject) jsonParser.parse(new InputStreamReader(stream)); service.transcriptionError(MP_ID, obj); TranscriptionJobControl job = database.findByJob(JOB_ID); Assert.assertNotNull(job); Assert.assertEquals(TranscriptionJobControl.Status.Error.name(), job.getStatus()); Assert.assertNull(job.getDateCompleted()); EasyMock.verify(smtpService); }
@Override public void transcriptionError(String mpId, Object obj) throws TranscriptionServiceException { JSONObject jsonObj = (JSONObject) obj; String jobId = (String) jsonObj.get("id"); try { retryOrError(jobId, mpId, String.format("Transcription error for media package %s, job id %s", mpId, jobId)); } catch (TranscriptionDatabaseException e) { throw new TranscriptionServiceException("Error when updating job state.", e); } }
IBMWatsonTranscriptionService extends AbstractJobProducer implements TranscriptionService { @Override public void transcriptionError(String mpId, Object obj) throws TranscriptionServiceException { JSONObject jsonObj = (JSONObject) obj; String jobId = (String) jsonObj.get("id"); try { retryOrError(jobId, mpId, String.format("Transcription error for media package %s, job id %s", mpId, jobId)); } catch (TranscriptionDatabaseException e) { throw new TranscriptionServiceException("Error when updating job state.", e); } } }
IBMWatsonTranscriptionService extends AbstractJobProducer implements TranscriptionService { @Override public void transcriptionError(String mpId, Object obj) throws TranscriptionServiceException { JSONObject jsonObj = (JSONObject) obj; String jobId = (String) jsonObj.get("id"); try { retryOrError(jobId, mpId, String.format("Transcription error for media package %s, job id %s", mpId, jobId)); } catch (TranscriptionDatabaseException e) { throw new TranscriptionServiceException("Error when updating job state.", e); } } IBMWatsonTranscriptionService(); }
IBMWatsonTranscriptionService extends AbstractJobProducer implements TranscriptionService { @Override public void transcriptionError(String mpId, Object obj) throws TranscriptionServiceException { JSONObject jsonObj = (JSONObject) obj; String jobId = (String) jsonObj.get("id"); try { retryOrError(jobId, mpId, String.format("Transcription error for media package %s, job id %s", mpId, jobId)); } catch (TranscriptionDatabaseException e) { throw new TranscriptionServiceException("Error when updating job state.", e); } } IBMWatsonTranscriptionService(); void activate(ComponentContext cc); @Override Job startTranscription(String mpId, Track track); @Override Job startTranscription(String mpId, Track track, String language); @Override void transcriptionDone(String mpId, Object obj); @Override void transcriptionError(String mpId, Object obj); @Override String getLanguage(); @Override MediaPackageElement getGeneratedTranscription(String mpId, String jobId); boolean isCallbackAlreadyRegistered(); void setServiceRegistry(ServiceRegistry serviceRegistry); void setSecurityService(SecurityService securityService); void setUserDirectoryService(UserDirectoryService userDirectoryService); void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService); void setSmtpService(SmtpService service); void setWorkspace(Workspace ws); void setWorkingFileRepository(WorkingFileRepository wfr); void setDatabase(TranscriptionDatabase service); void setAssetManager(AssetManager service); void setWorkflowService(WorkflowService service); boolean isEnabled(); }
IBMWatsonTranscriptionService extends AbstractJobProducer implements TranscriptionService { @Override public void transcriptionError(String mpId, Object obj) throws TranscriptionServiceException { JSONObject jsonObj = (JSONObject) obj; String jobId = (String) jsonObj.get("id"); try { retryOrError(jobId, mpId, String.format("Transcription error for media package %s, job id %s", mpId, jobId)); } catch (TranscriptionDatabaseException e) { throw new TranscriptionServiceException("Error when updating job state.", e); } } IBMWatsonTranscriptionService(); void activate(ComponentContext cc); @Override Job startTranscription(String mpId, Track track); @Override Job startTranscription(String mpId, Track track, String language); @Override void transcriptionDone(String mpId, Object obj); @Override void transcriptionError(String mpId, Object obj); @Override String getLanguage(); @Override MediaPackageElement getGeneratedTranscription(String mpId, String jobId); boolean isCallbackAlreadyRegistered(); void setServiceRegistry(ServiceRegistry serviceRegistry); void setSecurityService(SecurityService securityService); void setUserDirectoryService(UserDirectoryService userDirectoryService); void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService); void setSmtpService(SmtpService service); void setWorkspace(Workspace ws); void setWorkingFileRepository(WorkingFileRepository wfr); void setDatabase(TranscriptionDatabase service); void setAssetManager(AssetManager service); void setWorkflowService(WorkflowService service); boolean isEnabled(); static final String DEFAULT_WF_DEF; static final String ADMIN_URL_PROPERTY; static final float DEFAULT_START_TRANSCRIPTION_JOB_LOAD; static final String START_TRANSCRIPTION_JOB_LOAD_KEY; static final String ENABLED_CONFIG; static final String IBM_WATSON_SERVICE_URL_CONFIG; static final String IBM_WATSON_USER_CONFIG; static final String IBM_WATSON_PSW_CONFIG; static final String IBM_WATSON_API_KEY_CONFIG; static final String IBM_WATSON_MODEL_CONFIG; static final String WORKFLOW_CONFIG; static final String DISPATCH_WORKFLOW_INTERVAL_CONFIG; static final String COMPLETION_CHECK_BUFFER_CONFIG; static final String MAX_PROCESSING_TIME_CONFIG; static final String NOTIFICATION_EMAIL_CONFIG; static final String CLEANUP_RESULTS_DAYS_CONFIG; static final String MAX_ATTEMPTS_CONFIG; static final String RETRY_WORKLFOW_CONFIG; }