use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class ZipWorkflowOperationHandlerTest method testInvalidMediaPackage.
/*
* MH-9759
*/
@Test
public void testInvalidMediaPackage() 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(null);
operation.setConfiguration(ZipWorkflowOperationHandler.ZIP_COLLECTION_PROPERTY, "failed-zips");
operation.setConfiguration(ZipWorkflowOperationHandler.INCLUDE_FLAVORS_PROPERTY, "*/source,dublincore/*");
operation.setConfiguration(ZipWorkflowOperationHandler.TARGET_FLAVOR_PROPERTY, "archive/zip");
operation.setConfiguration(ZipWorkflowOperationHandler.COMPRESS_PROPERTY, "false");
try {
WorkflowOperationResult result = operationHandler.start(instance, null);
Assert.fail("A null mediapackage is passed so an exception should be thrown");
} catch (WorkflowOperationException e) {
// expecting exception
}
}
use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class ZipWorkflowOperationHandlerTest method testConfigKeyTargetFlavorDefaultValue.
/*
* MH-10043
*/
@Test
public void testConfigKeyTargetFlavorDefaultValue() {
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(ZipWorkflowOperationHandler.ZIP_COLLECTION_PROPERTY, "failed-zips");
operation.setConfiguration(ZipWorkflowOperationHandler.INCLUDE_FLAVORS_PROPERTY, "*/source,dublincore/*");
// targe-flavor is not mandatory
// operation.setConfiguration(ZipWorkflowOperationHandler.TARGET_FLAVOR_PROPERTY, "archive/zip");
operation.setConfiguration(ZipWorkflowOperationHandler.COMPRESS_PROPERTY, "false");
try {
WorkflowOperationResult result = operationHandler.start(instance, null);
Assert.assertEquals("workflow result action not CONTINUE: " + result.getAction(), WorkflowOperationResult.Action.CONTINUE, result.getAction());
} catch (WorkflowOperationException e) {
Assert.fail("missing target-flavor and no default value kicked in: " + e);
}
}
use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class ZipWorkflowOperationHandlerTest method testInvalidWorkflow.
/*
* MH-9757
*/
@Test
public void testInvalidWorkflow() 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);
operation.setConfiguration(ZipWorkflowOperationHandler.ZIP_COLLECTION_PROPERTY, "failed-zips");
operation.setConfiguration(ZipWorkflowOperationHandler.INCLUDE_FLAVORS_PROPERTY, "*/source,dublincore/*");
operation.setConfiguration(ZipWorkflowOperationHandler.TARGET_FLAVOR_PROPERTY, "archive/zip");
operation.setConfiguration(ZipWorkflowOperationHandler.COMPRESS_PROPERTY, "false");
try {
WorkflowOperationResult result = operationHandler.start(null, null);
Assert.fail("A null workflow is passed so an exception should be thrown");
} catch (WorkflowOperationException e) {
// expecting exception
}
}
use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class ComposeWorkflowOperationHandlerTest method getWorkflowOperationResult.
private WorkflowOperationResult getWorkflowOperationResult(MediaPackage mp, Map<String, String> configurations) throws WorkflowOperationException {
// Add the mediapackage to a workflow instance
WorkflowInstanceImpl workflowInstance = new WorkflowInstanceImpl();
workflowInstance.setId(1);
workflowInstance.setState(WorkflowState.RUNNING);
workflowInstance.setMediaPackage(mp);
WorkflowOperationInstanceImpl operation = new WorkflowOperationInstanceImpl("op", OperationState.RUNNING);
operation.setTemplate("compose");
operation.setState(OperationState.RUNNING);
for (String key : configurations.keySet()) {
operation.setConfiguration(key, configurations.get(key));
}
List<WorkflowOperationInstance> operationsList = new ArrayList<WorkflowOperationInstance>();
operationsList.add(operation);
workflowInstance.setOperations(operationsList);
// Run the media package through the operation handler, ensuring that metadata gets added
return operationHandler.start(workflowInstance, null);
}
use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class CompositeWorkflowOperationHandlerTest method getWorkflowOperationResult.
private WorkflowOperationResult getWorkflowOperationResult(MediaPackage mp, Map<String, String> configurations) throws WorkflowOperationException {
// Add the mediapackage to a workflow instance
WorkflowInstanceImpl workflowInstance = new WorkflowInstanceImpl();
workflowInstance.setId(1);
workflowInstance.setState(WorkflowState.RUNNING);
workflowInstance.setMediaPackage(mp);
WorkflowOperationInstanceImpl operation = new WorkflowOperationInstanceImpl("op", OperationState.RUNNING);
operation.setTemplate("composite");
operation.setState(OperationState.RUNNING);
for (String key : configurations.keySet()) {
operation.setConfiguration(key, configurations.get(key));
}
List<WorkflowOperationInstance> operationsList = new ArrayList<WorkflowOperationInstance>();
operationsList.add(operation);
workflowInstance.setOperations(operationsList);
// Run the media package through the operation handler, ensuring that metadata gets added
return operationHandler.start(workflowInstance, null);
}
Aggregations