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