[Jboss-cvs] JBossAS SVN: r56133 - projects/test/trunk/test/src/main/org/jboss/test/util/server

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 21 16:42:49 EDT 2006


Author: rrajesh
Date: 2006-08-21 16:42:45 -0400 (Mon, 21 Aug 2006)
New Revision: 56133

Modified:
   projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java
   projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java
Log:
JBQA-292 Fixed spaces in path's for server starup and shutdown tasks

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java	2006-08-21 20:36:32 UTC (rev 56132)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java	2006-08-21 20:42:45 UTC (rev 56133)
@@ -31,7 +31,7 @@
 
 /**
  * A Server.
- * 
+ *
  * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
  * @version $Revision$
  */
@@ -75,10 +75,10 @@
 
    /** Is there a servlet engine? **/
    private boolean hasWebServer = true;
-   
+
    /**
     * Get the name.
-    * 
+    *
     * @return the name.
     */
    public String getName()
@@ -88,7 +88,7 @@
 
    /**
     * Set the name.
-    * 
+    *
     * @param name The name to set.
     */
    public void setName(String name)
@@ -96,7 +96,7 @@
       this.name = name;
    }
 
-   /** 
+   /**
     * Set the manager.
     * @param manager
     */
@@ -107,7 +107,7 @@
 
    /**
     * Add an argument.
-    * 
+    *
     * @param arg
     */
    public void addArg(Argument arg)
@@ -117,7 +117,7 @@
 
    /**
     * Get the arguments as a string for the command line.
-    * 
+    *
     * @return
     */
    public String getArgs()
@@ -126,14 +126,15 @@
       for (Iterator iter = arguments.iterator(); iter.hasNext();)
       {
          Argument argument = (Argument) iter.next();
-         args.append(argument.getValue() + " ");
+         if (!argument.getValue().equals(""))
+         args.append("\"" + argument.getValue() + "\"" + " ");
       }
       return args.toString();
    }
 
    /**
     * Add a jvm arg.
-    * 
+    *
     * @param arg
     */
    public void addJvmArg(Argument arg)
@@ -143,7 +144,7 @@
 
    /**
     * Get the JVM args for the command line.
-    * 
+    *
     * @return
     */
    public String getJvmArgs()
@@ -152,14 +153,15 @@
       for (Iterator iter = jvmArguments.iterator(); iter.hasNext();)
       {
          Argument argument = (Argument) iter.next();
-         args.append(argument.getValue() + " ");
+         if (!argument.getValue().equals(""))
+         args.append("\"" + argument.getValue() + "\"" + " ");
       }
       return args.toString();
    }
 
    /**
     * Add a system property.
-    * 
+    *
     * @param property
     */
    public void addSysProperty(Property property)
@@ -169,7 +171,7 @@
 
    /**
     * Get the system properties for the command line.
-    * 
+    *
     * @return
     */
    public String getSysProperties()
@@ -178,12 +180,12 @@
       for (Iterator iter = sysProperties.iterator(); iter.hasNext();)
       {
          Property property = (Property) iter.next();
-         args.append("-D" + property.getKey() + "=" + property.getValue());
+         args.append("-D" + property.getKey() + "=" + "\"" + property.getValue() + "\"");
       }
       return args.toString();
    }
 
-   /** 
+   /**
     * The running process of this server.
     * @param process
     */
@@ -194,7 +196,7 @@
 
    /**
     * Is the server actually running?
-    * 
+    *
     * @return
     */
    public boolean isRunning()
@@ -212,13 +214,13 @@
             return false;
          }
          catch (IllegalThreadStateException e)
-         { 
+         {
             return true;
          }
       }
    }
 
-   /** 
+   /**
     * Has the server been intentionally stopped?
     * @return
     */
@@ -246,7 +248,7 @@
       return new URL("http://" + host + ":" + httpPort);
    }
 
-   /** 
+   /**
     * The URl for the RMI listener.
     * @return
     */
@@ -257,7 +259,7 @@
 
    /**
     * Get the config. Defaults to the server name.
-    * 
+    *
     * @return the config.
     */
    public String getConfig()
@@ -274,7 +276,7 @@
 
    /**
     * Set the config.
-    * 
+    *
     * @param config The config to set.
     */
    public void setConfig(String config)
@@ -284,7 +286,7 @@
 
    /**
     * Get the host.
-    * 
+    *
     * @return the host.
     */
    public String getHost()
@@ -294,7 +296,7 @@
 
    /**
     * Set the host.
-    * 
+    *
     * @param host The host to set.
     */
    public void setHost(String host)
@@ -304,7 +306,7 @@
 
    /**
     * Set the httpPort.
-    * 
+    *
     * @param httpPort The httpPort to set.
     */
    public void setHttpPort(Integer httpPort)
@@ -314,7 +316,7 @@
 
    /**
     * Set the rmiPort.
-    * 
+    *
     * @param rmiPort The rmiPort to set.
     */
    public void setRmiPort(Integer rmiPort)
@@ -330,7 +332,7 @@
    {
       return rmiPort;
    }
-   /** 
+   /**
     * Where should the server's std err log go?
     * @return
     */
@@ -339,7 +341,7 @@
       return new File(getLogDir(), "error.log");
    }
 
-   /** 
+   /**
     * Where should the servers's std out go?
     * @return
     */
@@ -350,7 +352,7 @@
 
    /**
     * The server's log directory
-    * 
+    *
     * @return
     */
    private File getLogDir()
@@ -360,7 +362,7 @@
 
    /**
     * The server's directory (ie, all, default)
-    * 
+    *
     * @return
     */
    private File getConfDir()
@@ -368,7 +370,7 @@
       return new File(manager.getJBossHome(), "server/" + getConfig());
    }
 
