try {
procDefDir = workflowService.processDefinitionDirectory();
procDir = workflowService.processDirectory();
ProcessMgr pmgr = procDefDir.processMgr
("chabacc", "chabacc_test_xml_receiver");
WfProcess process
= pmgr.createProcess(new DefaultRequester (workflowService));
chan = workflowService.getChannel(process, "test_channel");
DocumentBuilderFactory df = DocumentBuilderFactory.newInstance ();
Document doc = df.newDocumentBuilder ().newDocument ();
DocumentFragment frag = doc.createDocumentFragment ();
frag.appendChild(doc.createElement ("root"));
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer ();
SAXEventBufferImpl b = new SAXEventBufferImpl ();
t.transform (new DOMSource (frag), new SAXResult(b));
b.pack();
Map pd = new HashMap ();
pd.put ("message", b);
chan.sendMessage(pd);
Thread.sleep (500);
process.start();
assertTrue (stateReached (process, "closed.completed"));
pd = process.processContext();
Object o = pd.get("lastXMLMessage");
assertTrue (o != null);
assertTrue (o instanceof SAXContentBuffer);
Node recDoc = ((SAXContentBuffer)o).toW3cDom();
assertTrue (recDoc instanceof Document);