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.assertTrue;
19 import static org.junit.Assert.fail;
20
21 import org.junit.Test;
22 import org.kuali.rice.core.api.config.property.Config;
23 import org.kuali.rice.core.api.config.property.ConfigContext;
24 import org.kuali.rice.kew.api.WorkflowDocument;
25 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
26 import org.kuali.rice.kew.test.KEWTestCase;
27 import org.kuali.rice.ksb.util.KSBConstants;
28
29
30
31
32
33
34 public class RoleAttributeTest extends KEWTestCase {
35
36 @Test public void testWorkgroupRoleAttribute() throws Exception {
37 loadXmlFile("WorkgroupRoleAttributeTestConfig.xml");
38 WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "WorkgroupRoleAttributeDocument");
39 document.route("");
40
41 assertTrue("document should be enroute.", document.isEnroute());
42 }
43
44
45
46
47
48 @Test public void testBadWorkgroupRoleAttribute() throws Exception {
49 loadXmlFile("BadWorkgroupRoleAttributeTestConfig.xml");
50 WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "BadWorkgroupRoleAttributeDocument");
51
52
53 ConfigContext.getCurrentContextConfig().putProperty(KSBConstants.Config.ALLOW_SYNC_EXCEPTION_ROUTING, "false");
54 try {
55 document.route("");
56 fail("Should have thrown an error because we had some bad ids.");
57 } catch (Exception e) {
58 } finally {
59
60 ConfigContext.getCurrentContextConfig().putProperty(KSBConstants.Config.ALLOW_SYNC_EXCEPTION_ROUTING, "true");
61 }
62 }
63 }