You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/11/09 22:38:52 UTC

svn commit: r473079 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/suites/jdbcxa40.properties functionTests/suites/jdbcxa40.runall junit/TestConfiguration.java

Author: djd
Date: Thu Nov  9 13:38:52 2006
New Revision: 473079

URL: http://svn.apache.org/viewvc?view=rev&rev=473079
Log:
DERBY-1952 DERBY-2047 Remove the remaining code directly related to derbyTesting.xa.single.
This functionality has been replaced with a decorator.

Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcxa40.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcxa40.runall
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?view=diff&rev=473079&r1=473078&r2=473079
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Thu Nov  9 13:38:52 2006
@@ -60,7 +60,6 @@
     private final static String KEY_HOSTNAME = "hostName";
     private final static String KEY_PORT = "port";
     private final static String KEY_VERBOSE = "derby.tests.debug";    
-    private final static String KEY_SINGLE_LEG_XA = "derbyTesting.xa.single";
     
     /**
      * Simple count to provide a unique number for database
@@ -114,10 +113,6 @@
         // running in harness
         if (BaseTestCase.getSystemProperty("derby.system.home") != null)
             assumeHarness = true;
-        
-        // If forced into single leg XA, assume harness
-        if (DERBY_HARNESS_CONFIG.isSingleLegXA())
-            assumeHarness = true;
 
         DEFAULT_CONFIG = assumeHarness ? DERBY_HARNESS_CONFIG : JUNIT_CONFIG;
         runningInDerbyHarness = assumeHarness;
@@ -222,13 +217,13 @@
     /**
      * Return a decorator for the passed in tests that sets the
      * configuration for the client to be Derby's JDBC client
-     * and to start the network server at setUp if it is not
-     * already started.
+     * and to start the network server at setUp.
      * <BR>
      * The database configuration (name etc.) is based upon
      * the previous configuration.
      * <BR>
-     * The previous TestConfiguration is restored at tearDown.
+     * The previous TestConfiguration is restored at tearDown and
+     * the network server is shutdown.
      * @param tests
      * @return
      */
@@ -243,7 +238,7 @@
             new TestConfiguration(config, JDBCClient.DERBYNETCLIENT,
                     DEFAULT_HOSTNAME, DEFAULT_PORT);
                    
-        Test test = new NetworkServerTestSetup(suite);
+        Test test = new NetworkServerTestSetup(suite, false);
             
         return new ChangeConfigurationSetup(derbyClientConfig, test);
 
@@ -373,7 +368,6 @@
         this.userPassword = DEFAULT_USER_PASSWORD;
         this.hostName = null;
         this.port = -1;
-        this.singleLegXA = false;
         
         this.jdbcClient = JDBCClient.getDefaultEmbedded();
         url = createJDBCUrlWithDatabaseName(dbName);
@@ -389,7 +383,6 @@
         this.userPassword = copy.userPassword;
 
         this.isVerbose = copy.isVerbose;
-        this.singleLegXA = copy.singleLegXA;
         this.port = port;
         
         this.jdbcClient = client;
@@ -414,7 +407,6 @@
         this.userPassword = password;
 
         this.isVerbose = copy.isVerbose;
-        this.singleLegXA = copy.singleLegXA;
         this.port = copy.port;
         
         this.jdbcClient = copy.jdbcClient;
@@ -436,7 +428,6 @@
         this.userPassword = copy.userPassword;
 
         this.isVerbose = copy.isVerbose;
-        this.singleLegXA = copy.singleLegXA;
         this.port = copy.port;
         
         this.jdbcClient = copy.jdbcClient;
@@ -461,8 +452,6 @@
         hostName = props.getProperty(KEY_HOSTNAME, DEFAULT_HOSTNAME);
         isVerbose = Boolean.valueOf(props.getProperty(KEY_VERBOSE)).booleanValue();
         String portStr = props.getProperty(KEY_PORT);
-        singleLegXA = Boolean.valueOf(props.getProperty(KEY_SINGLE_LEG_XA)
-                            ).booleanValue();
         if (portStr != null) {
             try {
                 port = Integer.parseInt(portStr);
@@ -512,11 +501,13 @@
     private String createJDBCUrlWithDatabaseName(String name) {
         if (JDBC.vmSupportsJDBC2())
         {
+            String url;
            if (jdbcClient.isEmbedded()) {
-               return jdbcClient.getUrlBase() + name;
+               url = jdbcClient.getUrlBase();
            } else {
-               return jdbcClient.getUrlBase() + hostName + ":" + port + "/" + name;
+               url = jdbcClient.getUrlBase() + hostName + ":" + port + "/";
            }
+           return url.concat(name);
         }
         // No DriverManager support so no URL support.
         return null;
@@ -660,19 +651,12 @@
         JDBCClient client =getJDBCClient();
         if (JDBC.vmSupportsJDBC2()) {            
             loadJDBCDriver(client.getJDBCDriverName());
-            if (!isSingleLegXA()) {
+            {
                 con = DriverManager.getConnection(
                         getJDBCUrl(databaseName) + ";" + connAttrs,
                         getUserName(),
                         getUserPassword());
             }
-            else {
-                Properties attrs = 
-                	getDataSourcePropertiesForDatabase(databaseName, connAttrs);
-                con = TestDataSourceFactory.getXADataSource(attrs).
-                        getXAConnection (getUserName(), 
-                        getUserPassword()).getConnection();
-            }
         } else {
             //Use DataSource for JSR169
             Properties attrs = getDataSourcePropertiesForDatabase(databaseName, connAttrs);
@@ -699,6 +683,8 @@
     /**
      * Shutdown the engine for this configuration
      * assuming it is booted.
+     * This method can only be called when the engine
+     * is running embedded in this JVM.
      *
      */
     public void shutdownEngine()
@@ -747,14 +733,6 @@
     {
         return runningInDerbyHarness;
     }
-
-    /**
-     * Return if it has to run under single legged xa transaction
-     * @return singleLegXA
-     */
-    public boolean isSingleLegXA () {
-        return singleLegXA;
-    }
     
     /**
      * Get a folder already created where a test can
@@ -822,7 +800,6 @@
     private final String hostName;
     private final JDBCClient jdbcClient;
     private boolean isVerbose;
-    private final boolean singleLegXA;
     
     /**
      * Indirection for obtaining connections based upon