use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class SeriesWorkflowOperationHandlerTest method testNoSeries.
@Test
public void testNoSeries() throws Exception {
WorkflowInstanceImpl instance = new WorkflowInstanceImpl();
List<WorkflowOperationInstance> ops = new ArrayList<WorkflowOperationInstance>();
WorkflowOperationInstanceImpl operation = new WorkflowOperationInstanceImpl("test", OperationState.INSTANTIATED);
ops.add(operation);
instance.setOperations(ops);
instance.setMediaPackage(mp);
operation.setConfiguration(SeriesWorkflowOperationHandler.ATTACH_PROPERTY, "*");
operation.setConfiguration(SeriesWorkflowOperationHandler.APPLY_ACL_PROPERTY, "true");
WorkflowOperationResult result = operationHandler.start(instance, null);
Assert.assertEquals(Action.SKIP, result.getAction());
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class TagWorkflowOperationHandlerTest method testAllTagsFlavors.
@Test
public void testAllTagsFlavors() throws Exception {
WorkflowInstanceImpl instance = new WorkflowInstanceImpl();
List<WorkflowOperationInstance> ops = new ArrayList<WorkflowOperationInstance>();
WorkflowOperationInstanceImpl operation = new WorkflowOperationInstanceImpl("test", OperationState.INSTANTIATED);
ops.add(operation);
instance.setOperations(ops);
instance.setMediaPackage(mp);
operation.setConfiguration(TagWorkflowOperationHandler.SOURCE_FLAVORS_PROPERTY, "presenter/source");
operation.setConfiguration(TagWorkflowOperationHandler.TARGET_FLAVOR_PROPERTY, "presenter/test");
operation.setConfiguration(TagWorkflowOperationHandler.TARGET_TAGS_PROPERTY, "tag1,tag2");
operation.setConfiguration(TagWorkflowOperationHandler.COPY_PROPERTY, "false");
WorkflowOperationResult result = operationHandler.start(instance, null);
MediaPackage resultingMediapackage = result.getMediaPackage();
Track track = resultingMediapackage.getTrack("track-2");
Assert.assertEquals("presenter/test", track.getFlavor().toString());
Assert.assertEquals("tag1", track.getTags()[0]);
Assert.assertEquals("tag2", track.getTags()[1]);
instance = new WorkflowInstanceImpl();
ops = new ArrayList<WorkflowOperationInstance>();
operation = new WorkflowOperationInstanceImpl("test", OperationState.INSTANTIATED);
ops.add(operation);
instance.setOperations(ops);
instance.setMediaPackage(resultingMediapackage);
operation.setConfiguration(TagWorkflowOperationHandler.SOURCE_TAGS_PROPERTY, "tag1");
operation.setConfiguration(TagWorkflowOperationHandler.TARGET_FLAVOR_PROPERTY, "presenter/source");
operation.setConfiguration(TagWorkflowOperationHandler.TARGET_TAGS_PROPERTY, "-tag1,+tag3");
operation.setConfiguration(TagWorkflowOperationHandler.COPY_PROPERTY, "false");
result = operationHandler.start(instance, null);
resultingMediapackage = result.getMediaPackage();
track = resultingMediapackage.getTrack("track-2");
Assert.assertEquals("presenter/source", track.getFlavor().toString());
Assert.assertEquals("tag2", track.getTags()[0]);
Assert.assertEquals("tag3", track.getTags()[1]);
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class ConfigureByDublinCoreTermWOHTest method testNoMatchConfiguredDCTerm.
@Test
public void testNoMatchConfiguredDCTerm() throws Exception {
// No Match or Default Value
// without dcterm or default the match should always fail
operation.setConfiguration(ConfigureByDublinCoreTermWOH.DCCATALOG_PROPERTY, "episode");
operation.setConfiguration(ConfigureByDublinCoreTermWOH.DCTERM_PROPERTY, "source");
operation.setConfiguration(ConfigureByDublinCoreTermWOH.COPY_PROPERTY, "false");
WorkflowOperationResult result = operationHandler.start(instance, null);
Map<String, String> properties = result.getProperties();
Assert.assertTrue(properties == null);
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class ConfigureByDublinCoreTermWOHTest method testMatchPresentDCTermOverwriteProperty.
@Test
public void testMatchPresentDCTermOverwriteProperty() throws Exception {
operation.setConfiguration(ConfigureByDublinCoreTermWOH.DCCATALOG_PROPERTY, "episode");
operation.setConfiguration(ConfigureByDublinCoreTermWOH.DCTERM_PROPERTY, "publisher");
operation.setConfiguration(ConfigureByDublinCoreTermWOH.MATCH_VALUE_PROPERTY, "University of Opencast");
operation.setConfiguration(ConfigureByDublinCoreTermWOH.COPY_PROPERTY, "false");
operation.setConfiguration("oldConfigProperty", "bar");
WorkflowOperationResult result = operationHandler.start(instance, null);
Map<String, String> properties = result.getProperties();
Assert.assertTrue(properties.containsKey("oldConfigProperty"));
Assert.assertEquals("bar", properties.get("oldConfigProperty"));
}
use of org.opencastproject.workflow.api.WorkflowOperationResult in project opencast by opencast.
the class DefaultsWorkflowOperationHandlerTest method testDontOverwriteExisting.
@Test
public void testDontOverwriteExisting() throws Exception {
// Workflow configuration
Map<String, String> workflowConfiguration = new HashMap<String, String>();
workflowConfiguration.put(OPT_KEY, "initial");
// Operation configuration
Map<String, String> operationConfiguration = new HashMap<String, String>();
operationConfiguration.put(OPT_KEY, DEFAULT_VALUE);
// Run the operation handler
WorkflowOperationResult workflowOperationResult = getWorkflowOperationResult(mp, workflowConfiguration, operationConfiguration);
String configurationValue = workflowOperationResult.getProperties().get(OPT_KEY);
// Make sure the default value has been applied
Assert.assertNotEquals(DEFAULT_VALUE, configurationValue);
}
Aggregations