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.DriverManager ; 12 import java.util.Properties ; 13 14 22 public class DriverTest extends AbstractProxoolTest { 23 24 private static final Log LOG = LogFactory.getLog(DriverTest.class); 25 26 public DriverTest(String alias) { 27 super(alias); 28 } 29 30 33 public void testAlias() throws Exception { 34 35 String testName = "alias"; 36 String alias = testName; 37 38 String url = TestHelper.buildProxoolUrl(alias, 40 TestConstants.HYPERSONIC_DRIVER, 41 TestConstants.HYPERSONIC_TEST_URL); 42 Properties info = new Properties (); 43 info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); 44 info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); 45 DriverManager.getConnection(url, info).close(); 46 assertEquals("servedCount", 1, ProxoolFacade.getSnapshot(alias).getServedCount()); 47 48 url = TestHelper.buildProxoolUrl(alias, 50 TestConstants.HYPERSONIC_DRIVER, 51 TestConstants.HYPERSONIC_TEST_URL); 52 DriverManager.getConnection(url).close(); 53 assertEquals("servedCount", 2, ProxoolFacade.getSnapshot(alias).getServedCount()); 54 55 url = TestHelper.buildProxoolUrl(alias); 57 DriverManager.getConnection(ProxoolConstants.PROXOOL + "." + alias).close(); 58 assertEquals("servedCount", 3, ProxoolFacade.getSnapshot(alias).getServedCount()); 59 60 } 61 62 63 } 64 65 66 | Popular Tags |