You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/12 17:23:08 UTC
svn commit: r232310 [37/92] - in /beehive/trunk/controls/test: common/
infra/gtlf/ infra/gtlf/xsl/ infra/mantis/ infra/tch/ infra/tch/messages/
infra/tch/runtime/ infra/tch/schema/ perf/ perf/bin/ perf/cases/
perf/ctlsrc/org/apache/beehive/controls/per...
Modified: beehive/trunk/controls/test/tools/tch/src/dtd/valid-values-1-0.dtd
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/dtd/valid-values-1-0.dtd?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/dtd/valid-values-1-0.dtd (original)
+++ beehive/trunk/controls/test/tools/tch/src/dtd/valid-values-1-0.dtd Fri Aug 12 08:12:28 2005
@@ -1,28 +1,28 @@
-<!-- valid-values.dtd -->
-
-<!ELEMENT param (option*)>
-<!ATTLIST param
- name CDATA #REQUIRED
- maxlength CDATA #IMPLIED
- type (int|string|date) "string"
- format CDATA #IMPLIED
- trim (true|false) "false"
->
-
-<!ELEMENT option EMPTY>
-<!ATTLIST option
- value CDATA #REQUIRED
->
-
-<!ELEMENT envmapping (match*)>
-<!ATTLIST envmapping
- name CDATA #REQUIRED
->
-
-<!ELEMENT match EMPTY>
-<!ATTLIST match
- expr CDATA #REQUIRED
- target CDATA #REQUIRED
->
-
-<!ELEMENT valid-params (param+,envmapping*)>
+<!-- valid-values.dtd -->
+
+<!ELEMENT param (option*)>
+<!ATTLIST param
+ name CDATA #REQUIRED
+ maxlength CDATA #IMPLIED
+ type (int|string|date) "string"
+ format CDATA #IMPLIED
+ trim (true|false) "false"
+>
+
+<!ELEMENT option EMPTY>
+<!ATTLIST option
+ value CDATA #REQUIRED
+>
+
+<!ELEMENT envmapping (match*)>
+<!ATTLIST envmapping
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT match EMPTY>
+<!ATTLIST match
+ expr CDATA #REQUIRED
+ target CDATA #REQUIRED
+>
+
+<!ELEMENT valid-params (param+,envmapping*)>
Propchange: beehive/trunk/controls/test/tools/tch/src/dtd/valid-values-1-0.dtd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/DebugLevels.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/DebugLevels.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/DebugLevels.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/DebugLevels.java Fri Aug 12 08:12:28 2005
@@ -1,36 +1,36 @@
-package org.apache.beehive.test.tools.tch;
-
-/**
- * These DebugLevels allow the authors of tests to write debug messages
- * that do not get printed unless the runner of the tests wants extra
- * info. They are standard throughout the test framework and do not
- * apply to the WebLogic server.
- *
- * In order for a message to print, it must have a debug level which
- * is equal to or lower than the TestContext debug level:
- *
- */
-
-public interface DebugLevels {
-
- // TestContext DebugLevels:
-
- public final static int NONE = 0;
- public final static int FEW = 1;
- public final static int SOME = 2;
- public final static int ALL = 3;
-
- public final static String NONE_STRING = "NONE";
- public final static String FEW_STRING = "FEW";
- public final static String SOME_STRING = "SOME";
- public final static String ALL_STRING = "ALL";
-
- // message DebugLevels:
-
- public final static int MOST_VISIBLE = 1;
- public final static int HALF_VISIBLE = 2;
- public final static int LEAST_VISIBLE = 3;
-
- // this is used for non-debug messages
- public final static int ALWAYS_VISIBLE = -1;
-}
+package org.apache.beehive.test.tools.tch;
+
+/**
+ * These DebugLevels allow the authors of tests to write debug messages
+ * that do not get printed unless the runner of the tests wants extra
+ * info. They are standard throughout the test framework and do not
+ * apply to the WebLogic server.
+ *
+ * In order for a message to print, it must have a debug level which
+ * is equal to or lower than the TestContext debug level:
+ *
+ */
+
+public interface DebugLevels {
+
+ // TestContext DebugLevels:
+
+ public final static int NONE = 0;
+ public final static int FEW = 1;
+ public final static int SOME = 2;
+ public final static int ALL = 3;
+
+ public final static String NONE_STRING = "NONE";
+ public final static String FEW_STRING = "FEW";
+ public final static String SOME_STRING = "SOME";
+ public final static String ALL_STRING = "ALL";
+
+ // message DebugLevels:
+
+ public final static int MOST_VISIBLE = 1;
+ public final static int HALF_VISIBLE = 2;
+ public final static int LEAST_VISIBLE = 3;
+
+ // this is used for non-debug messages
+ public final static int ALWAYS_VISIBLE = -1;
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/DebugLevels.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ListenerManager.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ListenerManager.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ListenerManager.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ListenerManager.java Fri Aug 12 08:12:28 2005
@@ -1,6 +1,6 @@
-package org.apache.beehive.test.tools.tch;
-
-// Less typing, that's it
-public class ListenerManager
- extends org.apache.beehive.test.tools.tch.extension.process.listener.RemoteListenerManager
-{}
+package org.apache.beehive.test.tools.tch;
+
+// Less typing, that's it
+public class ListenerManager
+ extends org.apache.beehive.test.tools.tch.extension.process.listener.RemoteListenerManager
+{}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ListenerManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ParameterConstants.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ParameterConstants.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ParameterConstants.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ParameterConstants.java Fri Aug 12 08:12:28 2005
@@ -1,127 +1,127 @@
-package org.apache.beehive.test.tools.tch;
-
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-
-/**
- * This interface has all parameters that Javatest cares about.
- */
-public interface ParameterConstants
- extends TchConstants {
-
- // =========================================================
- // core engine parameters
-
- // FIXME: rename this parameter sometime.
- public final static String DEBUG_PROPERTY = "debugQuetzal";
- public final static String DEFAULT_DEBUG = "false";
-
- public final static String DESCRIBE_MODE_PARAM =
- PARAM_PREFIX + "describe";
- public final static boolean DEFAULT_DESCRIBE_MODE = false;
-
- public final static String ROSTER_PARAM = PARAM_PREFIX + "roster";
-
- public final static String GENERATE_ROSTER_PARAM =
- PARAM_PREFIX + "generateRoster";
- public final boolean DEFAULT_GENERATE_ROSTER = false;
-
- public final static String CONFIG_PARAM = PARAM_PREFIX + "javatestConfig";
-
- public final static String TS_FILE_PARAM = PARAM_PREFIX + "tsfile";
- public final static String DEFAULT_TS_FILE = "";
-
- public final static String DEBUG_LEVEL_PARAM = PARAM_PREFIX + "debugLevel";
- public final static int DEFAULT_DEBUG_LEVEL = 10;
-
- public final static String DUMP_PARAM = PARAM_PREFIX + "dump";
- public final static boolean DEFAULT_DUMP = false;
-
- public final static String TIMEBOMB_SECONDS_PARAM =
- PARAM_PREFIX + "timebombSeconds";
-
- public final static String TIMEBOMB_THREADDUMP_FILENAME_PARAM =
- PARAM_PREFIX + "timebombThreaddumpFilename";
-
- public final static String TIMEOUT_SECONDS_PARAM =
- PARAM_PREFIX + "timeoutSeconds";
- public final static int DEFAULT_TIMEOUT_SECONDS = 0;
-
- public final static String GC_IN_CLEANUP_PARAM =
- PARAM_PREFIX + "gcInCleanup";
- public final static boolean DEFAULT_GC_IN_CLEANUP = false;
-
- public final static String GC_TIMEOUT_SECONDS_PARAM =
- PARAM_PREFIX + "gcTimeoutSeconds";
- public final static int DEFAULT_GC_TIMEOUT_SECONDS = 0;
-
- public final static String LOG_NAME_PARAM = PARAM_PREFIX + "logName";
- public final static String DEFAULT_LOG_NAME = "javatest";
-
- public final static String LOGTYPE_PARAM = PARAM_PREFIX + "logType";
- public final static String LOGTYPE_DEFAULT = "console,file";
-
- public static final String TOUCAN_LOG_PARAM = PARAM_PREFIX + "toucanLog";
- public static final String DEFAULT_TOUCAN_LOG = "false";
- public static final String GTLF_PARAM = PARAM_PREFIX + "GTLF";
- public static final String REALTIME_LOG_PARAM =
- PARAM_PREFIX + "realtime-log-enabled";
-
- // tch.template, from RosterConstants
-
- // ===========================================================
- // Javatest Servlet
-
- public static final String SERVLET_PATH_PARAM =
- PARAM_PREFIX + "servletPath";
- public static final String DEFAULT_SERVLET_PATH =
- "/javatesthelpers/JavatestServlet";
-
- // ===========================================================
- // Special logging parameters
-
- public static final String TEST_UNIT_PARAM = PARAM_PREFIX + "testunit";
-
- // Header - corresponds to ToucanLog.dtd
- // Toucan xml format - XMLLogger
- public static final String PRODCODE_PARAM = PARAM_PREFIX + "prodCode";
- public static final String DEFAULT_PRODCODE = "WLS";
-
- public static final String TESTCONFIG_PARAM = PARAM_PREFIX + "tConfig";
- public static final String DEFAULT_TESTCONFIG = "";
-
- public static final String CHANGE_NO_PARAM = PARAM_PREFIX + "changeNum";
- public static final String DEFAULT_CHANGE_NO = "";
-
- public static final String LOGNAME_PARAM = PARAM_PREFIX + "logName";
- public static final String DEFAULT_LOGNAME = "javatest";
-
- public static final String OUTPUT_URL_PARAM = PARAM_PREFIX + "outputUrl";
- public static final String DEFAULT_OUTPUT_URL = "";
-
- public static final String LOADREF_PARAM = PARAM_PREFIX + "loadRef";
- public static final String DEFAULT_LOADREF = "";
-
- public static final String TEST_CYCLE_PARAM = PARAM_PREFIX + "testCycle";
- public static final String DEFAULT_TEST_CYCLE = "";
-
- public static final String SERVER_HOST_PARAM = PARAM_PREFIX + "mstrSut";
- public static final String DEFAULT_SERVER_HOST = "";
-
- public static final String CLIENT_HOST_PARAM = PARAM_PREFIX + "cltSut";
- public static final String DEFAULT_CLIENT_HOST = "";
-
- public static final String DATABASE_INFO_PARAM = PARAM_PREFIX + "database";
- public static final String DEFAULT_DATABASE_INFO = "";
-
- public static final String TEST_SCRIPT_PARAM = PARAM_PREFIX + "topLevelTs";
- public static final String DEFAULT_TEST_SCRIPT = "";
-
- public static final String ACCOUNT_PARAM = PARAM_PREFIX + "execAccount";
- public static final String DEFAULT_ACCOUNT = "";
-
- public static final int CODECOV_OFF = 0;
- public static final int CODECOV_TESTSUITE_TO_SOURCE = 1;
- public static final int CODECOV_TEST_TO_SOURCE = 2;
-}
-
-
+package org.apache.beehive.test.tools.tch;
+
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+
+/**
+ * This interface has all parameters that Javatest cares about.
+ */
+public interface ParameterConstants
+ extends TchConstants {
+
+ // =========================================================
+ // core engine parameters
+
+ // FIXME: rename this parameter sometime.
+ public final static String DEBUG_PROPERTY = "debugQuetzal";
+ public final static String DEFAULT_DEBUG = "false";
+
+ public final static String DESCRIBE_MODE_PARAM =
+ PARAM_PREFIX + "describe";
+ public final static boolean DEFAULT_DESCRIBE_MODE = false;
+
+ public final static String ROSTER_PARAM = PARAM_PREFIX + "roster";
+
+ public final static String GENERATE_ROSTER_PARAM =
+ PARAM_PREFIX + "generateRoster";
+ public final boolean DEFAULT_GENERATE_ROSTER = false;
+
+ public final static String CONFIG_PARAM = PARAM_PREFIX + "javatestConfig";
+
+ public final static String TS_FILE_PARAM = PARAM_PREFIX + "tsfile";
+ public final static String DEFAULT_TS_FILE = "";
+
+ public final static String DEBUG_LEVEL_PARAM = PARAM_PREFIX + "debugLevel";
+ public final static int DEFAULT_DEBUG_LEVEL = 10;
+
+ public final static String DUMP_PARAM = PARAM_PREFIX + "dump";
+ public final static boolean DEFAULT_DUMP = false;
+
+ public final static String TIMEBOMB_SECONDS_PARAM =
+ PARAM_PREFIX + "timebombSeconds";
+
+ public final static String TIMEBOMB_THREADDUMP_FILENAME_PARAM =
+ PARAM_PREFIX + "timebombThreaddumpFilename";
+
+ public final static String TIMEOUT_SECONDS_PARAM =
+ PARAM_PREFIX + "timeoutSeconds";
+ public final static int DEFAULT_TIMEOUT_SECONDS = 0;
+
+ public final static String GC_IN_CLEANUP_PARAM =
+ PARAM_PREFIX + "gcInCleanup";
+ public final static boolean DEFAULT_GC_IN_CLEANUP = false;
+
+ public final static String GC_TIMEOUT_SECONDS_PARAM =
+ PARAM_PREFIX + "gcTimeoutSeconds";
+ public final static int DEFAULT_GC_TIMEOUT_SECONDS = 0;
+
+ public final static String LOG_NAME_PARAM = PARAM_PREFIX + "logName";
+ public final static String DEFAULT_LOG_NAME = "javatest";
+
+ public final static String LOGTYPE_PARAM = PARAM_PREFIX + "logType";
+ public final static String LOGTYPE_DEFAULT = "console,file";
+
+ public static final String TOUCAN_LOG_PARAM = PARAM_PREFIX + "toucanLog";
+ public static final String DEFAULT_TOUCAN_LOG = "false";
+ public static final String GTLF_PARAM = PARAM_PREFIX + "GTLF";
+ public static final String REALTIME_LOG_PARAM =
+ PARAM_PREFIX + "realtime-log-enabled";
+
+ // tch.template, from RosterConstants
+
+ // ===========================================================
+ // Javatest Servlet
+
+ public static final String SERVLET_PATH_PARAM =
+ PARAM_PREFIX + "servletPath";
+ public static final String DEFAULT_SERVLET_PATH =
+ "/javatesthelpers/JavatestServlet";
+
+ // ===========================================================
+ // Special logging parameters
+
+ public static final String TEST_UNIT_PARAM = PARAM_PREFIX + "testunit";
+
+ // Header - corresponds to ToucanLog.dtd
+ // Toucan xml format - XMLLogger
+ public static final String PRODCODE_PARAM = PARAM_PREFIX + "prodCode";
+ public static final String DEFAULT_PRODCODE = "WLS";
+
+ public static final String TESTCONFIG_PARAM = PARAM_PREFIX + "tConfig";
+ public static final String DEFAULT_TESTCONFIG = "";
+
+ public static final String CHANGE_NO_PARAM = PARAM_PREFIX + "changeNum";
+ public static final String DEFAULT_CHANGE_NO = "";
+
+ public static final String LOGNAME_PARAM = PARAM_PREFIX + "logName";
+ public static final String DEFAULT_LOGNAME = "javatest";
+
+ public static final String OUTPUT_URL_PARAM = PARAM_PREFIX + "outputUrl";
+ public static final String DEFAULT_OUTPUT_URL = "";
+
+ public static final String LOADREF_PARAM = PARAM_PREFIX + "loadRef";
+ public static final String DEFAULT_LOADREF = "";
+
+ public static final String TEST_CYCLE_PARAM = PARAM_PREFIX + "testCycle";
+ public static final String DEFAULT_TEST_CYCLE = "";
+
+ public static final String SERVER_HOST_PARAM = PARAM_PREFIX + "mstrSut";
+ public static final String DEFAULT_SERVER_HOST = "";
+
+ public static final String CLIENT_HOST_PARAM = PARAM_PREFIX + "cltSut";
+ public static final String DEFAULT_CLIENT_HOST = "";
+
+ public static final String DATABASE_INFO_PARAM = PARAM_PREFIX + "database";
+ public static final String DEFAULT_DATABASE_INFO = "";
+
+ public static final String TEST_SCRIPT_PARAM = PARAM_PREFIX + "topLevelTs";
+ public static final String DEFAULT_TEST_SCRIPT = "";
+
+ public static final String ACCOUNT_PARAM = PARAM_PREFIX + "execAccount";
+ public static final String DEFAULT_ACCOUNT = "";
+
+ public static final int CODECOV_OFF = 0;
+ public static final int CODECOV_TESTSUITE_TO_SOURCE = 1;
+ public static final int CODECOV_TEST_TO_SOURCE = 2;
+}
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/ParameterConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TaskRunner.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TaskRunner.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TaskRunner.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TaskRunner.java Fri Aug 12 08:12:28 2005
@@ -1,6 +1,6 @@
-package org.apache.beehive.test.tools.tch;
-
-// Less typing, that's it
-public class TaskRunner
- extends org.apache.beehive.test.tools.tch.extension.process.listener.RemoteListener
-{}
+package org.apache.beehive.test.tools.tch;
+
+// Less typing, that's it
+public class TaskRunner
+ extends org.apache.beehive.test.tools.tch.extension.process.listener.RemoteListener
+{}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TaskRunner.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchShutdownThread.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchShutdownThread.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchShutdownThread.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchShutdownThread.java Fri Aug 12 08:12:28 2005
@@ -1,88 +1,88 @@
-package org.apache.beehive.test.tools.tch;
-
-import java.rmi.Naming;
-
-import org.apache.beehive.test.tools.tch.core.AntProperties;
-import org.apache.beehive.test.tools.tch.core.PropertyNames;
-import org.apache.beehive.test.tools.tch.core.remote.RemoteTchManager;
-
-/**
- * Thread that's registered as the shutdown hook in TchVMTask.
- * This will ensure that when CTRL-C is pressed or the process naturally
- * terminates, that servers started up by tch are killed as well.
- *
- * Note: This MUST run before ant destroys the spawned tch process
- * in the case of fork=true. Thus we do maintain state that can be
- * externally checked to see if this thread has run already so that the
- * ant process reaper can kick in afterwards.
- */
-public class TchShutdownThread extends Thread
-{
- private static TchShutdownThread instance = null;
- private static boolean ran;
-
- public static synchronized TchShutdownThread getInstance()
- {
- if (instance == null)
- {
- instance = new TchShutdownThread();
- }
- return instance;
- }
-
- public static synchronized TchShutdownThread getExistingInstance()
- {
- return instance;
- }
-
- private TchShutdownThread()
- {
- ran = false;
- }
-
- /**
- * Called to wait until the shutdown has completed
- */
- public synchronized void waitUntilCompleted()
- {
- // If there is no TchShutdownThread instance, don't need to wait
- while ((instance != null) && (ran == false))
- {
- try
- {
- wait();
- }
- catch (InterruptedException ex)
- {
- }
- }
- }
-
- public synchronized void notifyCompleted()
- {
- ran = true;
- notifyAll();
- }
-
- public void run()
- {
- // get the rmi registry port
- int port = AntProperties.getTchAdminPort();
-
- RemoteTchManager obj;
- try
- {
- obj =
- (RemoteTchManager)Naming.lookup(
- "rmi://localhost:"
- + port
- + "/"
- + RemoteTchManager.MANAGEMENT_SERVICE_NAME);
- obj.shutdownTch();
- }
- catch (Exception e)
- {
- }
- notifyCompleted();
- }
-}
+package org.apache.beehive.test.tools.tch;
+
+import java.rmi.Naming;
+
+import org.apache.beehive.test.tools.tch.core.AntProperties;
+import org.apache.beehive.test.tools.tch.core.PropertyNames;
+import org.apache.beehive.test.tools.tch.core.remote.RemoteTchManager;
+
+/**
+ * Thread that's registered as the shutdown hook in TchVMTask.
+ * This will ensure that when CTRL-C is pressed or the process naturally
+ * terminates, that servers started up by tch are killed as well.
+ *
+ * Note: This MUST run before ant destroys the spawned tch process
+ * in the case of fork=true. Thus we do maintain state that can be
+ * externally checked to see if this thread has run already so that the
+ * ant process reaper can kick in afterwards.
+ */
+public class TchShutdownThread extends Thread
+{
+ private static TchShutdownThread instance = null;
+ private static boolean ran;
+
+ public static synchronized TchShutdownThread getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new TchShutdownThread();
+ }
+ return instance;
+ }
+
+ public static synchronized TchShutdownThread getExistingInstance()
+ {
+ return instance;
+ }
+
+ private TchShutdownThread()
+ {
+ ran = false;
+ }
+
+ /**
+ * Called to wait until the shutdown has completed
+ */
+ public synchronized void waitUntilCompleted()
+ {
+ // If there is no TchShutdownThread instance, don't need to wait
+ while ((instance != null) && (ran == false))
+ {
+ try
+ {
+ wait();
+ }
+ catch (InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ public synchronized void notifyCompleted()
+ {
+ ran = true;
+ notifyAll();
+ }
+
+ public void run()
+ {
+ // get the rmi registry port
+ int port = AntProperties.getTchAdminPort();
+
+ RemoteTchManager obj;
+ try
+ {
+ obj =
+ (RemoteTchManager)Naming.lookup(
+ "rmi://localhost:"
+ + port
+ + "/"
+ + RemoteTchManager.MANAGEMENT_SERVICE_NAME);
+ obj.shutdownTch();
+ }
+ catch (Exception e)
+ {
+ }
+ notifyCompleted();
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchShutdownThread.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchTask.java Fri Aug 12 08:12:28 2005
@@ -1,525 +1,525 @@
-package org.apache.beehive.test.tools.tch;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-import org.apache.beehive.test.tools.tch.core.CmdlineParams;
-import org.apache.beehive.test.tools.tch.core.JavaCmdlineHelper;
-import org.apache.beehive.test.tools.tch.core.PropertyNames;
-import org.apache.beehive.test.tools.tch.core.remote.ExecTask;
-import org.apache.beehive.test.tools.tch.task.TaskException;
-import org.apache.beehive.test.tools.tch.util.AntProperties;
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-import org.apache.beehive.test.tools.tch.util.GeneralUtil;
-import org.apache.beehive.test.tools.tch.util.NestedException;
-import org.apache.beehive.test.tools.tch.util.OrderedSet;
-import org.apache.beehive.test.tools.tch.util.ant.ArgElement;
-import org.apache.beehive.test.tools.tch.util.io.OutputStreamSubscriber;
-import org.apache.beehive.test.tools.tch.util.io.OutputStreamSubscriberAdapter;
-
-/**
- * Run tch from within ant!
- *
- */
-
-public class TchTask
- extends Task
- implements OutputStreamSubscriber
-{
- // This could be fixed to recycle stuff that's already defined in
- // AntProperties.
- private static final String
- PATHSEP = File.pathSeparator,
- NAMESEP = File.separator,
- SEP = System.getProperty("line.separator"),
-
- TEST_SUITE_PROPERTY="test-suite",
- JAVAOPTS_PROPERTY="tch.javaopts",
- DEPRECATED_JAVAOPTS_PROPERTY="javaopts",
-
- INIT_MODE_ONLY_PROPERTY="tch.init-mode-only",
-
- SCHEMA_VALIDATION_ERROR_MESSAGE = "Invalid build file",
- VALIDATION_ERROR_MESSAGE = "VALIDATION ERRORS IN THE RUN",
- WRONG_TARGET_ERROR_MESSAGE = "does not exist in this project",
- GENERAL_BUILD_FAILURE = "BUILD FAILED";
-
- private static List excludedPropsList = new ArrayList();
- static
- {
- // JAVAOPTS_PROPERTY is excluded because we add it again manually.
- // So we need to make sure it does not get set twice
- excludedPropsList.add(JAVAOPTS_PROPERTY);
- // should not set this one, since it is deprecated
- excludedPropsList.add(DEPRECATED_JAVAOPTS_PROPERTY);
- }
-
- private String
- classpath = null,
- extraClasspath = null,
- preClasspath = null,
- configDependencyPath = null,
- deployPath = null;
-
- private File
- tchHome = new File("."),
- testHome = new File("."),
- testSuite = null;
-
- private boolean
- removeTchxFromClasspath = false,
- drainToFile = false,
- verbose = false,
- initModeOnly = false,
- validationFailed = false,
- window = false;
-
- private OrderedSet args = new OrderedSet(),
- jvmargs = new OrderedSet();
-
- private File drainFile = new File("tch-run");
-
- public void setWindow(boolean in)
- {
- window = in;
- }
-
- public void setInitModeOnly(boolean in)
- {
- initModeOnly = in;
- }
-
- public void setVerbose(boolean in)
- {
- verbose = in;
- }
-
- public void setClasspath(String in)
- {
- classpath = in;
- }
-
- public void setExtraClasspath(String in)
- {
- extraClasspath = in;
- }
-
- public void setPreClasspath(String in)
- {
- preClasspath = in;
- }
-
- public void setTestSuite(File in)
- {
- testSuite = in;
- }
-
- public void setTchHome(File in)
- {
- // Setting this is a prop so we can get it from AntProperties.
- getProject().setUserProperty(PropertyNames.TCH_PREFIX +
- PropertyNames.TCH_HOME_PROPERTY,
- in.getAbsolutePath());
- }
-
- public void setTestHome(File in)
- {
- testHome = in;
- }
-
- public void setDrainToFile(boolean in)
- {
- drainToFile = in;
- }
-
- public void setDrainFile(File in)
- {
- drainFile = in;
- }
-
- public void setConfigDependencyPath(String in)
- {
- configDependencyPath = in;
- }
-
- public void setDeployPath(String in)
- {
- deployPath = in;
- }
-
- public void addConfiguredArg(ArgElement in)
- {
- // Ok, so this could be made nicer, just recycling ArgElement
- String value = in.getValue();
- if (value != null && value.trim().length() > 0)
- args.add(value.trim());
- }
-
- public void addConfiguredJvmArg(ArgElement in)
- {
- // Ok, so this could be made nicer, just recycling ArgElement
- String value = in.getValue();
- if (value != null && value.trim().length() > 0)
- jvmargs.add(value.trim());
- }
-
- public void setRemoveTchxFromClasspath(boolean in)
- {
- removeTchxFromClasspath = in;
- }
-
- public final void execute()
- throws BuildException
- {
- validate();
-
- AntProperties.init(getProject());
- // read props file
- org.apache.beehive.test.tools.tch.core.AntProperties.populate();
-
- if (initModeOnly)
- log("Running \"init-mode-only\"");
-
- List cmdList = constructTchCommandLine();
-
- try {
- execCommandLine(cmdList);
- } catch (Throwable th)
- {
- String message = "Failed to exec tch";
- if (th instanceof NestedException)
- {
- NestedException ex = (NestedException)th;
- th = ex.getNestedThrowable();
- if (ex.getMessage() != null)
- message = ex.getMessage();
- }
- throw new BuildException(message, th, getLocation());
- }
- }
-
- // OutputStreamSubscriber implementation
- public void notifyStreamOutput(String streamOutput)
- {
- validationFailed = true;
- }
-
- private void validate()
- throws BuildException
- {
- // testsuite validation
- // only validate if the attribute has been set, usually that means
- // that people are running tch from within ant, not from the
- // command line (not the tch script)
- if (testSuite != null)
- {
- boolean found = true;
- if (!testSuite.exists())
- {
- found = false;
- if (!testSuite.getName().endsWith(".xml"))
- {
- File temp = new File(testSuite.toString() + ".xml");
- if (temp.exists())
- {
- found = true;
- testSuite = temp;
- }
- }
- if (!found)
- throw new BuildException("Cannot find specified testsuite: " +
- testSuite.toString());
- }
- }
-
- // tchHome validation
- if (tchHome == null)
- throw new BuildException("tchHome needs to be set");
- }
-
- private File getTestSuite()
- {
- return testSuite;
- }
-
- private String getDeployPath()
- {
- return deployPath;
- }
-
- private String getCorrectClasspath()
- {
- // only override classpath on the command line if
- // 1) the classpath attribute has been set or
- // 2) pre classpath has been set or
- // 3) extra classpath has been set or
- // 4) we have to remove tchx from the classpath
- if (classpath != null ||
- preClasspath != null ||
- extraClasspath != null ||
- removeTchxFromClasspath)
- {
- // if classpath has not been set, inherit it from the VM we're running in.
- if (classpath == null)
- classpath = System.getProperty("java.class.path");
-
- // deal with pre and extra classpath.
- if (preClasspath != null)
- {
- preClasspath = appendPathsepIfNecessary(preClasspath);
- classpath = moveQuoteToFrontIfNecessaryAndPrepend(classpath,
- preClasspath);
- }
-
- if (extraClasspath != null)
- {
- extraClasspath = prependPathsepIfNecessary(extraClasspath);
- classpath =
- moveQuoteToEndIfNecessaryAndAppend(classpath, extraClasspath);
- }
-
- if (removeTchxFromClasspath)
- {
- // This removes tch 2.0 from the classpath, if it is there
- // Need this while supporting Tch 2.0 and Tch 3.0 in the src
- // branch.
- classpath =
- GeneralUtil.removeFromPath(classpath, NAMESEP + "tchx.jar");
- }
- }
- return classpath;
- }
-
- private String appendPathsepIfNecessary(String path)
- {
- String returnPath = path;
- if (!returnPath.endsWith(PATHSEP))
- returnPath += PATHSEP;
- return returnPath;
- }
-
- private String prependPathsepIfNecessary(String path)
- {
- String returnPath = path;
- if (!returnPath.startsWith(PATHSEP))
- returnPath = PATHSEP + returnPath;
- return returnPath;
- }
-
- private String moveQuoteToEndIfNecessaryAndAppend(String basePath,
- String path)
- {
- boolean foundQuote = false;
- if (basePath.endsWith("\""))
- {
- foundQuote = true;
- basePath = basePath.substring(0, basePath.length() - 1);
- }
- if (foundQuote)
- return basePath + path + "\"";
- return basePath + path;
- }
-
- private String moveQuoteToFrontIfNecessaryAndPrepend(String basePath,
- String path)
- {
- boolean foundQuote = false;
- if (basePath.startsWith("\""))
- {
- foundQuote = true;
- basePath = basePath.substring(1, basePath.length());
- }
- if (foundQuote)
- return "\"" + path + basePath;
- return path + basePath;
- }
-
- private List constructTchCommandLine()
- {
- List cmdList = new ArrayList();
- cmdList.add("java");
-
- cmdList.addAll(getJVMArgs());
-
- String classpath = getCorrectClasspath();
- boolean setClasspath = false;
- if (classpath != null)
- {
- cmdList.add("-classpath");
- cmdList.add(classpath);
- setClasspath = true;
- }
-
- cmdList.addAll(JavaCmdlineHelper.getMainClassAndTarget());
- cmdList.addAll(JavaCmdlineHelper.getBuildfile());
- cmdList.addAll(JavaCmdlineHelper.getVerbose());
-
- if (initModeOnly)
- {
- cmdList.add(addDashD(INIT_MODE_ONLY_PROPERTY) + "=true");
- }
-
- cmdList.addAll(JavaCmdlineHelper.
- getBaseDirWithValue(new File(".").getAbsolutePath()));
-
- addCmdLineArgs(cmdList);
-
- if (getTestSuite() != null)
- cmdList.add(addDashD(TEST_SUITE_PROPERTY) + "=" + getTestSuite());
-
- addAllProperties(cmdList);
-
- addJavaoptsProperty(cmdList);
-
- return cmdList;
- }
-
- private void addCmdLineArgs(List cmdList)
- {
- for (Iterator iter = args.iterator();iter.hasNext();)
- {
- cmdList.add(iter.next().toString());
- }
- }
-
- private void addJavaoptsProperty(List cmdList)
- {
- StringBuffer sb = new StringBuffer();
- if (!jvmargs.isEmpty())
- {
- for (Iterator iter = jvmargs.iterator(); iter.hasNext();)
- {
- sb.append(iter.next());
- if (iter.hasNext())
- sb.append(" ");
- }
- cmdList.add(addDashD(JAVAOPTS_PROPERTY) + "=" + sb.toString());
- }
- }
-
- private List getJVMArgs()
- {
- List cmdList = new ArrayList();
- for (Iterator iter = jvmargs.iterator(); iter.hasNext();)
- {
- String arg = ((String)iter.next());
- if (arg.indexOf(" ") != -1)
- {
- StringTokenizer st = new StringTokenizer(arg);
- while (st.hasMoreTokens())
- cmdList.add(st.nextToken());
- }
- else if (arg.length() > 0)
- cmdList.add(arg);
- }
- return cmdList;
- }
-
- private void addAllProperties(List cmdList)
- {
- Map antProperties = getProject().getUserProperties();
- for (Iterator iter = antProperties.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry)iter.next();
- String key = (String)entry.getKey();
- if (!isExcluded(key))
- {
- String value = (String)entry.getValue();
- cmdList.add(addDashD(key) + "=" + value);
- }
- }
- }
-
- private String getConfigDependencyPath()
- {
- return configDependencyPath;
- }
-
- private boolean isExcluded(String prop)
- {
- return (excludedPropsList.contains(prop));
- }
-
- private String addDashD(String prop)
- {
- return "-D" + prop;
- }
-
- private void execCommandLine(List cmdList)
- throws TaskException
- {
- // use ExecTask for now, since that has all we need to exec stuff
- // this one could be made configurable
- // for messages from the exec task
- String fakeCommand = TchUtils.arrayToString(cmdList.toArray(), " ");
- ExecTask execTask = new ExecTask(drainFile.getName(),
- fakeCommand,
- testHome.getAbsolutePath(),
- window,
- drainToFile);
-
- // quick hack to get window to work
- if (!window)
- {
- // this is really the command we'll exec
- execTask.setCmdArray((String[])cmdList.toArray(new String[]{}));
- }
-
- // if we're running init-mode-only, we want to throw a build exception
- // if the tch we exec has validation errors, so register for some
- // typical error messages
- if (initModeOnly)
- {
- OutputStreamSubscriber subscriber =
- new OutputStreamSubscriberAdapter(this);
-
- execTask
- .registerForProcessOutput(subscriber,VALIDATION_ERROR_MESSAGE);
- execTask
- .registerForProcessOutput(subscriber,SCHEMA_VALIDATION_ERROR_MESSAGE);
- execTask
- .registerForProcessOutput(subscriber,WRONG_TARGET_ERROR_MESSAGE);
- execTask
- .registerForProcessOutput(subscriber,GENERAL_BUILD_FAILURE);
- }
-
- execTask.setVerbose(verbose);
- execTask.setWriteCmdToFile(false);
- execTask.runtask(null);
-
- if (initModeOnly && validationFailed)
- {
- StringBuffer output = new StringBuffer();
- output
- .append(SEP)
- .append(SEP)
- .append("===============================================")
- .append(SEP)
- .append(execTask.getProcessSummary().getSomeProcessOutput(30))
- .append(SEP)
- .append("===============================================");
- String message = null;
- if (testSuite != null)
- message = "validation for test-suite: " + testSuite + " failed";
- else
- message = "validation failed";
- message += ", with this output: " + output.toString();
- throw new TaskException(message);
- }
-
- }
-}
-
-
-
-
-
+package org.apache.beehive.test.tools.tch;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+import org.apache.beehive.test.tools.tch.core.CmdlineParams;
+import org.apache.beehive.test.tools.tch.core.JavaCmdlineHelper;
+import org.apache.beehive.test.tools.tch.core.PropertyNames;
+import org.apache.beehive.test.tools.tch.core.remote.ExecTask;
+import org.apache.beehive.test.tools.tch.task.TaskException;
+import org.apache.beehive.test.tools.tch.util.AntProperties;
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+import org.apache.beehive.test.tools.tch.util.GeneralUtil;
+import org.apache.beehive.test.tools.tch.util.NestedException;
+import org.apache.beehive.test.tools.tch.util.OrderedSet;
+import org.apache.beehive.test.tools.tch.util.ant.ArgElement;
+import org.apache.beehive.test.tools.tch.util.io.OutputStreamSubscriber;
+import org.apache.beehive.test.tools.tch.util.io.OutputStreamSubscriberAdapter;
+
+/**
+ * Run tch from within ant!
+ *
+ */
+
+public class TchTask
+ extends Task
+ implements OutputStreamSubscriber
+{
+ // This could be fixed to recycle stuff that's already defined in
+ // AntProperties.
+ private static final String
+ PATHSEP = File.pathSeparator,
+ NAMESEP = File.separator,
+ SEP = System.getProperty("line.separator"),
+
+ TEST_SUITE_PROPERTY="test-suite",
+ JAVAOPTS_PROPERTY="tch.javaopts",
+ DEPRECATED_JAVAOPTS_PROPERTY="javaopts",
+
+ INIT_MODE_ONLY_PROPERTY="tch.init-mode-only",
+
+ SCHEMA_VALIDATION_ERROR_MESSAGE = "Invalid build file",
+ VALIDATION_ERROR_MESSAGE = "VALIDATION ERRORS IN THE RUN",
+ WRONG_TARGET_ERROR_MESSAGE = "does not exist in this project",
+ GENERAL_BUILD_FAILURE = "BUILD FAILED";
+
+ private static List excludedPropsList = new ArrayList();
+ static
+ {
+ // JAVAOPTS_PROPERTY is excluded because we add it again manually.
+ // So we need to make sure it does not get set twice
+ excludedPropsList.add(JAVAOPTS_PROPERTY);
+ // should not set this one, since it is deprecated
+ excludedPropsList.add(DEPRECATED_JAVAOPTS_PROPERTY);
+ }
+
+ private String
+ classpath = null,
+ extraClasspath = null,
+ preClasspath = null,
+ configDependencyPath = null,
+ deployPath = null;
+
+ private File
+ tchHome = new File("."),
+ testHome = new File("."),
+ testSuite = null;
+
+ private boolean
+ removeTchxFromClasspath = false,
+ drainToFile = false,
+ verbose = false,
+ initModeOnly = false,
+ validationFailed = false,
+ window = false;
+
+ private OrderedSet args = new OrderedSet(),
+ jvmargs = new OrderedSet();
+
+ private File drainFile = new File("tch-run");
+
+ public void setWindow(boolean in)
+ {
+ window = in;
+ }
+
+ public void setInitModeOnly(boolean in)
+ {
+ initModeOnly = in;
+ }
+
+ public void setVerbose(boolean in)
+ {
+ verbose = in;
+ }
+
+ public void setClasspath(String in)
+ {
+ classpath = in;
+ }
+
+ public void setExtraClasspath(String in)
+ {
+ extraClasspath = in;
+ }
+
+ public void setPreClasspath(String in)
+ {
+ preClasspath = in;
+ }
+
+ public void setTestSuite(File in)
+ {
+ testSuite = in;
+ }
+
+ public void setTchHome(File in)
+ {
+ // Setting this is a prop so we can get it from AntProperties.
+ getProject().setUserProperty(PropertyNames.TCH_PREFIX +
+ PropertyNames.TCH_HOME_PROPERTY,
+ in.getAbsolutePath());
+ }
+
+ public void setTestHome(File in)
+ {
+ testHome = in;
+ }
+
+ public void setDrainToFile(boolean in)
+ {
+ drainToFile = in;
+ }
+
+ public void setDrainFile(File in)
+ {
+ drainFile = in;
+ }
+
+ public void setConfigDependencyPath(String in)
+ {
+ configDependencyPath = in;
+ }
+
+ public void setDeployPath(String in)
+ {
+ deployPath = in;
+ }
+
+ public void addConfiguredArg(ArgElement in)
+ {
+ // Ok, so this could be made nicer, just recycling ArgElement
+ String value = in.getValue();
+ if (value != null && value.trim().length() > 0)
+ args.add(value.trim());
+ }
+
+ public void addConfiguredJvmArg(ArgElement in)
+ {
+ // Ok, so this could be made nicer, just recycling ArgElement
+ String value = in.getValue();
+ if (value != null && value.trim().length() > 0)
+ jvmargs.add(value.trim());
+ }
+
+ public void setRemoveTchxFromClasspath(boolean in)
+ {
+ removeTchxFromClasspath = in;
+ }
+
+ public final void execute()
+ throws BuildException
+ {
+ validate();
+
+ AntProperties.init(getProject());
+ // read props file
+ org.apache.beehive.test.tools.tch.core.AntProperties.populate();
+
+ if (initModeOnly)
+ log("Running \"init-mode-only\"");
+
+ List cmdList = constructTchCommandLine();
+
+ try {
+ execCommandLine(cmdList);
+ } catch (Throwable th)
+ {
+ String message = "Failed to exec tch";
+ if (th instanceof NestedException)
+ {
+ NestedException ex = (NestedException)th;
+ th = ex.getNestedThrowable();
+ if (ex.getMessage() != null)
+ message = ex.getMessage();
+ }
+ throw new BuildException(message, th, getLocation());
+ }
+ }
+
+ // OutputStreamSubscriber implementation
+ public void notifyStreamOutput(String streamOutput)
+ {
+ validationFailed = true;
+ }
+
+ private void validate()
+ throws BuildException
+ {
+ // testsuite validation
+ // only validate if the attribute has been set, usually that means
+ // that people are running tch from within ant, not from the
+ // command line (not the tch script)
+ if (testSuite != null)
+ {
+ boolean found = true;
+ if (!testSuite.exists())
+ {
+ found = false;
+ if (!testSuite.getName().endsWith(".xml"))
+ {
+ File temp = new File(testSuite.toString() + ".xml");
+ if (temp.exists())
+ {
+ found = true;
+ testSuite = temp;
+ }
+ }
+ if (!found)
+ throw new BuildException("Cannot find specified testsuite: " +
+ testSuite.toString());
+ }
+ }
+
+ // tchHome validation
+ if (tchHome == null)
+ throw new BuildException("tchHome needs to be set");
+ }
+
+ private File getTestSuite()
+ {
+ return testSuite;
+ }
+
+ private String getDeployPath()
+ {
+ return deployPath;
+ }
+
+ private String getCorrectClasspath()
+ {
+ // only override classpath on the command line if
+ // 1) the classpath attribute has been set or
+ // 2) pre classpath has been set or
+ // 3) extra classpath has been set or
+ // 4) we have to remove tchx from the classpath
+ if (classpath != null ||
+ preClasspath != null ||
+ extraClasspath != null ||
+ removeTchxFromClasspath)
+ {
+ // if classpath has not been set, inherit it from the VM we're running in.
+ if (classpath == null)
+ classpath = System.getProperty("java.class.path");
+
+ // deal with pre and extra classpath.
+ if (preClasspath != null)
+ {
+ preClasspath = appendPathsepIfNecessary(preClasspath);
+ classpath = moveQuoteToFrontIfNecessaryAndPrepend(classpath,
+ preClasspath);
+ }
+
+ if (extraClasspath != null)
+ {
+ extraClasspath = prependPathsepIfNecessary(extraClasspath);
+ classpath =
+ moveQuoteToEndIfNecessaryAndAppend(classpath, extraClasspath);
+ }
+
+ if (removeTchxFromClasspath)
+ {
+ // This removes tch 2.0 from the classpath, if it is there
+ // Need this while supporting Tch 2.0 and Tch 3.0 in the src
+ // branch.
+ classpath =
+ GeneralUtil.removeFromPath(classpath, NAMESEP + "tchx.jar");
+ }
+ }
+ return classpath;
+ }
+
+ private String appendPathsepIfNecessary(String path)
+ {
+ String returnPath = path;
+ if (!returnPath.endsWith(PATHSEP))
+ returnPath += PATHSEP;
+ return returnPath;
+ }
+
+ private String prependPathsepIfNecessary(String path)
+ {
+ String returnPath = path;
+ if (!returnPath.startsWith(PATHSEP))
+ returnPath = PATHSEP + returnPath;
+ return returnPath;
+ }
+
+ private String moveQuoteToEndIfNecessaryAndAppend(String basePath,
+ String path)
+ {
+ boolean foundQuote = false;
+ if (basePath.endsWith("\""))
+ {
+ foundQuote = true;
+ basePath = basePath.substring(0, basePath.length() - 1);
+ }
+ if (foundQuote)
+ return basePath + path + "\"";
+ return basePath + path;
+ }
+
+ private String moveQuoteToFrontIfNecessaryAndPrepend(String basePath,
+ String path)
+ {
+ boolean foundQuote = false;
+ if (basePath.startsWith("\""))
+ {
+ foundQuote = true;
+ basePath = basePath.substring(1, basePath.length());
+ }
+ if (foundQuote)
+ return "\"" + path + basePath;
+ return path + basePath;
+ }
+
+ private List constructTchCommandLine()
+ {
+ List cmdList = new ArrayList();
+ cmdList.add("java");
+
+ cmdList.addAll(getJVMArgs());
+
+ String classpath = getCorrectClasspath();
+ boolean setClasspath = false;
+ if (classpath != null)
+ {
+ cmdList.add("-classpath");
+ cmdList.add(classpath);
+ setClasspath = true;
+ }
+
+ cmdList.addAll(JavaCmdlineHelper.getMainClassAndTarget());
+ cmdList.addAll(JavaCmdlineHelper.getBuildfile());
+ cmdList.addAll(JavaCmdlineHelper.getVerbose());
+
+ if (initModeOnly)
+ {
+ cmdList.add(addDashD(INIT_MODE_ONLY_PROPERTY) + "=true");
+ }
+
+ cmdList.addAll(JavaCmdlineHelper.
+ getBaseDirWithValue(new File(".").getAbsolutePath()));
+
+ addCmdLineArgs(cmdList);
+
+ if (getTestSuite() != null)
+ cmdList.add(addDashD(TEST_SUITE_PROPERTY) + "=" + getTestSuite());
+
+ addAllProperties(cmdList);
+
+ addJavaoptsProperty(cmdList);
+
+ return cmdList;
+ }
+
+ private void addCmdLineArgs(List cmdList)
+ {
+ for (Iterator iter = args.iterator();iter.hasNext();)
+ {
+ cmdList.add(iter.next().toString());
+ }
+ }
+
+ private void addJavaoptsProperty(List cmdList)
+ {
+ StringBuffer sb = new StringBuffer();
+ if (!jvmargs.isEmpty())
+ {
+ for (Iterator iter = jvmargs.iterator(); iter.hasNext();)
+ {
+ sb.append(iter.next());
+ if (iter.hasNext())
+ sb.append(" ");
+ }
+ cmdList.add(addDashD(JAVAOPTS_PROPERTY) + "=" + sb.toString());
+ }
+ }
+
+ private List getJVMArgs()
+ {
+ List cmdList = new ArrayList();
+ for (Iterator iter = jvmargs.iterator(); iter.hasNext();)
+ {
+ String arg = ((String)iter.next());
+ if (arg.indexOf(" ") != -1)
+ {
+ StringTokenizer st = new StringTokenizer(arg);
+ while (st.hasMoreTokens())
+ cmdList.add(st.nextToken());
+ }
+ else if (arg.length() > 0)
+ cmdList.add(arg);
+ }
+ return cmdList;
+ }
+
+ private void addAllProperties(List cmdList)
+ {
+ Map antProperties = getProject().getUserProperties();
+ for (Iterator iter = antProperties.entrySet().iterator(); iter.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)iter.next();
+ String key = (String)entry.getKey();
+ if (!isExcluded(key))
+ {
+ String value = (String)entry.getValue();
+ cmdList.add(addDashD(key) + "=" + value);
+ }
+ }
+ }
+
+ private String getConfigDependencyPath()
+ {
+ return configDependencyPath;
+ }
+
+ private boolean isExcluded(String prop)
+ {
+ return (excludedPropsList.contains(prop));
+ }
+
+ private String addDashD(String prop)
+ {
+ return "-D" + prop;
+ }
+
+ private void execCommandLine(List cmdList)
+ throws TaskException
+ {
+ // use ExecTask for now, since that has all we need to exec stuff
+ // this one could be made configurable
+ // for messages from the exec task
+ String fakeCommand = TchUtils.arrayToString(cmdList.toArray(), " ");
+ ExecTask execTask = new ExecTask(drainFile.getName(),
+ fakeCommand,
+ testHome.getAbsolutePath(),
+ window,
+ drainToFile);
+
+ // quick hack to get window to work
+ if (!window)
+ {
+ // this is really the command we'll exec
+ execTask.setCmdArray((String[])cmdList.toArray(new String[]{}));
+ }
+
+ // if we're running init-mode-only, we want to throw a build exception
+ // if the tch we exec has validation errors, so register for some
+ // typical error messages
+ if (initModeOnly)
+ {
+ OutputStreamSubscriber subscriber =
+ new OutputStreamSubscriberAdapter(this);
+
+ execTask
+ .registerForProcessOutput(subscriber,VALIDATION_ERROR_MESSAGE);
+ execTask
+ .registerForProcessOutput(subscriber,SCHEMA_VALIDATION_ERROR_MESSAGE);
+ execTask
+ .registerForProcessOutput(subscriber,WRONG_TARGET_ERROR_MESSAGE);
+ execTask
+ .registerForProcessOutput(subscriber,GENERAL_BUILD_FAILURE);
+ }
+
+ execTask.setVerbose(verbose);
+ execTask.setWriteCmdToFile(false);
+ execTask.runtask(null);
+
+ if (initModeOnly && validationFailed)
+ {
+ StringBuffer output = new StringBuffer();
+ output
+ .append(SEP)
+ .append(SEP)
+ .append("===============================================")
+ .append(SEP)
+ .append(execTask.getProcessSummary().getSomeProcessOutput(30))
+ .append(SEP)
+ .append("===============================================");
+ String message = null;
+ if (testSuite != null)
+ message = "validation for test-suite: " + testSuite + " failed";
+ else
+ message = "validation failed";
+ message += ", with this output: " + output.toString();
+ throw new TaskException(message);
+ }
+
+ }
+}
+
+
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/TchTask.java
------------------------------------------------------------------------------
svn:eol-style = native