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 km...@apache.org on 2010/06/23 00:49:23 UTC

svn commit: r957069 - in /db/derby/code/branches/10.5: ./ java/testing/org/apache/derbyTesting/functionTests/master/ java/testing/org/apache/derbyTesting/functionTests/suites/ java/testing/org/apache/derbyTesting/functionTests/tests/store/ java/testing...

Author: kmarsden
Date: Tue Jun 22 22:49:22 2010
New Revision: 957069

URL: http://svn.apache.org/viewvc?rev=957069&view=rev
Log:
DERBY-4179 bootLock.java fails with missing exception if spawned process fails.
DERBY-4667 BootLockTest.testBootLock() sometimes fails with connection refused.

Convert bootLock.java to JUnit
contributed mostly by Dag Wanvik



Added:
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
      - copied unchanged from r957000, db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
      - copied unchanged from r957000, db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
Removed:
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/bootLock.out
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock1.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock_app.properties
Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 22 22:49:22 2010
@@ -1 +1,2 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,835286,881074,881444,882732,884163,887246,892912,897161,901165,901648,901760,903108,908418,911315,915733,916075,916897,918359,921028,927430,928065,946794,948045,948069,951346,955001
+/db/derby/code/branches/10.6:957000
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,835286,881074,881444,882732,884163,887246,892912,897161,901165,901648,901760,903108,908418,911315,915733,916075,916897,918359,921028,927430,928065,942286,942476,942480,942587,946794,948045,948069,951346,955001,956075,956445,956659

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall?rev=957069&r1=957068&r2=957069&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall Tue Jun 22 22:49:22 2010
@@ -22,7 +22,6 @@ store/rollForwardRecovery.sql
 store/readlocks.sql
 store/backupRestore.sql
 store/backupRestore1.java
-store/bootLock.java
 store/bug3498.sql
 store/Beetle6038.java
 store/holdCursorJDBC30.sql

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=957069&r1=957068&r2=957069&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java Tue Jun 22 22:49:22 2010
@@ -55,6 +55,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(ClassLoaderBootTest.suite());
         suite.addTest(StreamingColumnTest.suite());
         suite.addTest(Derby3625Test.suite());
+        suite.addTest(BootLockTest.suite());
         suite.addTest(PositionedStoreStreamTest.suite());
         suite.addTest(OSReadOnlyTest.suite());
         suite.addTest(BackupRestoreTest.suite());

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml?rev=957069&r1=957068&r2=957069&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml Tue Jun 22 22:49:22 2010
@@ -84,26 +84,6 @@
         <pathelement path="${junit}"/>
       </classpath>
       <include name="${this.dir}/*.java"/>
-      <exclude name="${this.dir}/bootLock.java"/>
-    </javac>
-    <javac
-      source="1.4"
-      target="1.4"
-      bootclasspath="${empty}"
-      nowarn="on"
-      debug="true"
-      depend="${depend}"
-      deprecation="${deprecation}"
-      optimize="${optimize}"
-      proceed="${proceed}"
-      verbose="${verbose}" 
-      srcdir="${derby.testing.src.dir}"
-      destdir="${out.dir}">
-      <classpath>
-        <!--pathelement location="${oro}"/-->
-        <pathelement path="${java14compile.classpath}"/>
-      </classpath>
-      <include name="${this.dir}/bootLock.java"/>
     </javac>
   </target>
 

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=957069&r1=957068&r2=957069&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Tue Jun 22 22:49:22 2010
@@ -530,20 +530,38 @@ public abstract class BaseTestCase
 	    return pr;
 	}
 
-	/**
-         * Return the executable name for spawning java commands.
-         * This will be <path to j9>/j9  for j9 jvms.
-	 * @return full path to java executable.
-         */
-         public static final String getJavaExecutableName() {
-             String vmname = getSystemProperty("com.ibm.oti.vm.exe");
-             if (vmname == null)
-                 vmname = getSystemProperty("java.home") + File.separator + "bin" +
-                 File.separator +"java";
-             return vmname;
-         }
-          
-   
+    /**
+     * Return the executable name for spawning java commands.
+     * This will be <path to j9>/j9  for j9 jvms.
+     * @return full path to java executable.
+     */
+    public static final String getJavaExecutableName() {
+        String vmname = getSystemProperty("com.ibm.oti.vm.exe");
+
+        if (vmname == null) {
+            vmname = getSystemProperty("java.vm.name");
+
+            // Sun phoneME
+            if ("CVM".equals(vmname)) {
+                vmname = getSystemProperty("java.home") +
+                    File.separator + "bin" +
+                    File.separator + "cvm";
+            } else {
+                vmname = getSystemProperty("java.home") +
+                    File.separator + "bin" +
+                    File.separator + "java";
+            }
+        }
+        return vmname;
+    }
+
+    /**
+     * @return true if this is a j9 VM
+     */
+    public static final boolean isJ9Platform() {
+        return getSystemProperty("com.ibm.oti.vm.exe") != null;
+    }
+
    /**
     * Reads output from a process and returns it as a string.
     * This will block until the process terminates.

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java?rev=957069&r1=957068&r2=957069&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java Tue Jun 22 22:49:22 2010
@@ -1,6 +1,6 @@
 /*
  *
- * Derby - Class org.apache.derbyTesting.functionTests.util.DatabasePropertyTestSetup
+ * Derby - Class org.apache.derbyTesting.junit.DatabasePropertyTestSetup
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=957069&r1=957068&r2=957069&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Tue Jun 22 22:49:22 2010
@@ -569,6 +569,26 @@ public class TestConfiguration {
         return new DatabaseChangeSetup(new DropDatabaseSetup(test, dbName), dbName, dbName, true);
     }
 
+
+    /**
+     * Decorate a test to use a new database that is created upon the first
+     * connection request to the database and shutdown & deleted at
+     * tearDown. The configuration differs only from the current configuration
+     * by the list of used databases. The generated database name is added at
+     * the end of <code>usedDbNames</code> and assigned as a default database
+     * name.  This decorator expects the database file to be local so it can be
+     * removed.
+     * @param test Test to be decorated
+     * @param dbName We sometimes need to know outside to be able topass it on
+     *               to other VMs/processes.
+     * @return decorated test.
+     */
+    public static TestSetup singleUseDatabaseDecorator(Test test, String dbName)
+    {
+        return new DatabaseChangeSetup(
+            new DropDatabaseSetup(test, dbName), dbName, dbName, true);
+    }
+
     /**
      * Decorate a test to use a new database that is created upon the
      * first connection request to the database and deleted at