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
23
24 import static org.junit.Assert.assertEquals;
25 import static org.junit.Assert.assertNotNull;
26
27 import org.apache.turbine.services.TurbineServices;
28 import org.apache.turbine.services.velocity.VelocityService;
29 import org.apache.turbine.test.BaseTestCase;
30 import org.apache.turbine.util.TurbineConfig;
31 import org.junit.AfterClass;
32 import org.junit.BeforeClass;
33 import org.junit.Test;
34
35
36
37
38
39
40
41
42
43 public class InitTest
44 extends BaseTestCase
45 {
46 private static TurbineConfig tc = null;
47 private static TemplateService ts = null;
48
49
50 @BeforeClass
51 public static void setUp() throws Exception
52 {
53 tc = new TurbineConfig(".", "/conf/test/TemplateService.properties");
54 tc.initialize();
55
56 ts = (TemplateService) TurbineServices.getInstance().getService(TemplateService.SERVICE_NAME);
57 }
58
59 @AfterClass
60 public static void tearDown() throws Exception
61 {
62 if (tc != null)
63 {
64 tc.dispose();
65 }
66 }
67
68 @Test public void testService()
69 throws Exception
70 {
71
72
73 assertNotNull("Could not load Service!", ts);
74
75
76 VelocityService vs = (VelocityService) TurbineServices
77 .getInstance().getService(VelocityService.SERVICE_NAME);
78
79 TemplateEngineService tes = ts.getTemplateEngineService("foo.vm");
80
81 assertEquals("Template Service did not return Velocity Service for .vm Templates", vs, tes);
82 }
83 }