}
private WorkflowProcessor getProcessor(double priority, String stateName,
String categoryName) throws InstantiationException, IllegalAccessException {
WorkflowLifecycleManager lifecycleManager = new WorkflowLifecycleManager(
"./src/main/resources/examples/wengine/wengine-lifecycle.xml");
WorkflowInstance inst = new WorkflowInstance();
Date sd = new Date();
sd.setTime(sd.getTime() + (this.dateGen * 5000));
this.dateGen++;
inst.setStartDate(sd);
inst.setId("winst-" + priority);
Workflow workflow = new Workflow();
workflow.setTasks(Collections.EMPTY_LIST);
inst.setWorkflow(workflow);
inst.setPriority(Priority.getPriority(priority));
WorkflowProcessorBuilder builder = WorkflowProcessorBuilder.aWorkflowProcessor()
.withLifecycleManager(lifecycleManager)
.withPriority(priority);
SequentialProcessor processor = (SequentialProcessor)builder.build(SequentialProcessor.class);
processor.setWorkflowInstance(inst);
processor.setState(lifecycleManager.getDefaultLifecycle().createState(
stateName, categoryName, ""));
assertNotNull(processor.getState());
assertNotNull(processor.getState().getCategory());
assertNotNull(processor.getState().getCategory().getName());
List<WorkflowProcessor> runnables = new Vector<WorkflowProcessor>();
TaskProcessor taskProcessor = (TaskProcessor)builder.build(TaskProcessor.class);
taskProcessor.setState(lifecycleManager.getDefaultLifecycle().createState(
"Queued", "waiting", ""));
runnables.add(taskProcessor);
processor.setSubProcessors(runnables);
return processor;
}