1 package org.apache.turbine.services.template;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.Test;
23 import junit.framework.TestSuite;
24
25 import org.apache.turbine.services.TurbineServices;
26 import org.apache.turbine.services.template.TemplateEngineService;
27 import org.apache.turbine.services.template.TemplateService;
28 import org.apache.turbine.services.velocity.VelocityService;
29 import org.apache.turbine.test.BaseTestCase;
30 import org.apache.turbine.util.TurbineConfig;
31
32 /***
33 * Tests startup of the Template Service and registration of the
34 * Velocity Service.
35 *
36 * @author <a href="hps@intermeta.de">Henning P. Schmiedehausen</a>
37 * @version $Id: InitTest.java 534527 2007-05-02 16:10:59Z tv $
38 */
39
40 public class InitTest
41 extends BaseTestCase
42 {
43 private static TurbineConfig tc = null;
44 private static TemplateService ts = null;
45
46 public InitTest(String name)
47 throws Exception
48 {
49 super(name);
50 tc = new TurbineConfig(".", "/conf/test/TemplateService.properties");
51 tc.initialize();
52
53 ts = (TemplateService) TurbineServices.getInstance().getService(TemplateService.SERVICE_NAME);
54 }
55
56 public static Test suite()
57 {
58 return new TestSuite(InitTest.class);
59 }
60
61 public void testService()
62 throws Exception
63 {
64
65
66 assertNotNull("Could not load Service!", ts);
67
68
69 VelocityService vs = (VelocityService) TurbineServices
70 .getInstance().getService(VelocityService.SERVICE_NAME);
71
72 TemplateEngineService tes = ts.getTemplateEngineService("foo.vm");
73
74 assertEquals("Template Service did not return Velocity Service for .vm Templates", vs, tes);
75 }
76 }