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 [67/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/java/org/apache/beehive/test/tools/tch/core/test/vehicle/XMLResultFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/test/vehicle/XMLResultFactory.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/test/vehicle/XMLResultFactory.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/test/vehicle/XMLResultFactory.java Fri Aug 12 08:12:28 2005
@@ -1,123 +1,123 @@
-package org.apache.beehive.test.tools.tch.core.test.vehicle;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-
-import org.xml.sax.InputSource;
-
-import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
-import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
-import org.apache.beehive.test.tools.tch.logger.LoggerUtils;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.TestResult;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-import org.apache.beehive.test.tools.tch.util.TestResultBean;
-import org.apache.beehive.test.tools.tch.util.TextThrowable;
-
-/**
- */
-class XMLResultFactory
-{
-
- // ============================================================
- // Constants
-
- private final static SimpleDateFormat DEFAULT_DATEFORMAT =
- new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
- public final static String ERROR_MESSAGE =
- "Could not parse XML stream\nMaybe the test class could not "
- + "be instantiated on the server side";
-
- // ============================================================
- // Variables
-
- private boolean debug = true;
- private XMLLogParser logParser = null;
- private String sep = System.getProperty("line.separator");
-
- // ============================================================
- // Constructors
-
- public XMLResultFactory(InputSource is)
- {
- try
- {
- logParser = new XMLLogParser(is);
- }
- catch (Exception ex)
- {
- throw new NestedRuntimeException(ERROR_MESSAGE, ex);
- }
- }
-
- public void XMLToResult(ResultHandler resultHandler)
- {
- Collection allResults = logParser.getResults();
- Iterator i = allResults.iterator();
- while (i.hasNext())
- {
- //Properties oneResult = (Properties)i.next();
- Map oneResult = (Map)i.next();
- TestResultBean res = createResultObject(oneResult);
- resultHandler.submitResult(res);
- }
- }
-
- private TestResultBean createResultObject(Map p)
- {
- String methodName = (String)p.get(XMLLogParser.SUBTEST_NAME);
- String message = (String)p.get(XMLLogParser.MESSAGE_ELEMENT);
- String timestamp = (String)p.get(XMLLogParser.TIME);
- String typeName = (String)p.get(XMLLogParser.RESULT_TYPE);
- String stacktrace = (String)p.get(XMLLogParser.EXCEPTION_ELEMENT);
- Map usedParamMap = (Map) p.get(XMLLogParser.USED_PARAMS);
- if (methodName == null)
- methodName = "";
- if (message == null)
- message = "";
- if (timestamp == null)
- timestamp = "";
- if (typeName == null)
- typeName = "";
- if (stacktrace == null)
- stacktrace = "";
- methodName.trim();
- message.trim();
- timestamp.trim();
- typeName.trim();
- stacktrace.trim();
-
- // Make a TestCase for result object
- int type = LoggerUtils.asLogLevelInt(typeName);
- TestResultAdapter result = new TestResultAdapter(type);
- result.setOutputMsg(message);
- if (methodName != null)
- {
- result.setName(methodName);
- }
- try
- {
- result.setTimeStamp(DEFAULT_DATEFORMAT.parse(timestamp));
- }
- catch (ParseException e)
- {
- e.printStackTrace();
- }
- if (stacktrace != null && stacktrace.trim().length() > 0)
- {
- result.setThrowable(new TextThrowable(stacktrace));
- }
-
- if ((usedParamMap != null) && (usedParamMap.size() > 0)) {
- result.setParameters(new TreeMap(usedParamMap));
- }
-
- return result;
- }
-}
+package org.apache.beehive.test.tools.tch.core.test.vehicle;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+import org.xml.sax.InputSource;
+
+import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
+import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
+import org.apache.beehive.test.tools.tch.logger.LoggerUtils;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.TestResult;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+import org.apache.beehive.test.tools.tch.util.TestResultBean;
+import org.apache.beehive.test.tools.tch.util.TextThrowable;
+
+/**
+ */
+class XMLResultFactory
+{
+
+ // ============================================================
+ // Constants
+
+ private final static SimpleDateFormat DEFAULT_DATEFORMAT =
+ new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ public final static String ERROR_MESSAGE =
+ "Could not parse XML stream\nMaybe the test class could not "
+ + "be instantiated on the server side";
+
+ // ============================================================
+ // Variables
+
+ private boolean debug = true;
+ private XMLLogParser logParser = null;
+ private String sep = System.getProperty("line.separator");
+
+ // ============================================================
+ // Constructors
+
+ public XMLResultFactory(InputSource is)
+ {
+ try
+ {
+ logParser = new XMLLogParser(is);
+ }
+ catch (Exception ex)
+ {
+ throw new NestedRuntimeException(ERROR_MESSAGE, ex);
+ }
+ }
+
+ public void XMLToResult(ResultHandler resultHandler)
+ {
+ Collection allResults = logParser.getResults();
+ Iterator i = allResults.iterator();
+ while (i.hasNext())
+ {
+ //Properties oneResult = (Properties)i.next();
+ Map oneResult = (Map)i.next();
+ TestResultBean res = createResultObject(oneResult);
+ resultHandler.submitResult(res);
+ }
+ }
+
+ private TestResultBean createResultObject(Map p)
+ {
+ String methodName = (String)p.get(XMLLogParser.SUBTEST_NAME);
+ String message = (String)p.get(XMLLogParser.MESSAGE_ELEMENT);
+ String timestamp = (String)p.get(XMLLogParser.TIME);
+ String typeName = (String)p.get(XMLLogParser.RESULT_TYPE);
+ String stacktrace = (String)p.get(XMLLogParser.EXCEPTION_ELEMENT);
+ Map usedParamMap = (Map) p.get(XMLLogParser.USED_PARAMS);
+ if (methodName == null)
+ methodName = "";
+ if (message == null)
+ message = "";
+ if (timestamp == null)
+ timestamp = "";
+ if (typeName == null)
+ typeName = "";
+ if (stacktrace == null)
+ stacktrace = "";
+ methodName.trim();
+ message.trim();
+ timestamp.trim();
+ typeName.trim();
+ stacktrace.trim();
+
+ // Make a TestCase for result object
+ int type = LoggerUtils.asLogLevelInt(typeName);
+ TestResultAdapter result = new TestResultAdapter(type);
+ result.setOutputMsg(message);
+ if (methodName != null)
+ {
+ result.setName(methodName);
+ }
+ try
+ {
+ result.setTimeStamp(DEFAULT_DATEFORMAT.parse(timestamp));
+ }
+ catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ if (stacktrace != null && stacktrace.trim().length() > 0)
+ {
+ result.setThrowable(new TextThrowable(stacktrace));
+ }
+
+ if ((usedParamMap != null) && (usedParamMap.size() > 0)) {
+ result.setParameters(new TreeMap(usedParamMap));
+ }
+
+ return result;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/test/vehicle/XMLResultFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/text/MessageFormatFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/text/MessageFormatFactory.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/text/MessageFormatFactory.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/text/MessageFormatFactory.java Fri Aug 12 08:12:28 2005
@@ -1,92 +1,92 @@
-package org.apache.beehive.test.tools.tch.core.text;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.beehive.test.tools.tch.util.TokenHandler;
-
-/**
- * Right now, this class creates MessageFormats, retrievable given a String key
- */
-
-public class MessageFormatFactory
-{
- private Map formats = new HashMap(); //Map of String -> MessageFormat
- private Map paramMaps = new HashMap(); //Map of String -> Translator
-
- public String formatMessage(Object key,
- String paramName,
- String paramValue)
- {
- Map map = new HashMap(1);
- map.put(paramName,paramValue);
- return formatMessage(key,map);
- }
-
- public String formatMessage(Object key)
- {
- return formatMessage(key,new HashMap(0));
- }
-
- /**
- * Take a Map of (String -> String), for param name/value to subst into the message
- */
-
- public String formatMessage(Object key, Map params)
- {
- MessageFormat msgFormat = getMessageFormat(key);
- Translator trans = (Translator)paramMaps.get(key);
-
- int count = trans.getCount();
- Object[] args = new Object[count];
- for(int i=0; i<count; i++)
- {
- args[i] = params.get(trans.getParameterName(i));
- }
-
- return msgFormat.format(args).trim();
- }
-
- private MessageFormat getMessageFormat(Object key)
- {
- return (MessageFormat)formats.get(key);
- }
-
- public void addEntry(Object key, String message)
- {
- Translator trans = new Translator();
- TokenHandler th = new TokenHandler('{','}','%',trans);
- String patternString = th.process(message);
- formats.put(key,new MessageFormat(patternString));
- paramMaps.put(key,trans);
- }
-
- private class Translator
- implements TokenHandler.StringTranslator
- {
- private Map mapping = new HashMap(); //Map of Integer -> String
- int count = 0;
-
- public String translate(String s)
- {
- Integer countInteger = new Integer(count);
- if(!mapping.containsKey(countInteger))
- {
- mapping.put(countInteger,s);
- count++;
- }
- return "{"+countInteger.toString()+"}"; //output in the MessageFormat
- }
-
- public String getParameterName(int i)
- {
- return (String)mapping.get(new Integer(i));
- }
-
- public int getCount()
- {
- return count;
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core.text;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.beehive.test.tools.tch.util.TokenHandler;
+
+/**
+ * Right now, this class creates MessageFormats, retrievable given a String key
+ */
+
+public class MessageFormatFactory
+{
+ private Map formats = new HashMap(); //Map of String -> MessageFormat
+ private Map paramMaps = new HashMap(); //Map of String -> Translator
+
+ public String formatMessage(Object key,
+ String paramName,
+ String paramValue)
+ {
+ Map map = new HashMap(1);
+ map.put(paramName,paramValue);
+ return formatMessage(key,map);
+ }
+
+ public String formatMessage(Object key)
+ {
+ return formatMessage(key,new HashMap(0));
+ }
+
+ /**
+ * Take a Map of (String -> String), for param name/value to subst into the message
+ */
+
+ public String formatMessage(Object key, Map params)
+ {
+ MessageFormat msgFormat = getMessageFormat(key);
+ Translator trans = (Translator)paramMaps.get(key);
+
+ int count = trans.getCount();
+ Object[] args = new Object[count];
+ for(int i=0; i<count; i++)
+ {
+ args[i] = params.get(trans.getParameterName(i));
+ }
+
+ return msgFormat.format(args).trim();
+ }
+
+ private MessageFormat getMessageFormat(Object key)
+ {
+ return (MessageFormat)formats.get(key);
+ }
+
+ public void addEntry(Object key, String message)
+ {
+ Translator trans = new Translator();
+ TokenHandler th = new TokenHandler('{','}','%',trans);
+ String patternString = th.process(message);
+ formats.put(key,new MessageFormat(patternString));
+ paramMaps.put(key,trans);
+ }
+
+ private class Translator
+ implements TokenHandler.StringTranslator
+ {
+ private Map mapping = new HashMap(); //Map of Integer -> String
+ int count = 0;
+
+ public String translate(String s)
+ {
+ Integer countInteger = new Integer(count);
+ if(!mapping.containsKey(countInteger))
+ {
+ mapping.put(countInteger,s);
+ count++;
+ }
+ return "{"+countInteger.toString()+"}"; //output in the MessageFormat
+ }
+
+ public String getParameterName(int i)
+ {
+ return (String)mapping.get(new Integer(i));
+ }
+
+ public int getCount()
+ {
+ return count;
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/text/MessageFormatFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/xml/DomUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/xml/DomUtils.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/xml/DomUtils.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/xml/DomUtils.java Fri Aug 12 08:12:28 2005
@@ -1,68 +1,68 @@
-package org.apache.beehive.test.tools.tch.core.xml;
-
-import java.io.Reader;
-
-import org.w3c.dom.Document;
-
-import org.apache.beehive.test.tools.tch.util.xml.NestedXMLProcessingException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.xml.sax.InputSource;
-
-/**
- * This class exists only for the purpose of accessing our
- * internally packaged xerces parser.
- * (Document.cloneNode does not work with crimson, so we need to use xerces.
- * See below for details)
- *
- */
-public final class DomUtils
-{
- static {
- // set default DocumentBuilderFactory to the right implementation
- // class in xerces. This was necessary for AIX since the
- // default factory class resolving doesn't seem to work right
- System.setProperty(
- "javax.xml.parsers.DocumentBuilderFactory",
- "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
- }
-
- private DomUtils()
- {
- }
-
- public static Document getEmptyDocumentUsingInternalXerces()
- throws NestedXMLProcessingException
- {
- try
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setValidating(false); // no loading the DTD.
- dbf.setNamespaceAware(false); // turn on/off namespaces
- DocumentBuilder db = dbf.newDocumentBuilder();
- return db.newDocument();
- }
- catch (Exception ex)
- {
- throw new NestedXMLProcessingException(ex);
- }
- }
-
- public static Document parseUsingInternalXerces(Reader xmlInput)
- throws NestedXMLProcessingException
- {
- try
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setValidating(false); // no loading the DTD.
- dbf.setNamespaceAware(false); // turn on/off namespaces
- DocumentBuilder db = dbf.newDocumentBuilder();
- return db.parse(new InputSource(xmlInput));
- }
- catch (Exception ex)
- {
- throw new NestedXMLProcessingException(ex);
- }
- }
-}
-
+package org.apache.beehive.test.tools.tch.core.xml;
+
+import java.io.Reader;
+
+import org.w3c.dom.Document;
+
+import org.apache.beehive.test.tools.tch.util.xml.NestedXMLProcessingException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.xml.sax.InputSource;
+
+/**
+ * This class exists only for the purpose of accessing our
+ * internally packaged xerces parser.
+ * (Document.cloneNode does not work with crimson, so we need to use xerces.
+ * See below for details)
+ *
+ */
+public final class DomUtils
+{
+ static {
+ // set default DocumentBuilderFactory to the right implementation
+ // class in xerces. This was necessary for AIX since the
+ // default factory class resolving doesn't seem to work right
+ System.setProperty(
+ "javax.xml.parsers.DocumentBuilderFactory",
+ "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ }
+
+ private DomUtils()
+ {
+ }
+
+ public static Document getEmptyDocumentUsingInternalXerces()
+ throws NestedXMLProcessingException
+ {
+ try
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(false); // no loading the DTD.
+ dbf.setNamespaceAware(false); // turn on/off namespaces
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ return db.newDocument();
+ }
+ catch (Exception ex)
+ {
+ throw new NestedXMLProcessingException(ex);
+ }
+ }
+
+ public static Document parseUsingInternalXerces(Reader xmlInput)
+ throws NestedXMLProcessingException
+ {
+ try
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(false); // no loading the DTD.
+ dbf.setNamespaceAware(false); // turn on/off namespaces
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ return db.parse(new InputSource(xmlInput));
+ }
+ catch (Exception ex)
+ {
+ throw new NestedXMLProcessingException(ex);
+ }
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/xml/DomUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/ant/AntExecTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/ant/AntExecTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/ant/AntExecTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/ant/AntExecTask.java Fri Aug 12 08:12:28 2005
@@ -1,149 +1,149 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.ant;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.TaskContainer;
-
-import org.apache.beehive.test.tools.tch.compose.Parameters;
-import org.apache.beehive.test.tools.tch.core.AbstractExecutionTask;
-import org.apache.beehive.test.tools.tch.core.AnythingTask;
-import org.apache.beehive.test.tools.tch.core.ExecutionTaskValidationException;
-import org.apache.beehive.test.tools.tch.core.ParamContainer;
-import org.apache.beehive.test.tools.tch.core.ProcessEngineContainer;
-import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
-import org.apache.beehive.test.tools.tch.core.test.AbstractTestLogicTask;
-import org.apache.beehive.test.tools.tch.core.test.InternalParameters;
-import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
-import org.apache.beehive.test.tools.tch.core.test.TestLogicTask;
-import org.apache.beehive.test.tools.tch.task.TaskContext;
-import org.apache.beehive.test.tools.tch.util.AntUtils;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-import org.apache.beehive.test.tools.tch.util.ant.AntExecBuildLogger;
-
-/**
- */
-public class AntExecTask extends AbstractExecutionTask implements TaskContainer
-{
-
- private static final String DEFAULT_SUCCESS_MESSAGE =
- "All ant tasks run successfully.";
-
- private Collection allTasks = new ArrayList();
- private String successMessage = DEFAULT_SUCCESS_MESSAGE;
- private TestLogicTask antTestLogicTask = null;
-
- public void addTask(Task in)
- {
- allTasks.add(in);
- }
-
- public void setSuccessMessage(String inSuccessMessage)
- {
- successMessage = inSuccessMessage;
- }
-
- public void validate() throws ExecutionTaskValidationException
- {
- if (allTasks.isEmpty())
- {
- throw new ExecutionTaskValidationException("No tasks to run");
- }
- }
-
- public synchronized TestLogicTask getTestLogicTask()
- {
- TestLogicTask antTestLogicTask = new AntTestLogicTask(getResultHandler());
- return antTestLogicTask;
- }
-
- public class AntTestLogicTask
- extends AbstractTestLogicTask
- implements ProcessEngineContainer
- {
- private boolean timedOut = false;
-
- public AntTestLogicTask(ResultHandler inResultHandler)
- {
- super("AntTestLogicTask", inResultHandler);
- }
-
- public TaskContext run(TaskContext in)
- {
- // Set up the logger for capturing ant-exec task output.
- AntExecBuildLogger antExecLogger = new AntExecBuildLogger();
- antExecLogger.setMessageOutputLevel(Project.MSG_DEBUG);
-
- TestResultAdapter res =
- new TestResultAdapter(TchConstants.SUCCESS_LEVEL_INT);
- boolean listenerAdded = false;
- Task taskToRun = null;
- try
- {
- for (Iterator iter = allTasks.iterator(); iter.hasNext();)
- {
- // stop running tasks if this test has been timeout out
- if (timedOut)
- {
- return null;
- }
- taskToRun = (Task)iter.next();
- if (taskToRun instanceof AnythingTask)
- {
- AnythingTask anythingTask = (AnythingTask)taskToRun;
- anythingTask.setParamContainer(new ParamContainer()
- {
- public InternalParameters getParameters()
- {
- return getInternalParameters();
- }
- });
- anythingTask.setTestNode(getTestTask());
- anythingTask.setProcessEngineContainer(new ProcessEngineContainer()
- {
- public ProcessEngine getProcessEngine()
- {
- return AntExecTask.this.getProcessEngine();
- }
- });
- }
- if (!listenerAdded && AntUtils.buildListenerIsSupported())
- {
- taskToRun.getProject().addBuildListener(antExecLogger);
- listenerAdded = true;
- }
- taskToRun.perform();
- }
- res.setOutputMsg(successMessage);
- }
- catch (Exception ex)
- {
- res.setOutputMsg(antExecLogger.getCurrentOutput());
- res.setType(TchConstants.FAILURE_LEVEL_INT);
- res.setThrowableWithFilter(ex, new Throwable());
- }
- if (listenerAdded)
- {
- taskToRun.getProject().removeBuildListener(antExecLogger);
- listenerAdded = false;
- }
- getResultHandler().submitResult(res);
- return null;
- }
-
- public boolean isCanLogStdout()
- {
- return true;
- }
-
- public void notifyTimeout()
- {
- super.notifyTimeout();
- timedOut = true;
- }
- }
-}
+package org.apache.beehive.test.tools.tch.extension.exectask.ant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+
+import org.apache.beehive.test.tools.tch.compose.Parameters;
+import org.apache.beehive.test.tools.tch.core.AbstractExecutionTask;
+import org.apache.beehive.test.tools.tch.core.AnythingTask;
+import org.apache.beehive.test.tools.tch.core.ExecutionTaskValidationException;
+import org.apache.beehive.test.tools.tch.core.ParamContainer;
+import org.apache.beehive.test.tools.tch.core.ProcessEngineContainer;
+import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
+import org.apache.beehive.test.tools.tch.core.test.AbstractTestLogicTask;
+import org.apache.beehive.test.tools.tch.core.test.InternalParameters;
+import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
+import org.apache.beehive.test.tools.tch.core.test.TestLogicTask;
+import org.apache.beehive.test.tools.tch.task.TaskContext;
+import org.apache.beehive.test.tools.tch.util.AntUtils;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+import org.apache.beehive.test.tools.tch.util.ant.AntExecBuildLogger;
+
+/**
+ */
+public class AntExecTask extends AbstractExecutionTask implements TaskContainer
+{
+
+ private static final String DEFAULT_SUCCESS_MESSAGE =
+ "All ant tasks run successfully.";
+
+ private Collection allTasks = new ArrayList();
+ private String successMessage = DEFAULT_SUCCESS_MESSAGE;
+ private TestLogicTask antTestLogicTask = null;
+
+ public void addTask(Task in)
+ {
+ allTasks.add(in);
+ }
+
+ public void setSuccessMessage(String inSuccessMessage)
+ {
+ successMessage = inSuccessMessage;
+ }
+
+ public void validate() throws ExecutionTaskValidationException
+ {
+ if (allTasks.isEmpty())
+ {
+ throw new ExecutionTaskValidationException("No tasks to run");
+ }
+ }
+
+ public synchronized TestLogicTask getTestLogicTask()
+ {
+ TestLogicTask antTestLogicTask = new AntTestLogicTask(getResultHandler());
+ return antTestLogicTask;
+ }
+
+ public class AntTestLogicTask
+ extends AbstractTestLogicTask
+ implements ProcessEngineContainer
+ {
+ private boolean timedOut = false;
+
+ public AntTestLogicTask(ResultHandler inResultHandler)
+ {
+ super("AntTestLogicTask", inResultHandler);
+ }
+
+ public TaskContext run(TaskContext in)
+ {
+ // Set up the logger for capturing ant-exec task output.
+ AntExecBuildLogger antExecLogger = new AntExecBuildLogger();
+ antExecLogger.setMessageOutputLevel(Project.MSG_DEBUG);
+
+ TestResultAdapter res =
+ new TestResultAdapter(TchConstants.SUCCESS_LEVEL_INT);
+ boolean listenerAdded = false;
+ Task taskToRun = null;
+ try
+ {
+ for (Iterator iter = allTasks.iterator(); iter.hasNext();)
+ {
+ // stop running tasks if this test has been timeout out
+ if (timedOut)
+ {
+ return null;
+ }
+ taskToRun = (Task)iter.next();
+ if (taskToRun instanceof AnythingTask)
+ {
+ AnythingTask anythingTask = (AnythingTask)taskToRun;
+ anythingTask.setParamContainer(new ParamContainer()
+ {
+ public InternalParameters getParameters()
+ {
+ return getInternalParameters();
+ }
+ });
+ anythingTask.setTestNode(getTestTask());
+ anythingTask.setProcessEngineContainer(new ProcessEngineContainer()
+ {
+ public ProcessEngine getProcessEngine()
+ {
+ return AntExecTask.this.getProcessEngine();
+ }
+ });
+ }
+ if (!listenerAdded && AntUtils.buildListenerIsSupported())
+ {
+ taskToRun.getProject().addBuildListener(antExecLogger);
+ listenerAdded = true;
+ }
+ taskToRun.perform();
+ }
+ res.setOutputMsg(successMessage);
+ }
+ catch (Exception ex)
+ {
+ res.setOutputMsg(antExecLogger.getCurrentOutput());
+ res.setType(TchConstants.FAILURE_LEVEL_INT);
+ res.setThrowableWithFilter(ex, new Throwable());
+ }
+ if (listenerAdded)
+ {
+ taskToRun.getProject().removeBuildListener(antExecLogger);
+ listenerAdded = false;
+ }
+ getResultHandler().submitResult(res);
+ return null;
+ }
+
+ public boolean isCanLogStdout()
+ {
+ return true;
+ }
+
+ public void notifyTimeout()
+ {
+ super.notifyTimeout();
+ timedOut = true;
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/ant/AntExecTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/cmdline/CommandLineTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/cmdline/CommandLineTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/cmdline/CommandLineTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/cmdline/CommandLineTask.java Fri Aug 12 08:12:28 2005
@@ -1,457 +1,457 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.cmdline;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-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.regexp.RE;
-import org.apache.regexp.RECompiler;
-import org.apache.regexp.REProgram;
-
-import org.apache.beehive.test.tools.tch.compose.Parameters;
-import org.apache.beehive.test.tools.tch.core.AbstractExecutionTask;
-import org.apache.beehive.test.tools.tch.core.ExecutionTaskValidationException;
-import org.apache.beehive.test.tools.tch.core.test.AbstractTestLogicTask;
-import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
-import org.apache.beehive.test.tools.tch.core.test.TestLogicTask;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.Cmd;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.CmdToken;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.EnvEntry;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.ExpectedResponseCodeElement;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.ExpectedStringElement;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.Timeout;
-import org.apache.beehive.test.tools.tch.extension.exectask.common.WorkingDir;
-import org.apache.beehive.test.tools.tch.task.TaskContext;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.ProcessHandler;
-import org.apache.beehive.test.tools.tch.util.StringUtils;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-import org.apache.beehive.test.tools.tch.util.TestResultBean;
-
-/**
- * ExecutionTask for CommandLine invokes
- */
-
-public class CommandLineTask extends AbstractExecutionTask
-{
-
- private CommandLineTestLogicTask testTask = null;
-
- // nested element setters
- public void addConfiguredCmd(Cmd in)
- {
- in.addText(handleValue(in.getValue()));
- getCommandLineTestTask().setCmd(in);
- }
-
- public void addConfiguredCmdToken(CmdToken in)
- {
- getCommandLineTestTask().addCmdToken(handleValue(in.getValue()));
- }
-
- public void addConfiguredEnvEntry(EnvEntry in)
- {
- in.setName(handleValue(in.getName()));
- in.setValue(handleValue(in.getValue()));
- getCommandLineTestTask().addEnvEntry(in);
- }
-
- public void addConfiguredExpectedExitCode(ExpectedResponseCodeElement in)
- {
- in.addText(handleValue(in.getExpectedResponseCode()));
- getCommandLineTestTask().setExpectedExitCode(in);
- }
-
- public void addConfiguredExpectedOutputString(ExpectedStringElement in)
- {
- in.setRegexp(handleValue(in.getRegexpString()));
- in.addText(handleValue(in.getExpectedString()));
- getCommandLineTestTask().addExpectedOutputString(in);
- }
-
- public void addConfiguredExpectedErrorString(ExpectedStringElement in)
- {
- in.setRegexp(handleValue(in.getRegexpString()));
- in.addText(handleValue(in.getExpectedString()));
- getCommandLineTestTask().addExpectedErrorString(in);
- }
-
- public void addConfiguredExpectedOutputErrorString(ExpectedStringElement in)
- {
- in.setRegexp(handleValue(in.getRegexpString()));
- in.addText(handleValue(in.getExpectedString()));
- getCommandLineTestTask().addExpectedOutputErrorString(in);
- }
-
- public void addConfiguredTimeout(Timeout in)
- {
- in.addText(handleValue(in.getValue()));
- getCommandLineTestTask().setTimeout(in);
- }
-
- public void addConfiguredWorkingDir(WorkingDir in)
- {
- in.addText(handleValue(in.getValue()));
- getCommandLineTestTask().setWorkingDir(in);
- }
-
- // attribute setters
-
- public void setCheckMode(String in)
- {
- getCommandLineTestTask().setCheckMode(handleValue(in));
- }
-
- public void setEcho(boolean echo)
- {
- getCommandLineTestTask().setEcho(echo);
- }
-
- public void validate() throws ExecutionTaskValidationException
- {
- }
-
- public TestLogicTask getTestLogicTask()
- {
- TestLogicTask testTask = getCommandLineTestTask();
- testTask.setProcessEngine(getProcessEngine());
- System.out.println(testTask.toString());
- return testTask;
- }
-
- private synchronized CommandLineTestLogicTask getCommandLineTestTask()
- {
- if (testTask == null)
- {
- testTask = new CommandLineTestLogicTask(this);
- }
- return testTask;
- }
-
- public static class CommandLineTestLogicTask extends AbstractTestLogicTask
- {
- private CommandLineTask commandLineTask = null;
- private static RECompiler reCompiler = new RECompiler();
-
- private Parameters parameters = null;
-
- private Cmd cmd = new Cmd();
- private List cmdArray = new ArrayList();
- private Set envEntries = new HashSet();
- private ExpectedResponseCodeElement expectedExitCode =
- new ExpectedResponseCodeElement();
- private ExpectedStringElement expectedOutputString =
- new ExpectedStringElement();
- private ExpectedStringElement expectedErrorString =
- new ExpectedStringElement();
- private ExpectedStringElement expectedOutputErrorString =
- new ExpectedStringElement();
- private String timeout = null;
- private String workingDir = null;
- private String checkMode = null;
- private boolean echo = true;
-
- // This won't work for Ant 1.6
- // public CommandLineTestLogicTask(
- // Parameters inParameters,
- // ResultHandler inResultHandler)
- public CommandLineTestLogicTask(CommandLineTask task)
- {
- super("Command Line Test Logic Task", null);
- commandLineTask = task;
- }
-
- public void setParameters(Parameters inParameters)
- {
- parameters = inParameters;
- }
-
- // element setters
- public void setCmd(Cmd in)
- {
- cmd = in;
- }
-
- public void addCmdToken(String inValue)
- {
- cmdArray.add(inValue);
- }
-
- public void addEnvEntry(EnvEntry in)
- {
- envEntries.add(in);
- }
-
- public void setExpectedExitCode(ExpectedResponseCodeElement in)
- {
- expectedExitCode = in;
- }
-
- public void addExpectedOutputString(ExpectedStringElement in)
- {
- expectedOutputString = in;
- }
-
- public void addExpectedErrorString(ExpectedStringElement in)
- {
- expectedErrorString = in;
- }
-
- public void addExpectedOutputErrorString(ExpectedStringElement in)
- {
- expectedOutputErrorString = in;
- }
-
- public void setTimeout(Timeout in)
- {
- timeout = in.getValue();
- }
-
- public void setWorkingDir(WorkingDir in)
- {
- workingDir = in.getValue();
- }
-
- public void setCheckMode(String in)
- {
- checkMode = in;
- }
-
- public void setEcho(boolean in)
- {
- echo = in;
- }
-
- public TaskContext run(TaskContext in)
- {
- setParameters(commandLineTask.getParameters());
- setResultHandler(commandLineTask.getResultHandler());
-
- TestResultAdapter res =
- new TestResultAdapter(TchConstants.SUCCESS_LEVEL_INT);
- try
- {
- doTest(res);
- }
- catch (Exception exc)
- {
- res.setType(TchConstants.FAILURE_LEVEL_INT);
- res.setThrowableWithFilter(exc, new Throwable());
- }
- getResultHandler().submitResult(res);
- return null;
- }
-
- private void doTest(TestResultBean res) throws Exception
- {
- ProcessHandler ph = getProcessHandler();
- ph.run();
- evaluateResult(ph, res);
- }
-
- private ProcessHandler getProcessHandler() throws Exception
- {
- long timeoutLong = -1;
- if (timeout != null)
- timeoutLong = Long.parseLong(timeout);
-
- Map env = null;
- if (envEntries.size() > 0)
- {
- env = new HashMap();
- for (Iterator iter = envEntries.iterator(); iter.hasNext();)
- {
- EnvEntry entry = (EnvEntry)iter.next();
- String name1 = entry.getName();
- String value1 = entry.getValue();
- env.put(name1, value1);
- }
- }
-
- String[] envExec = null;
- String[] cmdExec = null;
- File workingDirFile = null;
- if (env != null)
- {
- envExec = new String[env.size()];
- int i = 0;
- for (Iterator itr = env.keySet().iterator(); itr.hasNext();)
- {
- String key1 = (String)itr.next();
- String val1 = (String)env.get(key1);
- envExec[i] = key1 + "=" + val1;
- i++;
- }
- }
- if (cmdArray.size() != 0)
- {
- cmdExec = new String[cmdArray.size()];
- cmdExec = (String[])cmdArray.toArray(cmdExec);
- }
- if (workingDir != null)
- workingDirFile = new File(workingDir);
-
- Process p = null;
-
- if (cmdExec == null)
- {
- if (echo)
- logInform("Executing command: \"" + cmd.getValue() + "\"");
- p = Runtime.getRuntime().exec(cmd.getValue(), envExec, workingDirFile);
- }
- else
- {
- String cmdString = "";
- for (int i = 0; i < cmdExec.length; i++)
- {
- cmdString += cmdExec[i] + " ";
- }
- if (echo)
- logInform("Executing command: \"" + cmdString.trim() + "\"");
- p = Runtime.getRuntime().exec(cmdExec, envExec, workingDirFile);
- }
-
- return new ProcessHandler(p, timeoutLong, null);
- }
-
- private void evaluateResult(ProcessHandler ph, TestResultBean res)
- throws Exception
- {
- if (ph.wasTimedOut())
- {
- res.setType(TchConstants.FAILURE_LEVEL_INT);
- res.setOutputMsg("Process execution timed out");
- return;
- }
- String testValidateDirective = checkMode;
- StringTokenizer stz = new StringTokenizer(testValidateDirective);
- StringBuffer buff = new StringBuffer();
- res.setType(TchConstants.FAILURE_LEVEL_INT);
- boolean flag = true;
- while (stz.hasMoreTokens())
- {
- String tok = stz.nextToken();
- boolean flag1 = false;
- if ("EXITCODE".equals(tok))
- {
- flag1 = checkExitCode(ph.getExitCode(), buff);
- }
- else if ("OUTPUTSTRING".equals(tok))
- {
- flag1 =
- checkString(
- ph.getStdOutString(),
- buff,
- expectedOutputString,
- "OUTPUT");
- }
- else if ("ERRORSTRING".equals(tok))
- {
- flag1 =
- checkString(
- ph.getStdErrString(),
- buff,
- expectedErrorString,
- "ERROR");
- }
- else if ("OUTPUTERRORSTRING".equals(tok))
- {
- flag1 =
- checkString(
- ph.getStdOutErrString(),
- buff,
- expectedOutputErrorString,
- "OUTPUT-ERROR");
- }
-
- flag = flag && flag1;
- }
- res.setType(
- (flag)
- ? TchConstants.SUCCESS_LEVEL_INT
- : TchConstants.FAILURE_LEVEL_INT);
- res.setOutputMsg(buff.toString());
- }
-
- private boolean checkExitCode(int code, StringBuffer buf) throws Exception
- {
- boolean flag = false;
- int expectedCode =
- Integer.parseInt(expectedExitCode.getExpectedResponseCode());
- flag = (code == expectedCode);
- buf
- .append("GOT exit code: ")
- .append(code)
- .append(" EXPECTED: ")
- .append(expectedCode)
- .append("\n");
- return flag;
- }
-
- /**
- * eliminate "\r" and "\n" when checking strings
- */
- private boolean checkString(
- String result,
- StringBuffer buf,
- ExpectedStringElement expectedElem,
- String dispval)
- throws Exception
- {
- boolean flag = false;
- String expectedResult = "";
- boolean regexp = false;
-
- expectedResult = expectedElem.getExpectedString();
- regexp = expectedElem.getRegexp();
-
- String result2 = StringUtils.trimLines(result);
- String expectedResult2 = StringUtils.trimLines(expectedResult);
- logInform("expected result: \"" + expectedResult2 + "\"");
- logInform("actual result: \"" + result2 + "\"");
-
- if (regexp)
- {
- REProgram rePgm = reCompiler.compile(expectedResult2);
- RE re = new RE(rePgm, RE.MATCH_SINGLELINE);
- if (re.match(result2))
- flag = true;
- buf
- .append("GOT STD ")
- .append(dispval)
- .append(": ")
- .append(result)
- .append("\n")
- .append(" EXPECTED regexp: ")
- .append(expectedResult)
- .append("\n");
- }
- else
- {
- if (result2.equals(expectedResult2))
- flag = true;
- buf
- .append("GOT STD ")
- .append(dispval)
- .append(": ")
- .append(result)
- .append("\n")
- .append(" EXPECTED : ")
- .append(expectedResult)
- .append("\n");
- }
- return flag;
- }
- }
-
- public boolean isCanLogStdout()
- {
- return true;
- }
-}
+package org.apache.beehive.test.tools.tch.extension.exectask.cmdline;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+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.regexp.RE;
+import org.apache.regexp.RECompiler;
+import org.apache.regexp.REProgram;
+
+import org.apache.beehive.test.tools.tch.compose.Parameters;
+import org.apache.beehive.test.tools.tch.core.AbstractExecutionTask;
+import org.apache.beehive.test.tools.tch.core.ExecutionTaskValidationException;
+import org.apache.beehive.test.tools.tch.core.test.AbstractTestLogicTask;
+import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
+import org.apache.beehive.test.tools.tch.core.test.TestLogicTask;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.Cmd;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.CmdToken;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.EnvEntry;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.ExpectedResponseCodeElement;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.ExpectedStringElement;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.Timeout;
+import org.apache.beehive.test.tools.tch.extension.exectask.common.WorkingDir;
+import org.apache.beehive.test.tools.tch.task.TaskContext;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.ProcessHandler;
+import org.apache.beehive.test.tools.tch.util.StringUtils;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+import org.apache.beehive.test.tools.tch.util.TestResultBean;
+
+/**
+ * ExecutionTask for CommandLine invokes
+ */
+
+public class CommandLineTask extends AbstractExecutionTask
+{
+
+ private CommandLineTestLogicTask testTask = null;
+
+ // nested element setters
+ public void addConfiguredCmd(Cmd in)
+ {
+ in.addText(handleValue(in.getValue()));
+ getCommandLineTestTask().setCmd(in);
+ }
+
+ public void addConfiguredCmdToken(CmdToken in)
+ {
+ getCommandLineTestTask().addCmdToken(handleValue(in.getValue()));
+ }
+
+ public void addConfiguredEnvEntry(EnvEntry in)
+ {
+ in.setName(handleValue(in.getName()));
+ in.setValue(handleValue(in.getValue()));
+ getCommandLineTestTask().addEnvEntry(in);
+ }
+
+ public void addConfiguredExpectedExitCode(ExpectedResponseCodeElement in)
+ {
+ in.addText(handleValue(in.getExpectedResponseCode()));
+ getCommandLineTestTask().setExpectedExitCode(in);
+ }
+
+ public void addConfiguredExpectedOutputString(ExpectedStringElement in)
+ {
+ in.setRegexp(handleValue(in.getRegexpString()));
+ in.addText(handleValue(in.getExpectedString()));
+ getCommandLineTestTask().addExpectedOutputString(in);
+ }
+
+ public void addConfiguredExpectedErrorString(ExpectedStringElement in)
+ {
+ in.setRegexp(handleValue(in.getRegexpString()));
+ in.addText(handleValue(in.getExpectedString()));
+ getCommandLineTestTask().addExpectedErrorString(in);
+ }
+
+ public void addConfiguredExpectedOutputErrorString(ExpectedStringElement in)
+ {
+ in.setRegexp(handleValue(in.getRegexpString()));
+ in.addText(handleValue(in.getExpectedString()));
+ getCommandLineTestTask().addExpectedOutputErrorString(in);
+ }
+
+ public void addConfiguredTimeout(Timeout in)
+ {
+ in.addText(handleValue(in.getValue()));
+ getCommandLineTestTask().setTimeout(in);
+ }
+
+ public void addConfiguredWorkingDir(WorkingDir in)
+ {
+ in.addText(handleValue(in.getValue()));
+ getCommandLineTestTask().setWorkingDir(in);
+ }
+
+ // attribute setters
+
+ public void setCheckMode(String in)
+ {
+ getCommandLineTestTask().setCheckMode(handleValue(in));
+ }
+
+ public void setEcho(boolean echo)
+ {
+ getCommandLineTestTask().setEcho(echo);
+ }
+
+ public void validate() throws ExecutionTaskValidationException
+ {
+ }
+
+ public TestLogicTask getTestLogicTask()
+ {
+ TestLogicTask testTask = getCommandLineTestTask();
+ testTask.setProcessEngine(getProcessEngine());
+ System.out.println(testTask.toString());
+ return testTask;
+ }
+
+ private synchronized CommandLineTestLogicTask getCommandLineTestTask()
+ {
+ if (testTask == null)
+ {
+ testTask = new CommandLineTestLogicTask(this);
+ }
+ return testTask;
+ }
+
+ public static class CommandLineTestLogicTask extends AbstractTestLogicTask
+ {
+ private CommandLineTask commandLineTask = null;
+ private static RECompiler reCompiler = new RECompiler();
+
+ private Parameters parameters = null;
+
+ private Cmd cmd = new Cmd();
+ private List cmdArray = new ArrayList();
+ private Set envEntries = new HashSet();
+ private ExpectedResponseCodeElement expectedExitCode =
+ new ExpectedResponseCodeElement();
+ private ExpectedStringElement expectedOutputString =
+ new ExpectedStringElement();
+ private ExpectedStringElement expectedErrorString =
+ new ExpectedStringElement();
+ private ExpectedStringElement expectedOutputErrorString =
+ new ExpectedStringElement();
+ private String timeout = null;
+ private String workingDir = null;
+ private String checkMode = null;
+ private boolean echo = true;
+
+ // This won't work for Ant 1.6
+ // public CommandLineTestLogicTask(
+ // Parameters inParameters,
+ // ResultHandler inResultHandler)
+ public CommandLineTestLogicTask(CommandLineTask task)
+ {
+ super("Command Line Test Logic Task", null);
+ commandLineTask = task;
+ }
+
+ public void setParameters(Parameters inParameters)
+ {
+ parameters = inParameters;
+ }
+
+ // element setters
+ public void setCmd(Cmd in)
+ {
+ cmd = in;
+ }
+
+ public void addCmdToken(String inValue)
+ {
+ cmdArray.add(inValue);
+ }
+
+ public void addEnvEntry(EnvEntry in)
+ {
+ envEntries.add(in);
+ }
+
+ public void setExpectedExitCode(ExpectedResponseCodeElement in)
+ {
+ expectedExitCode = in;
+ }
+
+ public void addExpectedOutputString(ExpectedStringElement in)
+ {
+ expectedOutputString = in;
+ }
+
+ public void addExpectedErrorString(ExpectedStringElement in)
+ {
+ expectedErrorString = in;
+ }
+
+ public void addExpectedOutputErrorString(ExpectedStringElement in)
+ {
+ expectedOutputErrorString = in;
+ }
+
+ public void setTimeout(Timeout in)
+ {
+ timeout = in.getValue();
+ }
+
+ public void setWorkingDir(WorkingDir in)
+ {
+ workingDir = in.getValue();
+ }
+
+ public void setCheckMode(String in)
+ {
+ checkMode = in;
+ }
+
+ public void setEcho(boolean in)
+ {
+ echo = in;
+ }
+
+ public TaskContext run(TaskContext in)
+ {
+ setParameters(commandLineTask.getParameters());
+ setResultHandler(commandLineTask.getResultHandler());
+
+ TestResultAdapter res =
+ new TestResultAdapter(TchConstants.SUCCESS_LEVEL_INT);
+ try
+ {
+ doTest(res);
+ }
+ catch (Exception exc)
+ {
+ res.setType(TchConstants.FAILURE_LEVEL_INT);
+ res.setThrowableWithFilter(exc, new Throwable());
+ }
+ getResultHandler().submitResult(res);
+ return null;
+ }
+
+ private void doTest(TestResultBean res) throws Exception
+ {
+ ProcessHandler ph = getProcessHandler();
+ ph.run();
+ evaluateResult(ph, res);
+ }
+
+ private ProcessHandler getProcessHandler() throws Exception
+ {
+ long timeoutLong = -1;
+ if (timeout != null)
+ timeoutLong = Long.parseLong(timeout);
+
+ Map env = null;
+ if (envEntries.size() > 0)
+ {
+ env = new HashMap();
+ for (Iterator iter = envEntries.iterator(); iter.hasNext();)
+ {
+ EnvEntry entry = (EnvEntry)iter.next();
+ String name1 = entry.getName();
+ String value1 = entry.getValue();
+ env.put(name1, value1);
+ }
+ }
+
+ String[] envExec = null;
+ String[] cmdExec = null;
+ File workingDirFile = null;
+ if (env != null)
+ {
+ envExec = new String[env.size()];
+ int i = 0;
+ for (Iterator itr = env.keySet().iterator(); itr.hasNext();)
+ {
+ String key1 = (String)itr.next();
+ String val1 = (String)env.get(key1);
+ envExec[i] = key1 + "=" + val1;
+ i++;
+ }
+ }
+ if (cmdArray.size() != 0)
+ {
+ cmdExec = new String[cmdArray.size()];
+ cmdExec = (String[])cmdArray.toArray(cmdExec);
+ }
+ if (workingDir != null)
+ workingDirFile = new File(workingDir);
+
+ Process p = null;
+
+ if (cmdExec == null)
+ {
+ if (echo)
+ logInform("Executing command: \"" + cmd.getValue() + "\"");
+ p = Runtime.getRuntime().exec(cmd.getValue(), envExec, workingDirFile);
+ }
+ else
+ {
+ String cmdString = "";
+ for (int i = 0; i < cmdExec.length; i++)
+ {
+ cmdString += cmdExec[i] + " ";
+ }
+ if (echo)
+ logInform("Executing command: \"" + cmdString.trim() + "\"");
+ p = Runtime.getRuntime().exec(cmdExec, envExec, workingDirFile);
+ }
+
+ return new ProcessHandler(p, timeoutLong, null);
+ }
+
+ private void evaluateResult(ProcessHandler ph, TestResultBean res)
+ throws Exception
+ {
+ if (ph.wasTimedOut())
+ {
+ res.setType(TchConstants.FAILURE_LEVEL_INT);
+ res.setOutputMsg("Process execution timed out");
+ return;
+ }
+ String testValidateDirective = checkMode;
+ StringTokenizer stz = new StringTokenizer(testValidateDirective);
+ StringBuffer buff = new StringBuffer();
+ res.setType(TchConstants.FAILURE_LEVEL_INT);
+ boolean flag = true;
+ while (stz.hasMoreTokens())
+ {
+ String tok = stz.nextToken();
+ boolean flag1 = false;
+ if ("EXITCODE".equals(tok))
+ {
+ flag1 = checkExitCode(ph.getExitCode(), buff);
+ }
+ else if ("OUTPUTSTRING".equals(tok))
+ {
+ flag1 =
+ checkString(
+ ph.getStdOutString(),
+ buff,
+ expectedOutputString,
+ "OUTPUT");
+ }
+ else if ("ERRORSTRING".equals(tok))
+ {
+ flag1 =
+ checkString(
+ ph.getStdErrString(),
+ buff,
+ expectedErrorString,
+ "ERROR");
+ }
+ else if ("OUTPUTERRORSTRING".equals(tok))
+ {
+ flag1 =
+ checkString(
+ ph.getStdOutErrString(),
+ buff,
+ expectedOutputErrorString,
+ "OUTPUT-ERROR");
+ }
+
+ flag = flag && flag1;
+ }
+ res.setType(
+ (flag)
+ ? TchConstants.SUCCESS_LEVEL_INT
+ : TchConstants.FAILURE_LEVEL_INT);
+ res.setOutputMsg(buff.toString());
+ }
+
+ private boolean checkExitCode(int code, StringBuffer buf) throws Exception
+ {
+ boolean flag = false;
+ int expectedCode =
+ Integer.parseInt(expectedExitCode.getExpectedResponseCode());
+ flag = (code == expectedCode);
+ buf
+ .append("GOT exit code: ")
+ .append(code)
+ .append(" EXPECTED: ")
+ .append(expectedCode)
+ .append("\n");
+ return flag;
+ }
+
+ /**
+ * eliminate "\r" and "\n" when checking strings
+ */
+ private boolean checkString(
+ String result,
+ StringBuffer buf,
+ ExpectedStringElement expectedElem,
+ String dispval)
+ throws Exception
+ {
+ boolean flag = false;
+ String expectedResult = "";
+ boolean regexp = false;
+
+ expectedResult = expectedElem.getExpectedString();
+ regexp = expectedElem.getRegexp();
+
+ String result2 = StringUtils.trimLines(result);
+ String expectedResult2 = StringUtils.trimLines(expectedResult);
+ logInform("expected result: \"" + expectedResult2 + "\"");
+ logInform("actual result: \"" + result2 + "\"");
+
+ if (regexp)
+ {
+ REProgram rePgm = reCompiler.compile(expectedResult2);
+ RE re = new RE(rePgm, RE.MATCH_SINGLELINE);
+ if (re.match(result2))
+ flag = true;
+ buf
+ .append("GOT STD ")
+ .append(dispval)
+ .append(": ")
+ .append(result)
+ .append("\n")
+ .append(" EXPECTED regexp: ")
+ .append(expectedResult)
+ .append("\n");
+ }
+ else
+ {
+ if (result2.equals(expectedResult2))
+ flag = true;
+ buf
+ .append("GOT STD ")
+ .append(dispval)
+ .append(": ")
+ .append(result)
+ .append("\n")
+ .append(" EXPECTED : ")
+ .append(expectedResult)
+ .append("\n");
+ }
+ return flag;
+ }
+ }
+
+ public boolean isCanLogStdout()
+ {
+ return true;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/cmdline/CommandLineTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/AuthenticateElement.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/AuthenticateElement.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/AuthenticateElement.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/AuthenticateElement.java Fri Aug 12 08:12:28 2005
@@ -1,35 +1,35 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class AuthenticateElement
-{
- private String user = null;
- private String password = null;
-
- public void setUser(String in)
- {
- user = in;
- }
-
- public String getUser()
- {
- return user;
- }
-
-
- public void setPassword(String in)
- {
- password = in;
- }
-
- public String getPassword()
- {
- return password;
- }
-
-
- public String toString()
- {
- return "user: " + user + ", password: " + password;
- }
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class AuthenticateElement
+{
+ private String user = null;
+ private String password = null;
+
+ public void setUser(String in)
+ {
+ user = in;
+ }
+
+ public String getUser()
+ {
+ return user;
+ }
+
+
+ public void setPassword(String in)
+ {
+ password = in;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+
+ public String toString()
+ {
+ return "user: " + user + ", password: " + password;
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/AuthenticateElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/Cmd.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/Cmd.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/Cmd.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/Cmd.java Fri Aug 12 08:12:28 2005
@@ -1,18 +1,18 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class Cmd
-{
- private String value = null;
-
- public void addText(String in)
- {
- value = in;
- }
-
- public String getValue()
- {
- return value;
- }
-
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class Cmd
+{
+ private String value = null;
+
+ public void addText(String in)
+ {
+ value = in;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/Cmd.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/CmdToken.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/CmdToken.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/CmdToken.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/CmdToken.java Fri Aug 12 08:12:28 2005
@@ -1,18 +1,18 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class CmdToken
-{
- private String value = null;
-
- public void addText(String in)
- {
- value = in;
- }
-
- public String getValue()
- {
- return value;
- }
-
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class CmdToken
+{
+ private String value = null;
+
+ public void addText(String in)
+ {
+ value = in;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/CmdToken.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleClient.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleClient.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleClient.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleClient.java Fri Aug 12 08:12:28 2005
@@ -1,15 +1,15 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-import java.util.Map;
-
-/**
- * Interface which all Clients must implement.
- * A good example is the EagleHttpClient.
- *
- * @version 1.0, May 16, 2001
- */
-public interface EagleClient
-{
- public void init (Map m)
- throws Exception;
-}
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+import java.util.Map;
+
+/**
+ * Interface which all Clients must implement.
+ * A good example is the EagleHttpClient.
+ *
+ * @version 1.0, May 16, 2001
+ */
+public interface EagleClient
+{
+ public void init (Map m)
+ throws Exception;
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleHttpClient.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleHttpClient.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleHttpClient.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleHttpClient.java Fri Aug 12 08:12:28 2005
@@ -1,123 +1,123 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.Cookie;
-
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-
-/**
- * an Eagle HttpClient.
- * <p>
- * Provides interfaces for adding Cookies,
- * and retrieving them for a specific host.
- * @version 1.0, May 16, 2001
- */
-public class EagleHttpClient
- implements EagleClient
-{
- private static String LOCALHOST_HOSTADDRESS = null;
-
- static {
- try {
- LOCALHOST_HOSTADDRESS = InetAddress.getLocalHost ().getHostAddress ();
- }
- catch (Exception exc) { TchUtils.log (exc); }
- }
-
- private Map ckMap = new HashMap ();
- private Map ckMap2 = new HashMap ();
-
- public void init (Map m) throws Exception { }
-
- /** Add a cookie for a specific host */
- public void addCookie (String hostName, Cookie c)
- throws Exception
- {
- hostName = asHostName (hostName);
- // TchUtils.log ("addCookie: " + hostName);
- addCookie1 (hostName, c);
- }
-
- private void addCookie1 (String hostName, Cookie c)
- throws Exception
- {
- List m1 = (List) ckMap.get (hostName);
- Map m2 = (Map) ckMap2.get (hostName);
- if (m1 == null || m2 == null) {
- m1 = new ArrayList ();
- ckMap.put (hostName, m1);
- m2 = new HashMap ();
- ckMap2.put (hostName, m2);
- }
- // check if that cookie exists
- String cName = c.getName ();
- Object obj2 = m2.get (cName );
- if (obj2 == null) {
- m1.add (c);
- m2.put (cName, c.getValue());
- }
- else
- m2.put (cName, c.getValue());
-
- }
-
- /** Add a collection of cookies for a specific host */
- public void addCookies (String hostName, Collection cList)
- throws Exception
- {
- hostName = asHostName (hostName);
- // TchUtils.log ("addCookie: " + hostName);
- for (Iterator itr = cList.iterator(); itr.hasNext(); ) {
- Cookie c = (Cookie) itr.next ();
- addCookie1 (hostName, c);
- }
-
- }
-
- /** Retrieve all the cookies for a specific host */
- /* public List getCookies (String hostName)
- throws Exception
- {
- hostName = asHostName (hostName);
- List m1 = (List) ckMap.get (hostName);
- // TchUtils.log ("getCookies: " + hostName + ": " + m1);
- return m1;
- } */
- public HashMap getCookies (String hostName)
- throws Exception
- {
- hostName = asHostName (hostName);
- HashMap m1 = (HashMap) ckMap2.get (hostName);
- return m1;
- }
-
- /** Clear all the cookies for a specific host */
- public void clearCookies (String hostName)
- throws Exception
- {
- hostName = asHostName (hostName);
- ckMap.remove (hostName);
- ckMap2.remove (hostName);
- }
-
- private String asHostName (String hostName)
- throws Exception
- {
- if (LOCALHOST_HOSTADDRESS != null && "localhost".equals (hostName) ) {
- hostName = LOCALHOST_HOSTADDRESS;
- }
- else {
- InetAddress ia = InetAddress.getByName (hostName);
- hostName = ia.getHostAddress ();
- }
- return hostName;
- }
-
-}
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.Cookie;
+
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+
+/**
+ * an Eagle HttpClient.
+ * <p>
+ * Provides interfaces for adding Cookies,
+ * and retrieving them for a specific host.
+ * @version 1.0, May 16, 2001
+ */
+public class EagleHttpClient
+ implements EagleClient
+{
+ private static String LOCALHOST_HOSTADDRESS = null;
+
+ static {
+ try {
+ LOCALHOST_HOSTADDRESS = InetAddress.getLocalHost ().getHostAddress ();
+ }
+ catch (Exception exc) { TchUtils.log (exc); }
+ }
+
+ private Map ckMap = new HashMap ();
+ private Map ckMap2 = new HashMap ();
+
+ public void init (Map m) throws Exception { }
+
+ /** Add a cookie for a specific host */
+ public void addCookie (String hostName, Cookie c)
+ throws Exception
+ {
+ hostName = asHostName (hostName);
+ // TchUtils.log ("addCookie: " + hostName);
+ addCookie1 (hostName, c);
+ }
+
+ private void addCookie1 (String hostName, Cookie c)
+ throws Exception
+ {
+ List m1 = (List) ckMap.get (hostName);
+ Map m2 = (Map) ckMap2.get (hostName);
+ if (m1 == null || m2 == null) {
+ m1 = new ArrayList ();
+ ckMap.put (hostName, m1);
+ m2 = new HashMap ();
+ ckMap2.put (hostName, m2);
+ }
+ // check if that cookie exists
+ String cName = c.getName ();
+ Object obj2 = m2.get (cName );
+ if (obj2 == null) {
+ m1.add (c);
+ m2.put (cName, c.getValue());
+ }
+ else
+ m2.put (cName, c.getValue());
+
+ }
+
+ /** Add a collection of cookies for a specific host */
+ public void addCookies (String hostName, Collection cList)
+ throws Exception
+ {
+ hostName = asHostName (hostName);
+ // TchUtils.log ("addCookie: " + hostName);
+ for (Iterator itr = cList.iterator(); itr.hasNext(); ) {
+ Cookie c = (Cookie) itr.next ();
+ addCookie1 (hostName, c);
+ }
+
+ }
+
+ /** Retrieve all the cookies for a specific host */
+ /* public List getCookies (String hostName)
+ throws Exception
+ {
+ hostName = asHostName (hostName);
+ List m1 = (List) ckMap.get (hostName);
+ // TchUtils.log ("getCookies: " + hostName + ": " + m1);
+ return m1;
+ } */
+ public HashMap getCookies (String hostName)
+ throws Exception
+ {
+ hostName = asHostName (hostName);
+ HashMap m1 = (HashMap) ckMap2.get (hostName);
+ return m1;
+ }
+
+ /** Clear all the cookies for a specific host */
+ public void clearCookies (String hostName)
+ throws Exception
+ {
+ hostName = asHostName (hostName);
+ ckMap.remove (hostName);
+ ckMap2.remove (hostName);
+ }
+
+ private String asHostName (String hostName)
+ throws Exception
+ {
+ if (LOCALHOST_HOSTADDRESS != null && "localhost".equals (hostName) ) {
+ hostName = LOCALHOST_HOSTADDRESS;
+ }
+ else {
+ InetAddress ia = InetAddress.getByName (hostName);
+ hostName = ia.getHostAddress ();
+ }
+ return hostName;
+ }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EagleHttpClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EnvEntry.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EnvEntry.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EnvEntry.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EnvEntry.java Fri Aug 12 08:12:28 2005
@@ -1,33 +1,33 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class EnvEntry
-{
- private String name = null;
- private String value = "";
-
- public void setName(String in)
- {
- name = in;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setValue(String in)
- {
- value = in;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public String toString()
- {
- return name + "=" + value;
- }
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class EnvEntry
+{
+ private String name = null;
+ private String value = "";
+
+ public void setName(String in)
+ {
+ name = in;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setValue(String in)
+ {
+ value = in;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public String toString()
+ {
+ return name + "=" + value;
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/EnvEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedHeaderElement.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedHeaderElement.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedHeaderElement.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedHeaderElement.java Fri Aug 12 08:12:28 2005
@@ -1,44 +1,44 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class ExpectedHeaderElement
-{
- private String name = null;
- private String value = null;
- private boolean regexp = false;
-
- public void setName(String in)
- {
- name = in;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setValue(String in)
- {
- value = in;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setRegexp(boolean in)
- {
- regexp = in;
- }
-
- public boolean getRegexp()
- {
- return regexp;
- }
-
- public String toString()
- {
- return name + "=" + value + ", regexp: " + regexp;
- }
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class ExpectedHeaderElement
+{
+ private String name = null;
+ private String value = null;
+ private boolean regexp = false;
+
+ public void setName(String in)
+ {
+ name = in;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setValue(String in)
+ {
+ value = in;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setRegexp(boolean in)
+ {
+ regexp = in;
+ }
+
+ public boolean getRegexp()
+ {
+ return regexp;
+ }
+
+ public String toString()
+ {
+ return name + "=" + value + ", regexp: " + regexp;
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedHeaderElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedResponseCodeElement.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedResponseCodeElement.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedResponseCodeElement.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedResponseCodeElement.java Fri Aug 12 08:12:28 2005
@@ -1,23 +1,23 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class ExpectedResponseCodeElement
-{
-
- private String expectedResponseCode = null;
-
- public void addText(String in)
- {
- expectedResponseCode = in;
- }
-
- public String getExpectedResponseCode()
- {
- return expectedResponseCode;
- }
-
- public String toString()
- {
- return expectedResponseCode;
- }
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class ExpectedResponseCodeElement
+{
+
+ private String expectedResponseCode = null;
+
+ public void addText(String in)
+ {
+ expectedResponseCode = in;
+ }
+
+ public String getExpectedResponseCode()
+ {
+ return expectedResponseCode;
+ }
+
+ public String toString()
+ {
+ return expectedResponseCode;
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedResponseCodeElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedStringElement.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedStringElement.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedStringElement.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedStringElement.java Fri Aug 12 08:12:28 2005
@@ -1,40 +1,40 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-public class ExpectedStringElement
-{
- private String expectedString = null;
- private String regexp = "false";
-
- public void addText(String in)
- {
- expectedString = in;
- }
-
- public void setRegexp(String in)
- {
- regexp = in;
- }
-
- public String getRegexpString()
- {
- return regexp;
- }
-
- public boolean getRegexp()
- {
- return org.apache.beehive.test.tools.tch.util.GeneralUtil.parseBoolean(regexp);
- }
-
- public String getExpectedString()
- {
- return expectedString;
- }
-
- public String toString()
- {
- return expectedString + ", regexp: " + regexp;
- }
-
-
-}
-
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+public class ExpectedStringElement
+{
+ private String expectedString = null;
+ private String regexp = "false";
+
+ public void addText(String in)
+ {
+ expectedString = in;
+ }
+
+ public void setRegexp(String in)
+ {
+ regexp = in;
+ }
+
+ public String getRegexpString()
+ {
+ return regexp;
+ }
+
+ public boolean getRegexp()
+ {
+ return org.apache.beehive.test.tools.tch.util.GeneralUtil.parseBoolean(regexp);
+ }
+
+ public String getExpectedString()
+ {
+ return expectedString;
+ }
+
+ public String toString()
+ {
+ return expectedString + ", regexp: " + regexp;
+ }
+
+
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExpectedStringElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExtractedStackTraceException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExtractedStackTraceException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExtractedStackTraceException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExtractedStackTraceException.java Fri Aug 12 08:12:28 2005
@@ -1,62 +1,62 @@
-package org.apache.beehive.test.tools.tch.extension.exectask.common;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-import org.apache.beehive.test.tools.tch.util.StringUtils;
-
-/**
- * Simple Exception class which tries to extract
- * an exception from its stack trace.
- *
- * @version 1.0, Nov 3, 2001
- * ported to blackhawk by Vinod Kumar
- */
-public class ExtractedStackTraceException extends Exception
-{
- private String trace;
- private String className;
- private String message;
- private String firstLine;
-
- private ExtractedStackTraceException () { }
-
- /** Takes in a StackTrace and creates an Exception from it */
- public ExtractedStackTraceException (String trace1)
- {
- trace = trace1;
- if (trace == null)
- trace = "";
- firstLine = StringUtils.getFirstLine (trace);
- int indexOfColon = firstLine.indexOf (":");
- if (indexOfColon != -1) {
- className = firstLine.substring (0, indexOfColon).trim ();
- message = firstLine.substring (indexOfColon).trim ();
- }
- else {
- className = firstLine.trim ();
- }
- }
-
- public void printStackTrace(PrintStream ps) {
- synchronized (ps) {
- ps.println (trace);
- }
- }
-
- public void printStackTrace(PrintWriter ps) {
- synchronized (ps) {
- ps.println (trace);
- }
- }
-
- public String getMessage () {
- return message;
- }
-
- /** Return the first line of the Exception Stack Trace */
- public String toString () {
- return firstLine;
- }
-
-}
+package org.apache.beehive.test.tools.tch.extension.exectask.common;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+import org.apache.beehive.test.tools.tch.util.StringUtils;
+
+/**
+ * Simple Exception class which tries to extract
+ * an exception from its stack trace.
+ *
+ * @version 1.0, Nov 3, 2001
+ * ported to blackhawk by Vinod Kumar
+ */
+public class ExtractedStackTraceException extends Exception
+{
+ private String trace;
+ private String className;
+ private String message;
+ private String firstLine;
+
+ private ExtractedStackTraceException () { }
+
+ /** Takes in a StackTrace and creates an Exception from it */
+ public ExtractedStackTraceException (String trace1)
+ {
+ trace = trace1;
+ if (trace == null)
+ trace = "";
+ firstLine = StringUtils.getFirstLine (trace);
+ int indexOfColon = firstLine.indexOf (":");
+ if (indexOfColon != -1) {
+ className = firstLine.substring (0, indexOfColon).trim ();
+ message = firstLine.substring (indexOfColon).trim ();
+ }
+ else {
+ className = firstLine.trim ();
+ }
+ }
+
+ public void printStackTrace(PrintStream ps) {
+ synchronized (ps) {
+ ps.println (trace);
+ }
+ }
+
+ public void printStackTrace(PrintWriter ps) {
+ synchronized (ps) {
+ ps.println (trace);
+ }
+ }
+
+ public String getMessage () {
+ return message;
+ }
+
+ /** Return the first line of the Exception Stack Trace */
+ public String toString () {
+ return firstLine;
+ }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/extension/exectask/common/ExtractedStackTraceException.java
------------------------------------------------------------------------------
svn:eol-style = native