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