1
2
3
4 package org.melati.test;
5
6 import java.util.Properties;
7
8 import org.melati.MelatiConfig;
9 import org.melati.servlet.FormDataAdaptorFactory;
10 import org.melati.template.SimpleDateAdaptor;
11 import org.melati.template.YMDDateAdaptor;
12 import org.melati.template.YMDHMSTimestampAdaptor;
13 import org.melati.util.ConfigException;
14
15 import junit.framework.TestCase;
16
17
18
19
20
21 public class MelatiConfigTest extends TestCase {
22
23
24
25
26
27
28 public MelatiConfigTest(String name) {
29 super(name);
30 }
31
32
33
34
35 protected void setUp()
36 throws Exception {
37 super.setUp();
38 }
39
40
41
42
43 protected void tearDown()
44 throws Exception {
45 super.tearDown();
46 }
47
48
49
50
51 public void testMelatiConfig() {
52
53 }
54
55
56
57
58
59 public void testMelatiConfigString()
60 throws Exception {
61 MelatiConfig mc = new MelatiConfig("org.melati.MelatiConfig");
62 assertEquals("/melati-static/admin/static", mc.getStaticURL());
63
64 try {
65 mc = new MelatiConfig("nonexistantProperties");
66 fail("Should have blown up");
67 } catch (ConfigException e) {
68 assertTrue(e.getMessage().indexOf("Is it in your CLASSPATH")>= 0);
69 }
70
71
72 try {
73 mc = new MelatiConfig("bad.MelatiConfig");
74 fail("Should have blown up");
75 } catch (ConfigException e) {
76 assertTrue(e.getCause().getMessage().indexOf("is not a valid language tag")>= 0);
77 }
78
79 }
80
81
82
83
84 public void testMelatiConfigProperties() throws Exception {
85 Properties p = new Properties();
86 p.setProperty("org.melati.MelatiConfig.staticURL", "test");
87 MelatiConfig mc = new MelatiConfig(p);
88 assertEquals("test", mc.getStaticURL());
89 }
90
91
92
93 public void testGetServletTemplateEngine() {
94
95 }
96
97
98
99
100 public void testGetTemplateEngine() {
101
102 }
103
104
105
106
107 public void testSetTemplateEngine() {
108
109 }
110
111
112
113
114 public void testGetAccessHandler() {
115
116 }
117
118
119
120
121 public void testSetAccessHandler() {
122
123 }
124
125
126
127
128 public void testGetTempletLoader() {
129
130 }
131
132
133
134
135 public void testSetTempletLoader() {
136
137 }
138
139
140
141
142 public void testGetFormDataAdaptorFactory() {
143
144 }
145
146
147
148
149 public void testSetFormDataAdaptorFactory() {
150
151 }
152
153
154
155
156 public void testGetJavascriptLibraryURL() {
157
158 }
159
160
161
162
163 public void testSetJavascriptLibraryURL() {
164
165 }
166
167
168
169
170 public void testGetStaticURL() {
171
172 }
173
174
175
176
177 public void testSetStaticURL() {
178
179 }
180
181
182
183
184
185
186
187 public void testGetTemplatePath()
188 throws Exception {
189 MelatiConfig mc = new MelatiConfig();
190 assertEquals(".", mc.getTemplatePath());
191 }
192
193
194
195
196 public void testSetTemplatePath() {
197
198 }
199
200
201
202
203
204 public void testGetLogoutPageServletClassName() throws Exception {
205 assertEquals("org.melati.login.Logout", MelatiConfig.getLogoutPageServletClassName());
206 }
207
208
209
210
211 public void testSetLogoutPageServletClassName() {
212
213 }
214
215
216
217
218
219 public void testGetLoginPageServletClassName() throws Exception {
220 assertEquals("org.melati.login.Login", MelatiConfig.getLoginPageServletClassName());
221 }
222
223
224
225
226 public void testSetLoginPageServletClassName() {
227
228 }
229
230
231
232
233 public void testGetPoemLocale() throws Exception {
234
235
236
237 }
238
239
240
241
242 public void testSetPoemLocale() {
243
244 }
245
246
247
248
249 public void testGetPreferredCharsets() {
250
251 }
252
253
254
255
256 public void testSetPreferredCharsets() {
257
258 }
259
260
261
262
263
264 public void testGetFdaFactory() throws Exception {
265 MelatiConfig mc = new MelatiConfig();
266 FormDataAdaptorFactory fdaf = mc.getFdaFactory();
267 assertNotNull(fdaf);
268 }
269
270
271
272
273
274 public void testSetFdaFactory() throws Exception {
275 }
276
277
278
279
280
281 public void testGetYMDDateAdaptor() throws Exception {
282 YMDDateAdaptor it = MelatiConfig.getYMDDateAdaptor();
283 assertNotNull(it);
284
285 }
286
287
288
289
290
291 public void testGetYMDHMSTimestampAdaptor() throws Exception {
292 YMDHMSTimestampAdaptor it = MelatiConfig.getYMDHMSTimestampAdaptor();
293 assertNotNull(it);
294 }
295
296
297
298
299
300 public void testGetSimpleDateAdaptor() throws Exception {
301 SimpleDateAdaptor it = MelatiConfig.getSimpleDateAdaptor();
302 assertNotNull(it);
303 }
304
305 }