1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.rule;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.assertTrue;
21
22 import javax.xml.namespace.QName;
23
24 import org.junit.Test;
25 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
26 import org.kuali.rice.kew.api.WorkflowDocument;
27 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
28 import org.kuali.rice.kew.api.exception.WorkflowException;
29 import org.kuali.rice.kew.test.FakeService;
30 import org.kuali.rice.kew.test.FakeServiceImpl.Invocation;
31 import org.kuali.rice.kew.test.KEWTestCase;
32
33
34
35
36
37
38 public class ServiceInvocationRuleTest extends KEWTestCase {
39 protected void loadTestData() throws Exception {
40 loadXmlFile("ServiceInvokingRule.xml");
41 }
42
43 @Test public void testServiceInvokingRule() throws WorkflowException {
44
45 FakeService fakeService = (FakeService) GlobalResourceLoader.getService(new QName("fake", "fakeService-remote"));
46 assertNotNull(fakeService);
47
48
49 WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "ServiceInvocationRuleTest");
50 doc.route("routing");
51
52
53 assertTrue(doc.isFinal());
54
55 fakeService = (FakeService) GlobalResourceLoader.getService(new QName("fake", "fakeService-remote"));
56
57 assertEquals(1, fakeService.getInvocations().size());
58 Invocation invocation = fakeService.getInvocations().get(0);
59 assertEquals("method2", invocation.methodName);
60 }
61 }