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.KewApiConstants;
27  import org.kuali.rice.kew.api.WorkflowDocument;
28  import org.kuali.rice.kew.api.WorkflowDocumentFactory;
29  import org.kuali.rice.kew.api.exception.WorkflowException;
30  import org.kuali.rice.kew.test.FakeService;
31  import org.kuali.rice.kew.test.FakeServiceImpl.Invocation;
32  import org.kuali.rice.kew.test.KEWTestCase;
33  
34  
35  
36  
37  
38  
39  public class ServiceInvocationRuleTest extends KEWTestCase {
40      protected void loadTestData() throws Exception {
41          loadXmlFile("ServiceInvokingRule.xml");
42      }
43  
44      @Test public void testServiceInvokingRule() throws WorkflowException {
45          
46          FakeService fakeService = (FakeService) GlobalResourceLoader.getService(new QName(KewApiConstants.Namespaces.KEW_NAMESPACE_2_0, "fakeService-remote"));
47          assertNotNull(fakeService);
48          
49          
50          WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "ServiceInvocationRuleTest");
51          doc.route("routing");
52  
53          
54          assertTrue(doc.isFinal());
55          
56          fakeService = (FakeService) GlobalResourceLoader.getService(new QName(KewApiConstants.Namespaces.KEW_NAMESPACE_2_0, "fakeService-remote"));
57          
58          assertEquals(1, fakeService.getInvocations().size());
59          Invocation invocation = fakeService.getInvocations().get(0);
60          assertEquals("method2", invocation.methodName);
61      }
62  }