1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.workgroup;
17
18 import org.junit.Test;
19 import org.kuali.rice.kew.test.KEWTestCase;
20 import org.kuali.rice.kim.api.KimConstants;
21 import org.kuali.rice.kim.api.group.Group;
22 import org.kuali.rice.kim.api.group.GroupService;
23 import org.kuali.rice.kim.api.identity.IdentityService;
24 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
25 import org.kuali.rice.test.BaselineTestCase;
26
27 import java.util.List;
28
29 import static org.junit.Assert.assertNotNull;
30 import static org.junit.Assert.assertTrue;
31
32
33
34
35
36
37
38 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.NONE)
39 public class GroupXmlImportTest extends KEWTestCase {
40
41
42
43
44
45
46
47 @Test public void testGroupImportXml() throws Exception {
48 loadXmlFile("GroupXmlImportTest.xml");
49
50 IdentityService identityService = KimApiServiceLocator.getIdentityService();
51 GroupService groupService = KimApiServiceLocator.getGroupService();
52
53 Group group = groupService.getGroupByNamespaceCodeAndName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE,
54 "TestUserGroup");
55
56 assertNotNull(group);
57 List<String> members = groupService.getMemberPrincipalIds(group.getId());
58 List<String> groups = groupService.getMemberGroupIds(group.getId());
59 assertTrue(groupService.isMemberOfGroup(identityService.getPrincipalByPrincipalName("ewestfal").getPrincipalId(), group.getId()));
60 assertTrue(groupService.isMemberOfGroup(identityService.getPrincipalByPrincipalName("rkirkend").getPrincipalId(), group.getId()));
61 assertTrue(groupService.isMemberOfGroup("2015", group.getId()));
62 assertTrue(KimApiServiceLocator.getGroupService().isGroupMemberOfGroup(groupService.getGroupByNamespaceCodeAndName(
63 KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "TestWorkgroup").getId(), group.getId()));
64 }
65 }