*/
public void test() throws IOException, ComponentException, GraphException,
ComponentRegistryException, MonitorException {
WorkflowCreator creator = new WorkflowCreator();
Workflow workflow = creator.createComplexMathWorkflow();
WorkflowClient.createScript(workflow);
Monitor monitor;
if (this.gui) {
this.engine = new XBayaEngine(this.configuration);
this.graphCanvas = this.engine.getGUI().getGraphCanvas();
this.graphCanvas.setWorkflow(workflow);
monitor = this.engine.getMonitor();
this.engine.getGUI().eventReceived(new Event(Type.MONITOR_STARTED));
repaintAndWait(2);
} else {
MonitorConfiguration monitorConfiguration = new MonitorConfiguration(
this.configuration.getBrokerURL(), this.configuration
.getTopic(), this.configuration.isPullMode(),
this.configuration.getMessageBoxURL());
monitor = new Monitor(monitorConfiguration);
}
MonitorEventData eventData = monitor.getEventData();
MonitorCallback callback = new MonitorCallback(eventData);
LoopbackPublisher publisher = new LoopbackPublisher(callback,
this.configuration.getTopic());
MonitorNotifier notifier = new MonitorNotifier(publisher);
executeToMiddle(workflow, notifier);
modifyWorkflow(workflow);
File modifiedWorkflowFile = new File(this.temporalDirectory,
"complex-math-modified.xwf");
XMLUtil.saveXML(workflow.toXML(), modifiedWorkflowFile);
// Create a diff workflow
WorkflowModifier modifier = new WorkflowModifier(workflow, eventData);
Workflow diffWorkflow = modifier.createDifference();
if (this.gui) {
GraphCanvas canvas = this.engine.getGUI().newGraphCanvas(true);
canvas.setWorkflow(diffWorkflow);
repaintAndWait(5);
}
File diffWorkflowFile = new File(this.temporalDirectory,
"complex-math-diff.xwf");
XMLUtil.saveXML(diffWorkflow.toXML(), diffWorkflowFile);
}