1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.jbpm;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.bpm.BPMS;
15 import org.mule.module.bpm.Process;
16 import org.mule.module.client.MuleClient;
17 import org.mule.tck.FunctionalTestCase;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22
23
24
25
26 public class MessagingJbpmComponentTestCase extends FunctionalTestCase
27 {
28 protected String getConfigResources()
29 {
30 return "jbpm-component-functional-test.xml";
31 }
32
33 public void testSendMessageProcess() throws Exception
34 {
35 BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
36 assertNotNull(bpms);
37
38 MuleClient client = new MuleClient(muleContext);
39 try
40 {
41
42 MuleMessage response = client.send("vm://message", "data", null);
43 Object process = response.getPayload();
44 assertTrue(bpms.isProcess(process));
45
46 String processId = (String)bpms.getId(process);
47
48 assertFalse(processId == null);
49 assertEquals("waitForResponse", bpms.getState(process));
50
51
52 Map props = new HashMap<String, Object>();
53 props.put(Process.PROPERTY_PROCESS_ID, processId);
54 response = client.send("vm://message", "data", props);
55 process = response.getPayload();
56
57
58 assertTrue(bpms.hasEnded(process));
59 }
60 finally
61 {
62 client.dispose();
63 }
64 }
65 }