1 package org.apache.turbine; 2 3 18 19 import junit.framework.Test; 20 import junit.framework.TestSuite; 21 22 import org.apache.torque.Torque; 23 import org.apache.turbine.services.TurbineServices; 24 import org.apache.turbine.services.avaloncomponent.AvalonComponentService; 25 import org.apache.turbine.test.BaseTestCase; 26 import org.apache.turbine.util.TurbineConfig; 27 28 35 public class TorqueLoadTest 36 extends BaseTestCase 37 { 38 public TorqueLoadTest(String name) 39 throws Exception 40 { 41 super(name); 42 } 43 44 public static Test suite() 45 { 46 return new TestSuite(TorqueLoadTest.class); 47 } 48 49 52 public void testTorqueNonInit() 53 throws Exception 54 { 55 assertFalse("Torque should not be initialized!", Torque.isInit()); 56 } 57 58 61 public void testTorqueManualInit() 62 throws Exception 63 { 64 assertFalse("Torque should not be initialized!", Torque.isInit()); 65 Torque.init("conf/test/TorqueTest.properties"); 66 assertTrue("Torque must be initialized!", Torque.isInit()); 67 Torque.shutdown(); 68 } 72 73 76 public void testTorqueComponentServiceInit() 77 throws Exception 78 { 79 assertFalse("Torque should not be initialized!", Torque.isInit()); 80 81 TurbineConfig tc = new TurbineConfig(".", "/conf/test/TurbineComponentService.properties"); 82 try 83 { 84 tc.initialize(); 85 assertTrue("Torque must be initialized!", Torque.isInit()); 86 } 87 catch (Exception e) 88 { 89 throw e; 90 } 91 finally 92 { 93 tc.dispose(); 94 } 95 } 99 100 private AvalonComponentService getService() 101 { 102 return (AvalonComponentService) TurbineServices.getInstance() 103 .getService(AvalonComponentService.SERVICE_NAME); 104 } 105 106 117 119 124 128 } 141 142 | Popular Tags |