Search in sources :

Example 16 with TranscriptionJobControl

use of org.opencastproject.transcription.ibmwatson.persistence.TranscriptionJobControl in project opencast by opencast.

the class TranscriptionDatabaseTest method testStoreJobControl.

@Test
public void testStoreJobControl() throws Exception {
    long dt1 = System.currentTimeMillis();
    database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, STATUS, TRACK_DURATION);
    long dt2 = System.currentTimeMillis();
    TranscriptionJobControl j = database.findByJob(JOB_ID);
    Assert.assertNotNull(j);
    Assert.assertEquals(MP_ID, j.getMediaPackageId());
    Assert.assertEquals(TRACK_ID, j.getTrackId());
    Assert.assertEquals(STATUS, j.getStatus());
    Assert.assertEquals(TRACK_DURATION, j.getTrackDuration());
    long created = j.getDateCreated().getTime();
    Assert.assertTrue(dt1 <= created && created <= dt2);
}
Also used : TranscriptionJobControl(org.opencastproject.transcription.ibmwatson.persistence.TranscriptionJobControl) Test(org.junit.Test)

Aggregations

TranscriptionJobControl (org.opencastproject.transcription.ibmwatson.persistence.TranscriptionJobControl)16 Test (org.junit.Test)13 ByteArrayInputStream (java.io.ByteArrayInputStream)6 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)6 InputStream (java.io.InputStream)5 URI (java.net.URI)5 HttpEntity (org.apache.http.HttpEntity)5 StatusLine (org.apache.http.StatusLine)5 HttpGet (org.apache.http.client.methods.HttpGet)5 JSONObject (org.json.simple.JSONObject)4 WorkflowDispatcher (org.opencastproject.transcription.ibmwatson.IBMWatsonTranscriptionService.WorkflowDispatcher)4 TranscriptionServiceException (org.opencastproject.transcription.api.TranscriptionServiceException)3 TranscriptionDatabaseException (org.opencastproject.transcription.ibmwatson.persistence.TranscriptionDatabaseException)3 IOException (java.io.IOException)2 InputStreamReader (java.io.InputStreamReader)2 ArrayList (java.util.ArrayList)2 Set (java.util.Set)2 Snapshot (org.opencastproject.assetmanager.api.Snapshot)2 AQueryBuilder (org.opencastproject.assetmanager.api.query.AQueryBuilder)2 ARecord (org.opencastproject.assetmanager.api.query.ARecord)2