1 package org.tigris.scarab.services.hsql; 2 55 56 import java.sql.Connection ; 57 import java.sql.DriverManager ; 58 59 import org.apache.fulcrum.TurbineServices; 60 import org.apache.fulcrum.hsqldb.HSQLService; 61 import org.apache.fulcrum.hsqldb.HSQLServiceImpl; 62 import org.apache.turbine.services.yaaficomponent.YaafiComponentService; 63 import org.tigris.scarab.test.BaseTurbineTestCase; 64 65 70 public class HSQLServiceTest extends BaseTurbineTestCase { 71 72 private HSQLServiceImpl server = null; 73 74 77 protected void setUp() throws Exception { 78 super.setUp(); 79 80 YaafiComponentService yaafi = (YaafiComponentService)TurbineServices.getInstance().getService(YaafiComponentService.SERVICE_NAME); 81 82 server = (HSQLServiceImpl)yaafi.lookup(HSQLService.class.getName()); 83 84 } 85 86 89 protected void tearDown() throws Exception { 90 server = null; 91 super.tearDown(); 92 } 93 94 public void testGetService() { 95 assertNotNull("Got no Service back", server); 96 } 97 98 public void testStarted() throws Exception { 99 100 assertTrue("Server was not started", server.isRunning()); 101 102 Class.forName("org.hsqldb.jdbcDriver"); 104 105 Connection conn = DriverManager.getConnection("jdbc:hsqldb:" 106 + "/scarab", "sa", ""); 109 assertFalse("Oops, hsqldb connection was not opened.", conn.isClosed()); 110 conn.close(); 111 } 112 113 114 115 } 116 | Popular Tags |