1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.util;
17
18 import java.util.Collection;
19 import java.util.Collections;
20
21 import org.kuali.rice.krad.messages.Message;
22 import org.kuali.rice.krad.messages.MessageService;
23
24
25
26
27
28
29 public class MockMessageService implements MessageService {
30
31
32
33
34
35 @Override
36 public Message getMessage(String namespace, String component, String key) {
37 Message rv = new Message();
38 rv.setNamespaceCode(namespace);
39 rv.setComponentCode(component);
40 rv.setKey(key);
41 rv.setText(getMessageText(namespace, component, key));
42 return rv;
43 }
44
45
46
47
48
49 @Override
50 public Message getMessage(String namespace, String component, String key, String locale) {
51 Message rv = new Message();
52 rv.setNamespaceCode(namespace);
53 rv.setComponentCode(component);
54 rv.setKey(key);
55 rv.setLocale(locale);
56 rv.setText(namespace + ":" + component + ":" + key + ":" + locale);
57 return rv;
58 }
59
60
61
62
63
64 @Override
65 public String getMessageText(String namespace, String component, String key) {
66 return namespace + ":" + component + ":" + key;
67 }
68
69
70
71
72
73 @Override
74 public String getMessageText(String namespace, String component, String key, String locale) {
75 return namespace + ":" + component + ":" + key + ":" + locale;
76 }
77
78
79
80
81 @Override
82 public String getMessageText(String key) {
83 return key;
84 }
85
86
87
88
89
90 @Override
91 public String getMessageText(String key, String locale) {
92 return key + ":" + locale;
93 }
94
95
96
97
98
99 @Override
100 public Collection<Message> getAllMessagesForComponent(String namespace, String component) {
101 Message rv = new Message();
102 rv.setNamespaceCode(namespace);
103 rv.setComponentCode(component);
104 rv.setText(namespace + ":" + component);
105 return Collections.singletonList(rv);
106 }
107
108
109
110
111
112 @Override
113 public Collection<Message> getAllMessagesForComponent(String namespace, String component, String locale) {
114 Message rv = new Message();
115 rv.setNamespaceCode(namespace);
116 rv.setComponentCode(component);
117 rv.setLocale(locale);
118 rv.setText(namespace + ":" + component + ":" + locale);
119 return Collections.singletonList(rv);
120 }
121
122 }