[hornetq-commits] JBoss hornetq SVN: r10104 - in trunk: tests/src/org/hornetq/tests/integration/client and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Jan 2 00:04:28 EST 2011


Author: igarashitm
Date: 2011-01-02 00:04:27 -0500 (Sun, 02 Jan 2011)
New Revision: 10104

Modified:
   trunk/src/main/org/hornetq/utils/VersionLoader.java
   trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
Log:
IncompatibleVersionTest: make sure the external server process has been terminated on the end of testcase


Modified: trunk/src/main/org/hornetq/utils/VersionLoader.java
===================================================================
--- trunk/src/main/org/hornetq/utils/VersionLoader.java	2011-01-02 02:59:42 UTC (rev 10103)
+++ trunk/src/main/org/hornetq/utils/VersionLoader.java	2011-01-02 05:04:27 UTC (rev 10104)
@@ -46,6 +46,12 @@
    {
       try
       {
+         PROP_FILE_NAME = System.getProperty(VersionLoader.VERSION_PROP_FILE_KEY); 
+         if(PROP_FILE_NAME == null)
+         {
+            PROP_FILE_NAME = VersionLoader.DEFAULT_PROP_FILE_NAME;
+         }
+
          VersionLoader.version = VersionLoader.load();
       }
       catch (Throwable e)
@@ -68,12 +74,6 @@
 
    private static Version load()
    {
-      PROP_FILE_NAME = System.getProperty(VersionLoader.VERSION_PROP_FILE_KEY); 
-      if(PROP_FILE_NAME == null)
-      {
-         PROP_FILE_NAME = VersionLoader.DEFAULT_PROP_FILE_NAME;
-      }
-      
       Properties versionProps = new Properties();
       InputStream in = VersionImpl.class.getClassLoader().getResourceAsStream(VersionLoader.PROP_FILE_NAME);
       try

Modified: trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java	2011-01-02 02:59:42 UTC (rev 10103)
+++ trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java	2011-01-02 05:04:27 UTC (rev 10104)
@@ -183,22 +183,37 @@
       prop.setProperty("hornetq.version.incrementingVersion", Integer.toString(ver));
       prop.store(new FileOutputStream("tests/tmpfiles/" + propFileName), null);
       
-      SpawnedVMSupport.spawnVM("org.hornetq.tests.integration.client.IncompatibleVersionTest",
-                               new String[]{"-D" + VersionLoader.VERSION_PROP_FILE_KEY + "=" + propFileName},
-                               "server",
-                               serverStartedString);
+      Process server = null;
+      boolean result = false;
+      try
+      {
+         server = SpawnedVMSupport.spawnVM("org.hornetq.tests.integration.client.IncompatibleVersionTest",
+                                           new String[]{"-D" + VersionLoader.VERSION_PROP_FILE_KEY + "=" + propFileName},
+                                           "server",
+                                           serverStartedString);
+         Thread.sleep(2000);
       
-      Thread.sleep(2000);
+         Process client = SpawnedVMSupport.spawnVM("org.hornetq.tests.integration.client.IncompatibleVersionTest",
+                                                   new String[]{"-D" + VersionLoader.VERSION_PROP_FILE_KEY + "=" + propFileName},
+                                                   "client");
       
-      Process client = SpawnedVMSupport.spawnVM("org.hornetq.tests.integration.client.IncompatibleVersionTest",
-                                                new String[]{"-D" + VersionLoader.VERSION_PROP_FILE_KEY + "=" + propFileName},
-                                                "client");
-      
-      boolean result = false;
-      if(client.waitFor() == 0)
+         if(client.waitFor() == 0)
+         {
+            result = true;
+         }
+      }
+      finally
       {
-         result = true;
+         if(server != null)
+         {
+            try
+            {
+               server.destroy();
+            }
+            catch(Throwable t) {/* ignore */}
+         }
       }
+      
       return result;
    }
    



More information about the hornetq-commits mailing list