one 0 too many on username test
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 3 Jan 2011 23:28:42 +0000 (23:28 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 3 Jan 2011 23:28:42 +0000 (23:28 +0000)
make sure the driver correctly checks url

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1054824 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java
modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/driver/Driver.java

index 39c6aca..e910bbc 100644 (file)
@@ -34,12 +34,12 @@ import org.apache.tomcat.jdbc.test.driver.Driver;
 
 public class AlternateUsernameTest extends DefaultTestCase {
 
-    private static final int iterations = (new Random(System.currentTimeMillis())).nextInt(10000000)+100000;
+    private static final int iterations = (new Random(System.currentTimeMillis())).nextInt(1000000)+100000;
     public AlternateUsernameTest(String name) {
         super(name);
     }
     
-    public void testGeneric() throws Exception {
+    public void testUsernameCompare() throws Exception {
         
         this.init();
         this.datasource.setDriverClassName(Driver.class.getName());
@@ -74,6 +74,10 @@ public class AlternateUsernameTest extends DefaultTestCase {
 
     }
     
+    public void testUsernameCompareAgain() throws Exception {
+        testUsernameCompare();
+    }
+    
     public static class TestResult {
         public int iterations;
         public int failures;
index 95dfd6e..0b3d8cd 100644 (file)
@@ -46,7 +46,7 @@ public class Driver implements java.sql.Driver {
     }
     
     public boolean acceptsURL(String url) throws SQLException {
-        return url == Driver.url;
+        return url!=null && url.equals(Driver.url);
     }
 
     public Connection connect(String url, Properties info) throws SQLException {