Clover Coverage Report - kew-test 2.0.0-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
10   60   2   5
0   27   0.2   2
2     1  
1    
 
  ServiceInvocationRuleTest       Line # 37 10 0% 2 12 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.kuali.rice.kew.rule;
17   
18    import org.junit.Test;
19    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
21   
22    import org.kuali.rice.kew.exception.WorkflowException;
23    import org.kuali.rice.kew.service.WorkflowDocument;
24    import org.kuali.rice.kew.test.FakeService;
25    import org.kuali.rice.kew.test.FakeServiceImpl.Invocation;
26    import org.kuali.rice.kew.test.KEWTestCase;
27   
28    import javax.xml.namespace.QName;
29   
30    import static org.junit.Assert.*;
31   
32   
33    /**
34    * Tests that a groovy expression in a rule can invoke an arbitrary service on the KSB
35    * @author Kuali Rice Team (rice.collab@kuali.org)
36    */
 
37    public class ServiceInvocationRuleTest extends KEWTestCase {
 
38  0 toggle protected void loadTestData() throws Exception {
39  0 loadXmlFile("ServiceInvokingRule.xml");
40    }
41   
 
42  0 toggle @Test public void testServiceInvokingRule() throws WorkflowException {
43    // test that we can get the service to start with
44  0 FakeService fakeService = (FakeService) GlobalResourceLoader.getService(new QName("fake", "fakeService-remote"));
45  0 assertNotNull(fakeService);
46   
47   
48  0 WorkflowDocument doc = new WorkflowDocument(getPrincipalIdForName("arh14"), "ServiceInvocationRuleTest");
49  0 doc.routeDocument("routing");
50   
51    // no requests whatsoever were sent...we're done
52  0 assertTrue(doc.stateIsFinal());
53   
54  0 fakeService = (FakeService) GlobalResourceLoader.getService(new QName("fake", "fakeService-remote"));
55   
56  0 assertEquals(1, fakeService.getInvocations().size());
57  0 Invocation invocation = fakeService.getInvocations().get(0);
58  0 assertEquals("method2", invocation.methodName);
59    }
60    }