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("/melatitest/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 System.err.println(e);
77 assertTrue(e.getMessage().indexOf("is not a valid language tag")>= 0);
78 }
79
80 }
81
82
83
84
85 public void testMelatiConfigProperties() throws Exception {
86 Properties p = new Properties();
87 p.setProperty("org.melati.MelatiConfig.staticURL", "test");
88 MelatiConfig mc = new MelatiConfig(p);
89 assertEquals("test", mc.getStaticURL());
90 }
91
92
93
94 public void testGetServletTemplateEngine() {
95
96 }
97
98
99
100
101 public void testGetTemplateEngine() {
102
103 }
104
105
106
107
108 public void testSetTemplateEngine() {
109
110 }
111
112
113
114
115 public void testGetAccessHandler() {
116
117 }
118
119
120
121
122 public void testSetAccessHandler() {
123
124 }
125
126
127
128
129 public void testGetTempletLoader() {
130
131 }
132
133
134
135
136 public void testSetTempletLoader() {
137
138 }
139
140
141
142
143 public void testGetFormDataAdaptorFactory() {
144
145 }
146
147
148
149
150 public void testSetFormDataAdaptorFactory() {
151
152 }
153
154
155
156
157 public void testGetJavascriptLibraryURL() {
158
159 }
160
161
162
163
164 public void testSetJavascriptLibraryURL() {
165
166 }
167
168
169
170
171 public void testGetStaticURL() {
172
173 }
174
175
176
177
178 public void testSetStaticURL() {
179
180 }
181
182
183
184
185
186
187
188 public void testGetTemplatePath()
189 throws Exception {
190 MelatiConfig mc = new MelatiConfig();
191 assertEquals(".", mc.getTemplatePath());
192 }
193
194
195
196
197 public void testSetTemplatePath() {
198
199 }
200
201
202
203
204
205 public void testGetLogoutPageServletClassName() throws Exception {
206 assertEquals("org.melati.login.Logout", MelatiConfig.getLogoutPageServletClassName());
207 }
208
209
210
211
212 public void testSetLogoutPageServletClassName() {
213
214 }
215
216
217
218
219
220 public void testGetLoginPageServletClassName() throws Exception {
221 assertEquals("org.melati.login.Login", MelatiConfig.getLoginPageServletClassName());
222 }
223
224
225
226
227 public void testSetLoginPageServletClassName() {
228
229 }
230
231
232
233
234 public void testGetPoemLocale() throws Exception {
235
236
237
238 }
239
240
241
242
243 public void testSetPoemLocale() {
244
245 }
246
247
248
249
250 public void testGetPreferredCharsets() {
251
252 }
253
254
255
256
257 public void testSetPreferredCharsets() {
258
259 }
260
261
262
263
264
265 public void testGetFdaFactory() throws Exception {
266 MelatiConfig mc = new MelatiConfig();
267 FormDataAdaptorFactory fdaf = mc.getFdaFactory();
268 assertNotNull(fdaf);
269 }
270
271
272
273
274
275 public void testSetFdaFactory() throws Exception {
276 }
277
278
279
280
281
282 public void testGetYMDDateAdaptor() throws Exception {
283 YMDDateAdaptor it = MelatiConfig.getYMDDateAdaptor();
284 assertNotNull(it);
285
286 }
287
288
289
290
291
292 public void testGetYMDHMSTimestampAdaptor() throws Exception {
293 YMDHMSTimestampAdaptor it = MelatiConfig.getYMDHMSTimestampAdaptor();
294 assertNotNull(it);
295 }
296
297
298
299
300
301 public void testGetSimpleDateAdaptor() throws Exception {
302 SimpleDateAdaptor it = MelatiConfig.getSimpleDateAdaptor();
303 assertNotNull(it);
304 }
305
306 }