Search in sources :

Example 91 with WorkflowOperationResult

use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.

the class TagByDublinCoreTermWOHTest method testNoMatchConfiguredDCTerm.

@Test
public void testNoMatchConfiguredDCTerm() throws Exception {
    // No Match or Default Value
    // without dcterm or default the match should always fail
    operation.setConfiguration(TagByDublinCoreTermWOH.SOURCE_FLAVORS_PROPERTY, "dublincore/*");
    operation.setConfiguration(TagByDublinCoreTermWOH.DCCATALOG_PROPERTY, "episode");
    operation.setConfiguration(TagByDublinCoreTermWOH.DCTERM_PROPERTY, "source");
    operation.setConfiguration(TagByDublinCoreTermWOH.TARGET_TAGS_PROPERTY, "tag1,tag2");
    operation.setConfiguration(TagByDublinCoreTermWOH.COPY_PROPERTY, "false");
    WorkflowOperationResult result = operationHandler.start(instance, null);
    MediaPackage resultingMediapackage = result.getMediaPackage();
    Catalog catalog = resultingMediapackage.getCatalog("catalog-1");
    Assert.assertEquals(1, catalog.getTags().length);
    Assert.assertEquals("archive", catalog.getTags()[0]);
}
Also used : MediaPackage(org.opencastproject.mediapackage.MediaPackage) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Catalog(org.opencastproject.mediapackage.Catalog) Test(org.junit.Test)

Example 92 with WorkflowOperationResult

use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.

the class CopyWorkflowOperationHandlerTest method testCopyWithTwoElementsMatchingFlavorsTags.

@Test
public void testCopyWithTwoElementsMatchingFlavorsTags() throws Exception {
    // operation configuration
    Map<String, String> configurations = new HashMap<String, String>();
    configurations.put(CopyWorkflowOperationHandler.OPT_SOURCE_FLAVORS, "*/source");
    configurations.put(CopyWorkflowOperationHandler.OPT_TARGET_DIRECTORY, videoFile.getParent());
    configurations.put(CopyWorkflowOperationHandler.OPT_TARGET_FILENAME, "testCopy");
    // run the operation handler
    try {
        WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
        Assert.assertEquals(Action.CONTINUE, result.getAction());
    } catch (WorkflowOperationException e) {
        Assert.fail("The workflow should ");
    }
}
Also used : HashMap(java.util.HashMap) WorkflowOperationException(org.opencastproject.workflow.api.WorkflowOperationException) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 93 with WorkflowOperationResult

use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.

the class CloneWorkflowOperationHandlerTest method testWildcardTargetFlavorTypeAndSubtype.

@Test
public void testWildcardTargetFlavorTypeAndSubtype() throws Exception {
    // operation configuration
    Map<String, String> configurations = new HashMap<String, String>();
    configurations.put(CloneWorkflowOperationHandler.OPT_SOURCE_FLAVOR, "*/source");
    configurations.put(CloneWorkflowOperationHandler.OPT_TARGET_FLAVOR, "*/*");
    // run the operation handler
    WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
    Assert.assertEquals(Action.CONTINUE, result.getAction());
    MediaPackageElementFlavor newFlavor = MediaPackageElementFlavor.parseFlavor("presentation/source");
    Assert.assertTrue(result.getMediaPackage().getElementsByFlavor(newFlavor).length == 2);
    newFlavor = MediaPackageElementFlavor.parseFlavor("presenter/source");
    Assert.assertTrue(result.getMediaPackage().getElementsByFlavor(newFlavor).length == 2);
}
Also used : HashMap(java.util.HashMap) MediaPackageElementFlavor(org.opencastproject.mediapackage.MediaPackageElementFlavor) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 94 with WorkflowOperationResult

use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.

the class CloneWorkflowOperationHandlerTest method testWildcardTargetFlavorSubtype.

@Test
public void testWildcardTargetFlavorSubtype() throws Exception {
    // operation configuration
    Map<String, String> configurations = new HashMap<String, String>();
    configurations.put(CloneWorkflowOperationHandler.OPT_SOURCE_FLAVOR, "*/source");
    configurations.put(CloneWorkflowOperationHandler.OPT_TARGET_FLAVOR, "targettype/*");
    // run the operation handler
    WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
    Assert.assertEquals(Action.CONTINUE, result.getAction());
    MediaPackageElementFlavor newFlavor = MediaPackageElementFlavor.parseFlavor("targettype/source");
    Assert.assertTrue(result.getMediaPackage().getElementsByFlavor(newFlavor).length == 2);
}
Also used : HashMap(java.util.HashMap) MediaPackageElementFlavor(org.opencastproject.mediapackage.MediaPackageElementFlavor) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 95 with WorkflowOperationResult

use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.

the class CloneWorkflowOperationHandlerTest method testWildcardSourceFlavor.

@Test
public void testWildcardSourceFlavor() throws Exception {
    // operation configuration
    Map<String, String> configurations = new HashMap<String, String>();
    configurations.put(CloneWorkflowOperationHandler.OPT_SOURCE_FLAVOR, "*/source");
    configurations.put(CloneWorkflowOperationHandler.OPT_TARGET_FLAVOR, "*/target");
    // run the operation handler
    WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
    Assert.assertEquals(Action.CONTINUE, result.getAction());
    MediaPackageElementFlavor newFlavor = MediaPackageElementFlavor.parseFlavor("*/target");
    Assert.assertTrue(result.getMediaPackage().getElementsByFlavor(newFlavor).length == 2);
}
Also used : HashMap(java.util.HashMap) MediaPackageElementFlavor(org.opencastproject.mediapackage.MediaPackageElementFlavor) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Aggregations

WorkflowOperationResult (org.opencastproject.workflow.api.WorkflowOperationResult)101 Test (org.junit.Test)85 HashMap (java.util.HashMap)46 MediaPackage (org.opencastproject.mediapackage.MediaPackage)35 Track (org.opencastproject.mediapackage.Track)34 WorkflowOperationInstance (org.opencastproject.workflow.api.WorkflowOperationInstance)28 MediaPackageElementFlavor (org.opencastproject.mediapackage.MediaPackageElementFlavor)26 ArrayList (java.util.ArrayList)19 WorkflowOperationException (org.opencastproject.workflow.api.WorkflowOperationException)19 WorkflowInstanceImpl (org.opencastproject.workflow.api.WorkflowInstanceImpl)17 Job (org.opencastproject.job.api.Job)13 TrackImpl (org.opencastproject.mediapackage.track.TrackImpl)11 WorkflowInstance (org.opencastproject.workflow.api.WorkflowInstance)11 WorkflowOperationInstanceImpl (org.opencastproject.workflow.api.WorkflowOperationInstanceImpl)11 Catalog (org.opencastproject.mediapackage.Catalog)10 TrackSelector (org.opencastproject.mediapackage.selector.TrackSelector)9 URI (java.net.URI)7 File (java.io.File)6 Attachment (org.opencastproject.mediapackage.Attachment)6 MediaPackageElement (org.opencastproject.mediapackage.MediaPackageElement)6