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 @Test
43 public void testGetGroupMembersValid()
44 {
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
59 fail("Not yet implemented");
60 }
61
62
63
64
65 @Test
66 public final void testIsGroupRecipientValid()
67 {
68 Group group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
69 Utilities.parseGroupNamespaceCode(TestConstants.VALID_KIM_GROUP_NAME_1), Utilities.parseGroupName(
70 TestConstants.VALID_KIM_GROUP_NAME_1));
71 assertTrue(nrski.isGroupRecipientValid(group.getId()));
72 }
73
74
75
76
77 @Test
78 public final void testIsRecipientValid()
79 {
80 assertTrue( nrski.isRecipientValid( TestConstants.VALID_KIM_PRINCIPAL_NAME, KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode()));
81 assertFalse( nrski.isRecipientValid( "BoogalooShrimp44", KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode()));
82
83 Group group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
84 Utilities.parseGroupNamespaceCode(TestConstants.VALID_KIM_GROUP_NAME_1), Utilities.parseGroupName(
85 TestConstants.VALID_KIM_GROUP_NAME_1));
86 assertTrue( nrski.isRecipientValid( group.getId(), KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode()));
87 assertFalse( nrski.isRecipientValid( "FooSchnickens99", KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode()));
88 }
89
90
91
92
93 @Test
94 public final void testIsUserRecipientValid()
95 {
96 assertTrue( nrski.isUserRecipientValid( TestConstants.VALID_KIM_PRINCIPAL_NAME ));
97 }
98
99 }