1 package org.apache.turbine.services.template; 2 3 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 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 assertNotNull("Could not load Service!", ts); 64 65 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 } 74 | Popular Tags |