use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class StartTranscriptionOperationHandlerTest method testStartSelectByFlavor.
@Test
public void testStartSelectByFlavor() throws Exception {
operation.setConfiguration(StartTranscriptionOperationHandler.SOURCE_FLAVOR, "audio/ogg");
WorkflowOperationResult result = operationHandler.start(workflowInstance, null);
Assert.assertEquals(Action.CONTINUE, result.getAction());
Assert.assertEquals("audioTrack1", capturedTrack.getValue().getIdentifier());
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class AttachTranscriptionOperationHandlerTest method testStartWebVtt.
@Test
public void testStartWebVtt() throws Exception {
EasyMock.expect(captionService.convert(EasyMock.anyObject(Attachment.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(job2);
EasyMock.replay(captionService);
operation.setConfiguration(AttachTranscriptionOperationHandler.TRANSCRIPTION_JOB_ID, "transcriptionJob");
// operation.setConfiguration(AttachTranscriptionOperationHandler.TARGET_FLAVOR, "captions/timedtext");
operation.setConfiguration(AttachTranscriptionOperationHandler.TARGET_TAG, "tag1,tag2");
operation.setConfiguration(AttachTranscriptionOperationHandler.TARGET_CAPTION_FORMAT, "vtt");
WorkflowOperationResult result = operationHandler.start(workflowInstance, null);
Assert.assertEquals(Action.CONTINUE, result.getAction());
MediaPackage updatedMp = result.getMediaPackage();
Attachment[] attachments = updatedMp.getAttachments(MediaPackageElementFlavor.parseFlavor("captions/vtt+en"));
Assert.assertNotNull(attachments);
Assert.assertEquals(1, attachments.length);
Assert.assertNotNull(attachments[0].getTags());
Assert.assertEquals(3, attachments[0].getTags().length);
Assert.assertEquals("lang:en", attachments[0].getTags()[0]);
Assert.assertEquals("tag1", attachments[0].getTags()[1]);
Assert.assertEquals("tag2", attachments[0].getTags()[2]);
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class AttachTranscriptionOperationHandlerTest method testStartDfxp.
@Test
public void testStartDfxp() throws Exception {
EasyMock.expect(captionService.convert(EasyMock.anyObject(Attachment.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(job1);
EasyMock.replay(captionService);
operation.setConfiguration(AttachTranscriptionOperationHandler.TRANSCRIPTION_JOB_ID, "transcriptionJob");
// operation.setConfiguration(AttachTranscriptionOperationHandler.TARGET_FLAVOR, "captions/timedtext");
operation.setConfiguration(AttachTranscriptionOperationHandler.TARGET_TAG, "tag1,tag2");
operation.setConfiguration(AttachTranscriptionOperationHandler.TARGET_CAPTION_FORMAT, "dfxp");
WorkflowOperationResult result = operationHandler.start(workflowInstance, null);
Assert.assertEquals(Action.CONTINUE, result.getAction());
MediaPackage updatedMp = result.getMediaPackage();
Attachment[] attachments = updatedMp.getAttachments(MediaPackageElementFlavor.parseFlavor("captions/dfxp+en"));
Assert.assertNotNull(attachments);
Assert.assertEquals(1, attachments.length);
Assert.assertNotNull(attachments[0].getTags());
Assert.assertEquals(3, attachments[0].getTags().length);
Assert.assertEquals("lang:en", attachments[0].getTags()[0]);
Assert.assertEquals("tag1", attachments[0].getTags()[1]);
Assert.assertEquals("tag2", attachments[0].getTags()[2]);
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class CopyWorkflowOperationHandlerTest method testCopyWithNoElementMatchingFlavorsTags.
@Test
public void testCopyWithNoElementMatchingFlavorsTags() throws Exception {
// operation configuration
Map<String, String> configurations = new HashMap<String, String>();
configurations.put(CopyWorkflowOperationHandler.OPT_SOURCE_FLAVORS, "no-video/source");
configurations.put(CopyWorkflowOperationHandler.OPT_SOURCE_TAGS, "engage,rss");
configurations.put(CopyWorkflowOperationHandler.OPT_TARGET_DIRECTORY, videoFile.getParent());
configurations.put(CopyWorkflowOperationHandler.OPT_TARGET_FILENAME, "testCopy");
// run the operation handler
WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
Assert.assertEquals(Action.SKIP, result.getAction());
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class DuplicateEventWorkflowOperationHandlerTest method testRemoveAndAddTags.
@Test
public void testRemoveAndAddTags() throws Exception {
mockDependencies(1);
Map<String, String> configurations = new HashMap<>();
configurations.put(SOURCE_FLAVORS_PROPERTY, "*/*");
configurations.put(SOURCE_TAGS_PROPERTY, "part1");
configurations.put(TARGET_TAGS_PROPERTY, "-part1,+tag3");
configurations.put(NUMBER_PROPERTY, "" + 1);
configurations.put(MAX_NUMBER_PROPERTY, "" + 10);
configurations.put(PROPERTY_NAMESPACES_PROPERTY, "org.opencastproject.assetmanager.security");
configurations.put(COPY_NUMBER_PREFIX_PROPERTY, "copy");
// run the operation handler
WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
Assert.assertEquals(Action.CONTINUE, result.getAction());
Track track = clonedMediaPackages.getValue().getTracksByTag("tag3")[0];
final List<String> newTags = Arrays.asList(track.getTags());
final List<String> originalTags = Arrays.asList(mp.getTracksByTag("part1")[0].getTags());
Assert.assertEquals(originalTags.size(), newTags.size());
Assert.assertTrue(newTags.contains("tag3"));
Assert.assertFalse(newTags.contains("part1"));
}
Aggregations