[jboss-cvs] JBoss Messaging SVN: r4404 - in trunk/tests/src/org/jboss/messaging/tests: integration/core/remoting/ssl and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 6 10:17:11 EDT 2008


Author: jmesnil
Date: 2008-06-06 10:17:11 -0400 (Fri, 06 Jun 2008)
New Revision: 4404

Added:
   trunk/tests/src/org/jboss/messaging/tests/util/SpawnedVMSupport.java
Removed:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/util/SpawnedVMSupport.java
Modified:
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java
Log:
moved SpawnedSupport helper class to o.j.m.tests.util package

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java	2008-06-06 13:47:44 UTC (rev 4403)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java	2008-06-06 14:17:11 UTC (rev 4404)
@@ -35,7 +35,7 @@
 import org.jboss.messaging.core.server.impl.MessagingServerImpl;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.unit.core.remoting.impl.ConfigurationHelper;
-import org.jboss.messaging.tests.unit.core.util.SpawnedVMSupport;
+import org.jboss.messaging.tests.util.SpawnedVMSupport;
 import org.jboss.messaging.util.SimpleString;
 
 /**

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java	2008-06-06 13:47:44 UTC (rev 4403)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java	2008-06-06 14:17:11 UTC (rev 4404)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.MessagingServerImpl;
 import org.jboss.messaging.tests.unit.core.remoting.impl.ConfigurationHelper;
-import org.jboss.messaging.tests.unit.core.util.SpawnedVMSupport;
+import org.jboss.messaging.tests.util.SpawnedVMSupport;
 import org.jboss.messaging.util.SimpleString;
 
 /**

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java	2008-06-06 13:47:44 UTC (rev 4403)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java	2008-06-06 14:17:11 UTC (rev 4404)
@@ -33,7 +33,7 @@
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.MessagingServerImpl;
 import org.jboss.messaging.tests.unit.core.remoting.impl.ConfigurationHelper;
-import org.jboss.messaging.tests.unit.core.util.SpawnedVMSupport;
+import org.jboss.messaging.tests.util.SpawnedVMSupport;
 import org.jboss.messaging.util.SimpleString;
 
 /**

Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/util/SpawnedVMSupport.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/util/SpawnedVMSupport.java	2008-06-06 13:47:44 UTC (rev 4403)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/util/SpawnedVMSupport.java	2008-06-06 14:17:11 UTC (rev 4404)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.messaging.tests.unit.core.util;
-
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static junit.framework.Assert.assertNotSame;
-import static junit.framework.Assert.assertSame;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeoutException;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * 
- * @version <tt>$Revision$</tt>
- * 
- */
-public class SpawnedVMSupport
-{
-   // Constants -----------------------------------------------------
-
-   private static final Logger log = Logger.getLogger(SpawnedVMSupport.class);
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   public static Process spawnVM(String className, String... args)
-         throws Exception
-   {
-      StringBuffer sb = new StringBuffer();
-
-      sb.append("java").append(' ');
-
-      String classPath = System.getProperty("java.class.path");
-      
-      // I guess it'd be simpler to check if the OS is Windows...
-      if (System.getProperty("os.name").equals("Linux")
-         || System.getProperty("os.name").equals("Mac OS X"))
-      {
-         sb.append("-cp").append(" ").append(classPath).append(" ");
-      } else
-      {
-         sb.append("-cp").append(" \"").append(classPath).append("\" ");
-      }
-
-      sb.append(className).append(' ');
-
-      for (int i = 0; i < args.length; i++)
-      {
-         sb.append(args[i]).append(' ');
-      }
-
-      String commandLine = sb.toString();
-
-      log.trace("command line: " + commandLine);
-
-      Process process = Runtime.getRuntime().exec(commandLine);
-
-      log.trace("process: " + process);
-
-      ProcessLogger outputLogger = new ProcessLogger(process.getInputStream(),
-            className);
-      outputLogger.start();
-
-      return process;
-   }
-
-   /**
-    * Assert that a process exits with the expected value (or not depending if
-    * the <code>sameValue</code> is expected or not). The method waits 5
-    * seconds for the process to exit, then an Exception is thrown. In any case,
-    * the process is destroyed before the method returns.
-    */
-   public static void assertProcessExits(boolean sameValue, int value,
-         final Process p) throws InterruptedException, ExecutionException,
-         TimeoutException
-   {
-      ScheduledExecutorService executor = Executors
-            .newSingleThreadScheduledExecutor();
-      Future<Integer> future = executor.submit(new Callable<Integer>()
-      {
-
-         public Integer call() throws Exception
-         {
-            p.waitFor();
-            return p.exitValue();
-         }
-      });
-      try
-      {
-         int exitValue = future.get(10, SECONDS);
-         if (sameValue)
-         {
-            assertSame(value, exitValue);
-         } else
-         {
-            assertNotSame(value, exitValue);
-         }
-      } finally
-      {
-         p.destroy();
-      }
-   }
-
-   /**
-    * Redirect the input stream to a logger (as debug logs)
-    */
-   static class ProcessLogger extends Thread
-   {
-      InputStream is;
-      Logger processLogger;
-
-      ProcessLogger(InputStream is, String className)
-            throws ClassNotFoundException
-      {
-         this.is = is;
-         this.processLogger = Logger.getLogger(Class.forName(className));
-         setDaemon(true);
-      }
-
-      public void run()
-      {
-         try
-         {
-            InputStreamReader isr = new InputStreamReader(is);
-            BufferedReader br = new BufferedReader(isr);
-            String line = null;
-            while ((line = br.readLine()) != null)
-               processLogger.info(line);
-         } catch (IOException ioe)
-         {
-            ioe.printStackTrace();
-         }
-      }
-   }
-   
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
-}

