db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r427298 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util: BaseJDBCTestCase.java JDBCClient.java TestConfiguration.java
Date Mon, 31 Jul 2006 21:42:26 GMT
Author: djd
Date: Mon Jul 31 14:42:26 2006
New Revision: 427298

URL: http://svn.apache.org/viewvc?rev=427298&view=rev
Log:
Change the JUnit JDBC client code to use DB2Client as the clearer name
when using DB2's JDBC driver, rather than the somewhat confusing DerbyNet.
DerbyNet is used in the old test harness, but going foward it would
be much clearer to call it what it is.
Use equality methods for checking which client is running, rather
than reference checks.
Add isEmbedded(, isDerbyNetClient and is isDB2Client methods to the JDBCClient class.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/JDBCClient.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java?rev=427298&r1=427297&r2=427298&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
Mon Jul 31 14:42:26 2006
@@ -62,7 +62,7 @@
      *         <code>false</code> otherwise.
      */
      public static boolean usingEmbedded() {
-         return (CONFIG.getJDBCClient() == JDBCClient.EMBEDDED);
+         return CONFIG.getJDBCClient().isEmbedded();
      }
     
     /**
@@ -72,7 +72,7 @@
     *         <code>false</code> otherwise.
     */
     public static boolean usingDerbyNetClient() {
-        return (CONFIG.getJDBCClient() == JDBCClient.DERBYNETCLIENT);
+        return CONFIG.getJDBCClient().isDerbyNetClient();
     }
     
     /**
@@ -82,7 +82,7 @@
     *         <code>false</code> otherwise.
     */
     public static boolean usingDerbyNet() {
-        return (CONFIG.getJDBCClient() == JDBCClient.DERBYNET);
+        return CONFIG.getJDBCClient().isDB2Client();
     }
 
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/JDBCClient.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/JDBCClient.java?rev=427298&r1=427297&r2=427298&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/JDBCClient.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/JDBCClient.java
Mon Jul 31 14:42:26 2006
@@ -29,7 +29,7 @@
     /**
      * The embedded JDBC client.
      */
-    public static JDBCClient EMBEDDED = new JDBCClient(
+    static final JDBCClient EMBEDDED = new JDBCClient(
             "Embedded", 
             "org.apache.derby.jdbc.EmbeddedDriver", 
             "org.apache.derby.jdbc.EmbeddedDataSource", 
@@ -38,20 +38,54 @@
     /**
      * The Derby network client.
      */
-    public static JDBCClient DERBYNETCLIENT= new JDBCClient(
+    static final JDBCClient DERBYNETCLIENT= new JDBCClient(
             "DerbyNetClient",
             "org.apache.derby.jdbc.ClientDriver",
             "org.apache.derby.jdbc.ClientDataSource",
             "jdbc:derby://");
     
     /**
-     * The JCC network client (the "old net" client for Derby).
+     * The DB2 Universal JDBC network client.
+     * AKA: JCC or DerbyNet.
+     * (the "old net" client for Derby).
      */
-    public static JDBCClient DERBYNET= new JDBCClient(
+    static final JDBCClient DB2CLIENT= new JDBCClient(
             "DerbyNet",
             "com.ibm.db2.jcc.DB2Driver",
             null,
             "jdbc:derby:net://");
+    
+    /**
+     * Is this the embdded client.
+    */
+    public boolean isEmbedded()
+    {
+    	return getName().equals(EMBEDDED.getName());
+    }
+    /**
+     * Is this Derby's network client.
+     * @return
+     */
+    public boolean isDerbyNetClient()
+    {
+    	return getName().equals(DERBYNETCLIENT.getName());
+    }
+    /**
+     * Is this DB2's Universal JDBC 
+     * @return
+     */
+    public boolean isDB2Client()
+    {
+    	return getName().equals(DB2CLIENT.getName());
+    }
+    
+    /**
+     * Get the name of the client
+     */
+    public String getName()
+    {
+    	return frameWork;
+    }
     
     /**
      * Get JDBC driver class name.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java?rev=427298&r1=427297&r2=427298&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java
Mon Jul 31 14:42:26 2006
@@ -89,7 +89,7 @@
         if ("DerbyNetClient".equals(framework)) {
             jdbcClient = JDBCClient.DERBYNETCLIENT;
         } else if ("DerbyNet".equals(framework)) {
-            jdbcClient = JDBCClient.DERBYNET;
+            jdbcClient = JDBCClient.DB2CLIENT;
         } else {
             jdbcClient = JDBCClient.EMBEDDED;
         }



Mime
View raw message