-   /** 
+   /**
     * Set the output log's writer
     * @param outlog
     */
@@ -379,7 +381,7 @@
 
    /**
     * The writer for the output log.
-    * 
+    *
     * @return
     */
    public PrintWriter getOutWriter()
@@ -389,7 +391,7 @@
 
    /**
     * The error log's writer.
-    * 
+    *
     * @return
     */
    public PrintWriter getErrorWriter()
@@ -397,7 +399,7 @@
       return errorWriter;
    }
 
-   /** 
+   /**
     * Set the error writer.
     * @param errorlog
     */
@@ -408,7 +410,7 @@
 
    /**
     * Get the hasWebServer.
-    * 
+    *
     * @return the hasWebServer.
     */
    public boolean hasWebServer()
@@ -417,7 +419,7 @@
    }
    /**
     * Set the hasWebServer.
-    * 
+    *
     * @param hasWebServer The hasWebServer to set.
     */
    public void setHasWebServer(boolean hasWebServer)

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java	2006-08-21 20:36:32 UTC (rev 56132)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java	2006-08-21 20:42:45 UTC (rev 56133)
@@ -34,7 +34,7 @@
 
 /**
  * Starts, stops, and (eventually) reboots server instances.
- * 
+ *
  * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
  * @version $Revision$
  */
@@ -43,15 +43,15 @@
 
    private static final String SHUTDOWN_CLASS = "org.jboss.Shutdown";
 
-   private static final String MAIN = "org.jboss.Main"; 
-   
+   private static final String MAIN = "org.jboss.Main";
+
    private ServerController()
    {
    }
 
    /**
     * Start the server and pump its output and error streams.
-    * 
+    *
     * @param server
     * @param manager
     * @throws IOException
@@ -100,7 +100,7 @@
        * cause the spawned process' threads to block when this process
        * blocks.  So if uncomment following line, then the ServerTestHarness
        * will block abnormally, thus causing the tests not to run correctly.
-       * 
+       *
        * Is this true for our environment? - rcampbell
        */
       server.setProcess(process);
@@ -117,7 +117,7 @@
 
    }
 
-   /** 
+   /**
     * Delete & create log files
     * @param logFile
     * @throws IOException
@@ -136,7 +136,7 @@
       logFile.createNewFile();
    }
 
-   /** 
+   /**
     * Create the command line to execute
     * @param server
     * @param manager
@@ -145,22 +145,22 @@
     */
    private static String getStartCommandLine(Server server, ServerManager manager) throws IOException
    {
-      String execCmd = manager.getJavaExecutable() + " -cp " + manager.getStartClasspath() + " ";
+      String execCmd = "\"" + manager.getJavaExecutable() + "\"" + " -cp " + "\"" + manager.getStartClasspath() + "\"" + " ";
       execCmd = execCmd + server.getJvmArgs() + server.getSysProperties();
       execCmd = execCmd + " " + MAIN + " -c " + server.getConfig() + " -b " + server.getHost();
-      
+
       if (manager.getUdpGroup() != null && ! manager.getUdpGroup().equals(""))
       {
-         execCmd = execCmd + " -u " + manager.getUdpGroup();   
+         execCmd = execCmd + " -u " + manager.getUdpGroup();
       }
       execCmd = execCmd + " " + server.getArgs();
       return execCmd;
    }
 
-   /** 
+   /**
     * Wait until the jboss instance is full initialized
     * @param server
-    * @param manager 
+    * @param manager
     * @throws IOException
     */
    private static void waitForServer(Server server, ServerManager manager) throws IOException
@@ -191,9 +191,9 @@
    }
 
    /**
-    * Check if the server is fully intialized by trying to 
+    * Check if the server is fully intialized by trying to
     * open a connection to tomcat.
-    * 
+    *
     * @param server
     * @return
     * @throws IOException
@@ -249,7 +249,7 @@
    /**
     * Stop the server using shutdown.jar.
     * Process.destroy() the server if it fails to shutdown.
-    * 
+    *
     * @param server
     * @param manager
     * @throws IOException
@@ -291,9 +291,9 @@
    }
 
    /**
-    * Wait for the server to shutdown. 
+    * Wait for the server to shutdown.
     * @param server
-    * @param manager 
+    * @param manager
     * @return true if server process ends before timeout
     */
    private static boolean waitOnShutdown(Server server, ServerManager manager)
@@ -301,7 +301,7 @@
       int shutdownTimeout = manager.getShutdownTimeout();
       System.out.println("shutdownTimeout will be="+shutdownTimeout);
       for (int tries = 0; tries < shutdownTimeout; tries++)
-      {  
+      {
          try
          {
             if (!server.isRunning())
@@ -318,7 +318,7 @@
       return false;
    }
 
-   /** 
+   /**
     * Get the server shutdown command line.
     * @param server
     * @param manager
@@ -327,7 +327,7 @@
     */
    private static String getStopCommandLine(Server server, ServerManager manager) throws IOException
    {
-      String execCmd = manager.getJavaExecutable() + " -cp " + manager.getStopClasspath() + " ";
+      String execCmd ="\"" + manager.getJavaExecutable() + "\"" + " -cp " + "\"" + manager.getStopClasspath() + "\"" + " ";
       execCmd = execCmd + SHUTDOWN_CLASS + " --server " + server.getRmiUrl();
       execCmd = execCmd + " --shutdown";
       return execCmd;
@@ -335,7 +335,7 @@
 
    /**
     * Close the streams of a process.
-    * 
+    *
     * @param process
     */
    private static void closeAllStreams(Process process)
@@ -353,7 +353,7 @@
 
    /**
     * A OutputPumper.  Redirect std err & out to log files.
-    * 
+    *
     * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
     * @version $Revision$
     */




More information about the jboss-cvs-commits mailing list