1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ken.services.impl;
17
18 import org.junit.Ignore;
19 import org.junit.Test;
20 import org.kuali.rice.ken.service.impl.NotificationRecipientServiceKimImpl;
21 import org.kuali.rice.ken.test.KENTestCase;
22 import org.kuali.rice.ken.test.TestConstants;
23 import org.kuali.rice.kew.util.Utilities;
24 import org.kuali.rice.kim.api.KimConstants.KimGroupMemberTypes;
25 import org.kuali.rice.kim.api.group.Group;
26 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
27
28 import static org.junit.Assert.*;
29
30
31
32
33
34
35
36 public class NotificationRecipientServiceKimImplTest extends KENTestCase {
37
38 NotificationRecipientServiceKimImpl nrski = new NotificationRecipientServiceKimImpl();
39
40
41
42
43 @Test
44 public void testGetGroupMembersValid() {
45 Group group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
46 Utilities.parseGroupNamespaceCode(TestConstants.VALID_KIM_GROUP_NAME_1), Utilities.parseGroupName(
47 TestConstants.VALID_KIM_GROUP_NAME_1));
48 assertTrue(nrski.getGroupMembers(group.getId()).length == TestConstants.KIM_GROUP_1_MEMBERS);
49 }
50
51
52
53
54 @Test
55 @Ignore
56 public final void testGetUserDisplayName() {
57
58 fail("Not yet implemented");
59 }
60
61
62
63
64 @Test
65 public final void testIsGroupRecipientValid() {
66 Group group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
67 Utilities.parseGroupNamespaceCode(TestConstants.VALID_KIM_GROUP_NAME_1), Utilities.parseGroupName(
68 TestConstants.VALID_KIM_GROUP_NAME_1));
69 assertTrue(nrski.isGroupRecipientValid(group.getId()));
70 }
71
72
73
74
75 @Test
76 public final void testIsRecipientValid() {
77 assertTrue( nrski.isRecipientValid( TestConstants.VALID_KIM_PRINCIPAL_NAME, KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode()));
78 assertFalse( nrski.isRecipientValid( "BoogalooShrimp44", KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode()));
79
80 Group group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
81 Utilities.parseGroupNamespaceCode(TestConstants.VALID_KIM_GROUP_NAME_1), Utilities.parseGroupName(
82 TestConstants.VALID_KIM_GROUP_NAME_1));
83 assertTrue( nrski.isRecipientValid( group.getId(), KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode()));
84 assertFalse( nrski.isRecipientValid( "FooSchnickens99", KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode()));
85 }
86
87
88
89
90 @Test
91 public final void testIsUserRecipientValid() {
92 assertTrue( nrski.isUserRecipientValid( TestConstants.VALID_KIM_PRINCIPAL_NAME ));
93 }
94 }