Copied: trunk/tests/src/org/jboss/messaging/tests/util/SpawnedVMSupport.java (from rev 4397, trunk/tests/src/org/jboss/messaging/tests/unit/core/util/SpawnedVMSupport.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/SpawnedVMSupport.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/util/SpawnedVMSupport.java	2008-06-06 14:17:11 UTC (rev 4404)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.tests.util;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static junit.framework.Assert.assertNotSame;
+import static junit.framework.Assert.assertSame;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeoutException;
+
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ * 
+ */
+public class SpawnedVMSupport
+{
+   // Constants -----------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(SpawnedVMSupport.class);
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   public static Process spawnVM(String className, String... args)
+         throws Exception
+   {
+      StringBuffer sb = new StringBuffer();
+
+      sb.append("java").append(' ');
+
+      String classPath = System.getProperty("java.class.path");
+      
+      // I guess it'd be simpler to check if the OS is Windows...
+      if (System.getProperty("os.name").equals("Linux")
+         || System.getProperty("os.name").equals("Mac OS X"))
+      {
+         sb.append("-cp").append(" ").append(classPath).append(" ");
+      } else
+      {
+         sb.append("-cp").append(" \"").append(classPath).append("\" ");
+      }
+
+      sb.append(className).append(' ');
+
+      for (int i = 0; i < args.length; i++)
+      {
+         sb.append(args[i]).append(' ');
+      }
+
+      String commandLine = sb.toString();
+
+      log.trace("command line: " + commandLine);
+
+      Process process = Runtime.getRuntime().exec(commandLine);
+
+      log.trace("process: " + process);
+
+      ProcessLogger outputLogger = new ProcessLogger(process.getInputStream(),
+            className);
+      outputLogger.start();
+
+      return process;
+   }
+
+   /**
+    * Assert that a process exits with the expected value (or not depending if
+    * the <code>sameValue</code> is expected or not). The method waits 5
+    * seconds for the process to exit, then an Exception is thrown. In any case,
+    * the process is destroyed before the method returns.
+    */
+   public static void assertProcessExits(boolean sameValue, int value,
+         final Process p) throws InterruptedException, ExecutionException,
+         TimeoutException
+   {
+      ScheduledExecutorService executor = Executors
+            .newSingleThreadScheduledExecutor();
+      Future<Integer> future = executor.submit(new Callable<Integer>()
+      {
+
+         public Integer call() throws Exception
+         {
+            p.waitFor();
+            return p.exitValue();
+         }
+      });
+      try
+      {
+         int exitValue = future.get(10, SECONDS);
+         if (sameValue)
+         {
+            assertSame(value, exitValue);
+         } else
+         {
+            assertNotSame(value, exitValue);
+         }
+      } finally
+      {
+         p.destroy();
+      }
+   }
+
+   /**
+    * Redirect the input stream to a logger (as debug logs)
+    */
+   static class ProcessLogger extends Thread
+   {
+      InputStream is;
+      Logger processLogger;
+
+      ProcessLogger(InputStream is, String className)
+            throws ClassNotFoundException
+      {
+         this.is = is;
+         this.processLogger = Logger.getLogger(Class.forName(className));
+         setDaemon(true);
+      }
+
+      public void run()
+      {
+         try
+         {
+            InputStreamReader isr = new InputStreamReader(is);
+            BufferedReader br = new BufferedReader(isr);
+            String line = null;
+            while ((line = br.readLine()) != null)
+               processLogger.info(line);
+         } catch (IOException ioe)
+         {
+            ioe.printStackTrace();
+         }
+      }
+   }
+   
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}




More information about the jboss-cvs-commits mailing list