Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MockMessageDeliverer |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2005-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kcb.deliverer.impl; | |
17 | ||
18 | import java.util.HashMap; | |
19 | import java.util.LinkedHashMap; | |
20 | import java.util.Map; | |
21 | ||
22 | import org.kuali.rice.kcb.bo.MessageDelivery; | |
23 | import org.kuali.rice.kcb.deliverer.MessageDeliverer; | |
24 | import org.kuali.rice.kcb.exception.ErrorList; | |
25 | import org.kuali.rice.kcb.api.exception.MessageDeliveryException; | |
26 | import org.kuali.rice.kcb.api.exception.MessageDismissalException; | |
27 | ||
28 | /** | |
29 | * A mock message deliverer that does nothing | |
30 | * | |
31 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
32 | * | |
33 | */ | |
34 | 0 | public class MockMessageDeliverer implements MessageDeliverer { |
35 | /** | |
36 | * Map of deliveries | |
37 | */ | |
38 | 0 | private final Map<Long, MessageDelivery> deliveries = new HashMap<Long, MessageDelivery>(); |
39 | ||
40 | /** | |
41 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#deliver(org.kuali.rice.kcb.bo.MessageDelivery) | |
42 | */ | |
43 | public void deliver(MessageDelivery messageDelivery) throws MessageDeliveryException { | |
44 | 0 | deliveries.put(messageDelivery.getId(), messageDelivery); |
45 | 0 | } |
46 | ||
47 | /** | |
48 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#dismiss(org.kuali.rice.kcb.bo.MessageDelivery, java.lang.String, java.lang.String) | |
49 | */ | |
50 | public void dismiss(MessageDelivery messageDelivery, String user, String cause) throws MessageDismissalException { | |
51 | 0 | deliveries.remove(messageDelivery.getId()); |
52 | ||
53 | 0 | } |
54 | ||
55 | /** | |
56 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getDescription() | |
57 | */ | |
58 | public String getDescription() { | |
59 | 0 | return getName(); |
60 | } | |
61 | ||
62 | /** | |
63 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getName() | |
64 | */ | |
65 | public String getName() { | |
66 | 0 | return "Mock"; |
67 | } | |
68 | ||
69 | /** | |
70 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getPreferenceKeys() | |
71 | */ | |
72 | public LinkedHashMap<String, String> getPreferenceKeys() { | |
73 | // none for now | |
74 | 0 | return new LinkedHashMap<String, String>(); |
75 | } | |
76 | ||
77 | /** | |
78 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getTitle() | |
79 | */ | |
80 | public String getTitle() { | |
81 | 0 | return getName(); |
82 | } | |
83 | ||
84 | /** | |
85 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#validatePreferenceValues(java.util.HashMap) | |
86 | */ | |
87 | public void validatePreferenceValues(HashMap prefs) throws ErrorList { | |
88 | // no validation for now | |
89 | 0 | } |
90 | } |