1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.jbpm;
12
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertFalse;
15 import static org.junit.Assert.assertNotNull;
16 import static org.junit.Assert.assertTrue;
17
18 import org.mule.api.MuleMessage;
19 import org.mule.api.client.MuleClient;
20 import org.mule.module.bpm.BPMS;
21 import org.mule.module.bpm.Process;
22 import org.mule.tck.AbstractServiceAndFlowTestCase;
23
24 import java.util.Arrays;
25 import java.util.Collection;
26 import java.util.HashMap;
27 import java.util.Map;
28
29 import org.junit.Test;
30 import org.junit.runners.Parameterized.Parameters;
31
32
33
34
35 public class SimpleJbpmComponentTestCase extends AbstractServiceAndFlowTestCase
36 {
37 public SimpleJbpmComponentTestCase(ConfigVariant variant, String configResources)
38 {
39 super(variant, configResources);
40 }
41
42 @Parameters
43 public static Collection<Object[]> parameters()
44 {
45 return Arrays.asList(new Object[][]{
46 {ConfigVariant.SERVICE, "jbpm-component-functional-test-service.xml"},
47 {ConfigVariant.FLOW, "jbpm-component-functional-test-flow.xml"}
48 });
49 }
50
51 @Test
52 public void testSimpleProcess() throws Exception
53 {
54 MuleClient client = muleContext.getClient();
55 BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
56 assertNotNull(bpms);
57
58
59 MuleMessage response = client.send("vm://simple", "data", null);
60 Object process = response.getPayload();
61
62 String processId = (String)bpms.getId(process);
63
64 assertFalse(processId == null);
65 assertEquals("dummyState", bpms.getState(process));
66
67
68 Map<String, Object> props = new HashMap<String, Object>();
69 props.put(Process.PROPERTY_PROCESS_ID, processId);
70 response = client.send("vm://simple", null, props);
71 process = response.getPayload();
72
73
74 assertTrue(bpms.hasEnded(process));
75 }
76
77 }