1 package org.apache.turbine;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import java.io.File;
25
26 import javax.servlet.ServletConfig;
27 import javax.servlet.ServletContext;
28
29 import org.apache.turbine.test.BaseTestCase;
30 import org.apache.turbine.util.TurbineConfig;
31 import org.apache.turbine.util.TurbineXmlConfig;
32
33
34
35
36
37
38
39
40 public class TurbineConfigTest
41 extends BaseTestCase
42 {
43 private static TurbineConfig tc = null;
44 private static TurbineXmlConfig txc = null;
45
46 public TurbineConfigTest(String name)
47 throws Exception
48 {
49 super(name);
50 }
51
52 public void testTurbineConfigWithPropertiesFile() throws Exception
53 {
54 String value = new File("/conf/test/TemplateService.properties").getPath();
55 tc = new TurbineConfig(".", value);
56
57 ServletConfig config = (ServletConfig) tc;
58 ServletContext context = config.getServletContext();
59
60 String confFile= Turbine.findInitParameter(context, config,
61 TurbineConfig.PROPERTIES_PATH_KEY,
62 null);
63 assertEquals(value, confFile);
64 }
65
66 public void testTurbineXmlConfigWithConfigurationFile() throws Exception
67 {
68 String value = new File("/conf/test/TurbineConfiguration.xml").getPath();
69 txc = new TurbineXmlConfig(".", value);
70
71 ServletConfig config = (ServletConfig) txc;
72 ServletContext context = config.getServletContext();
73
74 String confFile= Turbine.findInitParameter(context, config,
75 TurbineConfig.CONFIGURATION_PATH_KEY,
76 null);
77 assertEquals(value, confFile);
78 }
79 }