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 public class SpringJbpmComponentTestCase extends FunctionalTestCase
26 {
27 protected String getConfigResources()
28 {
29 return "spring-jbpm-component.xml";
30 }
31
32 public void testSimpleProcess() throws Exception
33 {
34 BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
35 assertNotNull(bpms);
36
37 MuleClient client = new MuleClient(muleContext);
38 try
39 {
40
41 MuleMessage response = client.send("vm://simple", "data", null);
42 Object process = response.getPayload();
43
44 String processId = (String)bpms.getId(process);
45
46 assertFalse(processId == null);
47 assertEquals("dummyState", bpms.getState(process));
48
49
50 Map props = new HashMap();
51 props.put(Process.PROPERTY_PROCESS_ID, processId);
52 response = client.send("vm://simple", null, props);
53 process = response.getPayload();
54
55
56 assertTrue(bpms.hasEnded(process));
57 }
58 finally
59 {
60 client.dispose();
61 }
62 }
63 }