1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ken.test.util;
17
18 import java.sql.Timestamp;
19 import java.util.List;
20
21 import org.kuali.rice.ken.bo.Notification;
22 import org.kuali.rice.ken.bo.NotificationChannel;
23 import org.kuali.rice.ken.bo.NotificationChannelReviewer;
24 import org.kuali.rice.ken.bo.NotificationContentType;
25 import org.kuali.rice.ken.bo.NotificationPriority;
26 import org.kuali.rice.ken.bo.NotificationProducer;
27 import org.kuali.rice.ken.bo.NotificationRecipient;
28 import org.kuali.rice.ken.bo.NotificationSender;
29 import org.kuali.rice.ken.util.NotificationConstants;
30 import org.kuali.rice.kim.util.KimConstants.KimGroupMemberTypes;
31
32
33
34
35
36 public class MockObjectsUtil {
37
38
39
40
41
42
43
44 public static final NotificationChannel buildTestNotificationChannel(String name, String description, boolean subscribable) {
45 NotificationChannel channel = new NotificationChannel();
46 channel.setName(name);
47 channel.setDescription(description);
48 channel.setSubscribable(subscribable);
49 return channel;
50 }
51
52
53
54
55
56 public static final NotificationChannel getTestChannel1() {
57 return buildTestNotificationChannel("Test Channel 1", "Test Channel 1 - description", true);
58 }
59
60
61
62
63
64 public static final NotificationChannel getTestChannel2() {
65 return buildTestNotificationChannel("Test Channel 2", "Test Channel 2 - description", false);
66 }
67
68
69
70
71
72
73
74
75 public static final NotificationProducer buildTestNotificationProducer(String name, String description, String contactInfo) {
76 NotificationProducer producer = new NotificationProducer();
77 producer.setName(name);
78 producer.setDescription(description);
79 producer.setContactInfo(contactInfo);
80 return producer;
81 }
82
83
84
85
86
87
88
89 public static final NotificationChannelReviewer buildTestNotificationChannelReviewer(String reviewerType, String reviewerId) {
90 NotificationChannelReviewer reviewer = new NotificationChannelReviewer();
91 reviewer.setReviewerType(reviewerType);
92 reviewer.setReviewerId(reviewerId);
93 return reviewer;
94 }
95
96
97
98
99
100 public static final NotificationProducer getTestProducer1() {
101 return buildTestNotificationProducer("Produer 1", "Producer 1 - description", "Producer 1 - contact info");
102 }
103
104
105
106
107
108
109
110
111
112 public static final NotificationContentType buildTestNotificationContentType(String name, String description, String namespace, String xsd, String xsl) {
113 NotificationContentType contentType = new NotificationContentType();
114 contentType.setName(name);
115 contentType.setDescription(description);
116 contentType.setNamespace(namespace);
117 contentType.setXsd(xsd);
118 contentType.setXsl(xsl);
119 return contentType;
120 }
121
122
123
124
125
126 public static final NotificationContentType getTestContentType1() {
127 return buildTestNotificationContentType("Content Type 1", "Content Type 1 - description", "Content Type 1 - namespace", "Simple.xsd", "Simple.xsl");
128 }
129
130
131
132
133
134
135
136
137 public static final NotificationPriority buildTestNotificationPriority(String name, String description, Integer order) {
138 NotificationPriority priority = new NotificationPriority();
139 priority.setName(name);
140 priority.setDescription(description);
141 priority.setOrder(order);
142 return priority;
143 }
144
145
146
147
148
149 public static final NotificationPriority getTestPriority1() {
150 return buildTestNotificationPriority("Priority 1", "Priority 1 - description", new Integer(1));
151 }
152
153
154
155
156
157
158
159 public static final NotificationRecipient buildTestNotificationRecipient(String recipientId, String recipientType) {
160 NotificationRecipient recipient = new NotificationRecipient();
161 recipient.setRecipientId(recipientId);
162 recipient.setRecipientType(recipientType);
163 return recipient;
164 }
165
166
167
168
169
170 public static final NotificationRecipient getTestRecipient1() {
171 return buildTestNotificationRecipient("ag266", KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE);
172 }
173
174
175
176
177
178 public static final NotificationRecipient getTestRecipient2() {
179 return buildTestNotificationRecipient("Notification Team", KimGroupMemberTypes.GROUP_MEMBER_TYPE);
180 }
181
182
183
184
185
186
187
188 public static final Notification buildTestNotification(String deliveryType, Timestamp sendDateTime, Timestamp autoRemoveDateTime, NotificationContentType contentType,
189 String content, NotificationPriority priority, NotificationProducer producer, NotificationChannel channel, List<NotificationRecipient> recipients,
190 List<NotificationSender> senders) {
191 Notification notification = new Notification();
192 notification.setCreationDateTime(new Timestamp(System.currentTimeMillis()));
193 notification.setDeliveryType(deliveryType);
194 notification.setSendDateTime(sendDateTime);
195 notification.setAutoRemoveDateTime(autoRemoveDateTime);
196 notification.setContentType(contentType);
197 notification.setContent(content);
198 notification.setPriority(priority);
199 notification.setProducer(producer);
200 notification.setChannel(channel);
201 notification.setRecipients(recipients);
202 notification.setSenders(senders);
203
204 return notification;
205 }
206
207
208
209
210
211
212
213 public static final NotificationSender buildTestNotificationSender(String userId) {
214 NotificationSender sender = new NotificationSender();
215 sender.setSenderName(userId);
216 return sender;
217 }
218
219
220
221
222
223 public static final NotificationSender getTestSender1() {
224 return buildTestNotificationSender("Joe Schmoe");
225 }
226
227
228
229
230
231 public static final NotificationSender getTestSender2() {
232 return buildTestNotificationSender("John Doe");
233 }
234 }