1 6 package org.logicalcobwebs.proxool; 7 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 11 import java.sql.Connection ; 12 import java.sql.DatabaseMetaData ; 13 import java.sql.DriverManager ; 14 import java.util.Properties ; 15 16 24 public class ProxyDatabaseMetaDataTest extends AbstractProxoolTest { 25 26 private static final Log LOG = LogFactory.getLog(ProxyDatabaseMetaDataTest.class); 27 28 public ProxyDatabaseMetaDataTest(String alias) { 29 super(alias); 30 } 31 32 36 public void testGetConnection() throws Exception { 37 38 String testName = "getConnection"; 39 String alias = testName; 40 41 String url = TestHelper.buildProxoolUrl(alias, 43 TestConstants.HYPERSONIC_DRIVER, 44 TestConstants.HYPERSONIC_TEST_URL); 45 Properties info = new Properties (); 46 info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); 47 info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); 48 ProxoolFacade.registerConnectionPool(url, info); 49 50 Connection connection = DriverManager.getConnection(url); 51 DatabaseMetaData dmd = connection.getMetaData(); 52 Connection retrievedConnection = dmd.getConnection(); 53 54 assertEquals("Retrieved connection not the same", connection, retrievedConnection); 55 assertEquals("Retrieved connection not the same", connection.getClass(), retrievedConnection.getClass()); 56 57 connection.close(); 58 59 } 60 61 } 62 63 64 | Popular Tags |