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 [49/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/AnythingTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AnythingTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AnythingTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AnythingTask.java Fri Aug 12 08:12:28 2005
@@ -1,351 +1,351 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.TaskContainer;
-import org.apache.tools.ant.UnknownElement;
-
-import org.apache.beehive.test.tools.tch.compose.Parameters;
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
-import org.apache.beehive.test.tools.tch.core.test.BasicInternalParameters;
-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.TchUtils;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-import org.apache.beehive.test.tools.tch.util.ant.AntExecBuildLogger;
-
-public class AnythingTask extends BaseTwoPassTask implements TaskContainer
-{
- private boolean requiredForTest = true;
- // this can be set to make the task run regardless of whether the test-suite is skipped
- private boolean alwaysRun = false;
- private String name = null;
- private String group = null;
-
- //These are all passed in from the parent task
- public AbstractTestNodeTask testNodeTask = null;
- private ParamContainer paramContainer = null;
- private ProcessEngineContainer processEngineContainer = null;
- private TestMultiLevelHelper.SharedStateRegistry sharedStateRegistry = null;
-
- private Collection foreignTasks = new ArrayList();
- // just used for supporting Ant 1.6. We need to keep track of all subtasks
- // so we can recurse over them later
- private Collection allTasks = new ArrayList();
-
- public Collection getAllTasks()
- {
- return allTasks;
- }
-
- public void setAlwaysRun(boolean in)
- {
- alwaysRun = in;
- }
-
- public void setName(String in)
- {
- name = in;
- }
-
- public void setGroup(String in)
- {
- group = in;
- }
-
- public void setRequiredForTest(boolean in)
- {
- requiredForTest = in;
- }
-
- // should this class just extend from BaseTaskContainer?
- public final void addTask(Task task)
- {
- boolean in_is_unknown = false;
- /*
- * Similar behavior to BaseTaskContainer's addTask. We need special handling
- * for Ant 1.6. Just keep call maybeConfigure() and store all subtasks. We end
- * up recursing through the tasks starting from the test-suite. The recursion
- * code is in BaseTaskContainer.
- */
- if (task instanceof UnknownElement)
- {
- in_is_unknown = true;
- ((UnknownElement)task).maybeConfigure();
- task = ((UnknownElement)task).getTask();
- allTasks.add(task);
- }
-
- if (!in_is_unknown)
- {
- handleTask(task);
- }
- }
-
- //should this class just extend from BaseTaskContainer?
- public Task handleTask(Task task)
- {
- if (task instanceof TestSuiteChild)
- {
- ((TestSuiteChild)task).setTestSuiteTask(getTestSuiteTask());
- }
- if (task instanceof AnythingTask)
- {
- AnythingTask anythingTask = (AnythingTask)task;
- anythingTask.setProcessEngineContainer(processEngineContainer);
- anythingTask.setSharedStateRegistry(sharedStateRegistry);
- anythingTask.setParamContainer(paramContainer);
- anythingTask.setTestNode(testNodeTask);
- }
- foreignTasks.add(task);
- return task;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getGroup()
- {
- return group;
- }
-
- public Collection getForeignTasks()
- {
- return foreignTasks;
- }
-
- /**
- * Sets the parameter container for the task. Basically this propogates in
- * access to a set of test parameters
- *
- * @param in object containing a set of test parameters
- */
- public final void setParamContainer(ParamContainer in)
- {
- paramContainer = in;
- }
-
- /**
- * Sets the AbstractTestNodeTask associated with the current task.
- * This will generally be the AbstractTestNodeTask the current task
- * is nested in.
- *
- * @param tnt
- */
- public final void setTestNode(AbstractTestNodeTask tnt)
- {
- testNodeTask = (AbstractTestNodeTask)tnt;
- }
-
- protected final AbstractTestNodeTask getTestNode()
- {
- return testNodeTask;
- }
-
- public final void setProcessEngineContainer(ProcessEngineContainer in)
- {
- processEngineContainer = in;
- }
-
- protected final ProcessEngine getProcessEngine()
- {
- if (processEngineContainer == null)
- return null;
- return processEngineContainer.getProcessEngine();
- }
-
- /**
- * Get all process names which are mapped for the current AnythingTask.
- * Should be overridden by subclasses which actually map any processes.
- * By default will return all processes mapped for the test-suite.
- * @return
- */
- public Collection getMappedProcessNames()
- {
- return testNodeTask.getAllProcessNames();
- }
-
- /**
- * This Map instance will be shared across all custom-tasks in the same scope
- * and with the same group attribute. In this way, tasks can vary their action/inaction
- * depending on some previous action/inaction.
- */
- protected final Map getSharedState()
- {
- if (sharedStateRegistry == null)
- return null;
- return sharedStateRegistry.getSharedState(getGroup());
- }
-
- public void setSharedStateRegistry(
- TestMultiLevelHelper.SharedStateRegistry in)
- {
- sharedStateRegistry = in;
- }
-
- protected final void inform(String message)
- {
- logInformResult(message, this);
- }
-
- protected final Parameters getParameters()
- {
- if (paramContainer == null)
- return new BasicInternalParameters();
- return paramContainer.getParameters();
- }
-
- public boolean initialize() throws BuildException
- {
- for (Iterator iter = foreignTasks.iterator(); iter.hasNext();)
- {
- Task task = (Task)iter.next();
- if (task instanceof TwoPassTask)
- {
- //setupTask(task, false);
- try
- {
- task.perform(); //This will call initialize() hooks
- }
- catch (Exception ex)
- {
- invalidate(
- new NonfatalValidationException(
- ex,
- ErrorMessageConstants.CUSTOM_TASK_WRAPPED_ERROR_CODE,
- ErrorMessageConstants.MESSAGE,
- ex.getMessage()));
- }
- }
- if (task instanceof BaseTask)
- addInvalidations(((BaseTask)task).getNonfatalValidationAggregate());
- }
- return true;
- }
-
- public boolean run() throws BuildException
- {
- AntExecBuildLogger antExecLogger = new AntExecBuildLogger();
- antExecLogger.setMessageOutputLevel(Project.MSG_DEBUG);
- boolean listenerAdded = false;
- if (alwaysRun == false
- && testNodeTask != null
- && (testNodeTask.isSkipped()
- || testNodeTask.isValidationSkipped()
- || testNodeTask.isShortCircuited()))
- {
- //Test skipped, no need to log anything extra.
- }
- else
- {
- logInformResult("Running " + getQuotedName() + " custom task(s).", this);
- for (Iterator iter = foreignTasks.iterator(); iter.hasNext();)
- {
- // log here
- Task task = (Task)iter.next();
- //setupTask(task, true);
- logInformResult(
- "In "
- + getQuotedName()
- + " custom task: Running \""
- + task.getTaskName()
- + "\" task.",
- task);
- try
- {
- if (!listenerAdded && AntUtils.buildListenerIsSupported())
- {
- task.getProject().addBuildListener(antExecLogger);
- listenerAdded = true;
- }
- task.perform();
- }
- catch (Exception ex)
- {
- logScratchResult(ex, task, new Throwable());
- //Always at least log the error
- if (requiredForTest)
- {
- //not running the rest of the tasks, and also try to skip the nesting test/test-suite
- if (testNodeTask != null)
- skipTestNode();
- break;
- }
- }
- finally
- {
- if (listenerAdded)
- {
- String output = antExecLogger.getCurrentOutput().trim();
- if (output.length() > 0)
- inform(output);
- antExecLogger.resetCurrentOutput();
- task.getProject().removeBuildListener(antExecLogger);
- listenerAdded = false;
- }
- }
- }
- }
- return true;
- }
-
- private void skipTestNode()
- {
- String message = "Problem in custom-task";
- if (getName() != null)
- message += " \"" + getName() + "\"";
- testNodeTask.skip(message);
- }
-
- private void logInformResult(String message, Task task)
- {
- if (testNodeTask != null)
- testNodeTask.logInform(message, task.getLocation());
- else
- log(task.getLocation() + ": " + message);
- }
-
- private String getQuotedName()
- {
- if (getName() != null)
- return "\"" + getName() + "\"";
- else
- return "unnamed";
- }
-
- private void logScratchResult(Exception ex, Task task, Throwable filter)
- {
- String message = "Exception occurred in custom-task ";
- if (getName() != null)
- message += "\"" + getName() + "\"";
- message += ". Nested task is "
- + task.getClass().getName()
- + ": "
- + ex.getMessage();
-
- if (testNodeTask != null)
- {
- TestResultAdapter res =
- new TestResultAdapter(TchConstants.SCRATCH_LEVEL_INT);
- res.setOutputMsg(message);
- res.setThrowableWithFilter(ex, filter);
- res.setSourcePath(AntUtils.getSourcePath(task.getLocation()));
- testNodeTask.initializeResult(res, testNodeTask.getName());
- testNodeTask.notifyOnResult(res);
- }
- else
- {
- log(message);
- log(TchUtils.filterStack(ex, filter));
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.UnknownElement;
+
+import org.apache.beehive.test.tools.tch.compose.Parameters;
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
+import org.apache.beehive.test.tools.tch.core.test.BasicInternalParameters;
+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.TchUtils;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+import org.apache.beehive.test.tools.tch.util.ant.AntExecBuildLogger;
+
+public class AnythingTask extends BaseTwoPassTask implements TaskContainer
+{
+ private boolean requiredForTest = true;
+ // this can be set to make the task run regardless of whether the test-suite is skipped
+ private boolean alwaysRun = false;
+ private String name = null;
+ private String group = null;
+
+ //These are all passed in from the parent task
+ public AbstractTestNodeTask testNodeTask = null;
+ private ParamContainer paramContainer = null;
+ private ProcessEngineContainer processEngineContainer = null;
+ private TestMultiLevelHelper.SharedStateRegistry sharedStateRegistry = null;
+
+ private Collection foreignTasks = new ArrayList();
+ // just used for supporting Ant 1.6. We need to keep track of all subtasks
+ // so we can recurse over them later
+ private Collection allTasks = new ArrayList();
+
+ public Collection getAllTasks()
+ {
+ return allTasks;
+ }
+
+ public void setAlwaysRun(boolean in)
+ {
+ alwaysRun = in;
+ }
+
+ public void setName(String in)
+ {
+ name = in;
+ }
+
+ public void setGroup(String in)
+ {
+ group = in;
+ }
+
+ public void setRequiredForTest(boolean in)
+ {
+ requiredForTest = in;
+ }
+
+ // should this class just extend from BaseTaskContainer?
+ public final void addTask(Task task)
+ {
+ boolean in_is_unknown = false;
+ /*
+ * Similar behavior to BaseTaskContainer's addTask. We need special handling
+ * for Ant 1.6. Just keep call maybeConfigure() and store all subtasks. We end
+ * up recursing through the tasks starting from the test-suite. The recursion
+ * code is in BaseTaskContainer.
+ */
+ if (task instanceof UnknownElement)
+ {
+ in_is_unknown = true;
+ ((UnknownElement)task).maybeConfigure();
+ task = ((UnknownElement)task).getTask();
+ allTasks.add(task);
+ }
+
+ if (!in_is_unknown)
+ {
+ handleTask(task);
+ }
+ }
+
+ //should this class just extend from BaseTaskContainer?
+ public Task handleTask(Task task)
+ {
+ if (task instanceof TestSuiteChild)
+ {
+ ((TestSuiteChild)task).setTestSuiteTask(getTestSuiteTask());
+ }
+ if (task instanceof AnythingTask)
+ {
+ AnythingTask anythingTask = (AnythingTask)task;
+ anythingTask.setProcessEngineContainer(processEngineContainer);
+ anythingTask.setSharedStateRegistry(sharedStateRegistry);
+ anythingTask.setParamContainer(paramContainer);
+ anythingTask.setTestNode(testNodeTask);
+ }
+ foreignTasks.add(task);
+ return task;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getGroup()
+ {
+ return group;
+ }
+
+ public Collection getForeignTasks()
+ {
+ return foreignTasks;
+ }
+
+ /**
+ * Sets the parameter container for the task. Basically this propogates in
+ * access to a set of test parameters
+ *
+ * @param in object containing a set of test parameters
+ */
+ public final void setParamContainer(ParamContainer in)
+ {
+ paramContainer = in;
+ }
+
+ /**
+ * Sets the AbstractTestNodeTask associated with the current task.
+ * This will generally be the AbstractTestNodeTask the current task
+ * is nested in.
+ *
+ * @param tnt
+ */
+ public final void setTestNode(AbstractTestNodeTask tnt)
+ {
+ testNodeTask = (AbstractTestNodeTask)tnt;
+ }
+
+ protected final AbstractTestNodeTask getTestNode()
+ {
+ return testNodeTask;
+ }
+
+ public final void setProcessEngineContainer(ProcessEngineContainer in)
+ {
+ processEngineContainer = in;
+ }
+
+ protected final ProcessEngine getProcessEngine()
+ {
+ if (processEngineContainer == null)
+ return null;
+ return processEngineContainer.getProcessEngine();
+ }
+
+ /**
+ * Get all process names which are mapped for the current AnythingTask.
+ * Should be overridden by subclasses which actually map any processes.
+ * By default will return all processes mapped for the test-suite.
+ * @return
+ */
+ public Collection getMappedProcessNames()
+ {
+ return testNodeTask.getAllProcessNames();
+ }
+
+ /**
+ * This Map instance will be shared across all custom-tasks in the same scope
+ * and with the same group attribute. In this way, tasks can vary their action/inaction
+ * depending on some previous action/inaction.
+ */
+ protected final Map getSharedState()
+ {
+ if (sharedStateRegistry == null)
+ return null;
+ return sharedStateRegistry.getSharedState(getGroup());
+ }
+
+ public void setSharedStateRegistry(
+ TestMultiLevelHelper.SharedStateRegistry in)
+ {
+ sharedStateRegistry = in;
+ }
+
+ protected final void inform(String message)
+ {
+ logInformResult(message, this);
+ }
+
+ protected final Parameters getParameters()
+ {
+ if (paramContainer == null)
+ return new BasicInternalParameters();
+ return paramContainer.getParameters();
+ }
+
+ public boolean initialize() throws BuildException
+ {
+ for (Iterator iter = foreignTasks.iterator(); iter.hasNext();)
+ {
+ Task task = (Task)iter.next();
+ if (task instanceof TwoPassTask)
+ {
+ //setupTask(task, false);
+ try
+ {
+ task.perform(); //This will call initialize() hooks
+ }
+ catch (Exception ex)
+ {
+ invalidate(
+ new NonfatalValidationException(
+ ex,
+ ErrorMessageConstants.CUSTOM_TASK_WRAPPED_ERROR_CODE,
+ ErrorMessageConstants.MESSAGE,
+ ex.getMessage()));
+ }
+ }
+ if (task instanceof BaseTask)
+ addInvalidations(((BaseTask)task).getNonfatalValidationAggregate());
+ }
+ return true;
+ }
+
+ public boolean run() throws BuildException
+ {
+ AntExecBuildLogger antExecLogger = new AntExecBuildLogger();
+ antExecLogger.setMessageOutputLevel(Project.MSG_DEBUG);
+ boolean listenerAdded = false;
+ if (alwaysRun == false
+ && testNodeTask != null
+ && (testNodeTask.isSkipped()
+ || testNodeTask.isValidationSkipped()
+ || testNodeTask.isShortCircuited()))
+ {
+ //Test skipped, no need to log anything extra.
+ }
+ else
+ {
+ logInformResult("Running " + getQuotedName() + " custom task(s).", this);
+ for (Iterator iter = foreignTasks.iterator(); iter.hasNext();)
+ {
+ // log here
+ Task task = (Task)iter.next();
+ //setupTask(task, true);
+ logInformResult(
+ "In "
+ + getQuotedName()
+ + " custom task: Running \""
+ + task.getTaskName()
+ + "\" task.",
+ task);
+ try
+ {
+ if (!listenerAdded && AntUtils.buildListenerIsSupported())
+ {
+ task.getProject().addBuildListener(antExecLogger);
+ listenerAdded = true;
+ }
+ task.perform();
+ }
+ catch (Exception ex)
+ {
+ logScratchResult(ex, task, new Throwable());
+ //Always at least log the error
+ if (requiredForTest)
+ {
+ //not running the rest of the tasks, and also try to skip the nesting test/test-suite
+ if (testNodeTask != null)
+ skipTestNode();
+ break;
+ }
+ }
+ finally
+ {
+ if (listenerAdded)
+ {
+ String output = antExecLogger.getCurrentOutput().trim();
+ if (output.length() > 0)
+ inform(output);
+ antExecLogger.resetCurrentOutput();
+ task.getProject().removeBuildListener(antExecLogger);
+ listenerAdded = false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ private void skipTestNode()
+ {
+ String message = "Problem in custom-task";
+ if (getName() != null)
+ message += " \"" + getName() + "\"";
+ testNodeTask.skip(message);
+ }
+
+ private void logInformResult(String message, Task task)
+ {
+ if (testNodeTask != null)
+ testNodeTask.logInform(message, task.getLocation());
+ else
+ log(task.getLocation() + ": " + message);
+ }
+
+ private String getQuotedName()
+ {
+ if (getName() != null)
+ return "\"" + getName() + "\"";
+ else
+ return "unnamed";
+ }
+
+ private void logScratchResult(Exception ex, Task task, Throwable filter)
+ {
+ String message = "Exception occurred in custom-task ";
+ if (getName() != null)
+ message += "\"" + getName() + "\"";
+ message += ". Nested task is "
+ + task.getClass().getName()
+ + ": "
+ + ex.getMessage();
+
+ if (testNodeTask != null)
+ {
+ TestResultAdapter res =
+ new TestResultAdapter(TchConstants.SCRATCH_LEVEL_INT);
+ res.setOutputMsg(message);
+ res.setThrowableWithFilter(ex, filter);
+ res.setSourcePath(AntUtils.getSourcePath(task.getLocation()));
+ testNodeTask.initializeResult(res, testNodeTask.getName());
+ testNodeTask.notifyOnResult(res);
+ }
+ else
+ {
+ log(message);
+ log(TchUtils.filterStack(ex, filter));
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AnythingTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestNameTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestNameTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestNameTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestNameTask.java Fri Aug 12 08:12:28 2005
@@ -1,5 +1,5 @@
-package org.apache.beehive.test.tools.tch.core;
-
-public class AppendModifierToTestNameTask extends AbstractTestEntityModifierTask
-{
-}
+package org.apache.beehive.test.tools.tch.core;
+
+public class AppendModifierToTestNameTask extends AbstractTestEntityModifierTask
+{
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestNameTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestUnitTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestUnitTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestUnitTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestUnitTask.java Fri Aug 12 08:12:28 2005
@@ -1,6 +1,6 @@
-package org.apache.beehive.test.tools.tch.core;
-
-public class AppendModifierToTestUnitTask
- extends AbstractTestEntityModifierTask
-{
-}
+package org.apache.beehive.test.tools.tch.core;
+
+public class AppendModifierToTestUnitTask
+ extends AbstractTestEntityModifierTask
+{
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AppendModifierToTestUnitTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AutoStartProcessesTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AutoStartProcessesTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AutoStartProcessesTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AutoStartProcessesTask.java Fri Aug 12 08:12:28 2005
@@ -1,159 +1,159 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.apache.beehive.test.tools.tch.core.process.ProcessHandler;
-import org.apache.beehive.test.tools.tch.core.process.ProcessManager;
-import org.apache.beehive.test.tools.tch.core.process.ProcessRegistry;
-import org.apache.beehive.test.tools.tch.core.process.ProcessSummaryProvider;
-import org.apache.beehive.test.tools.tch.core.remote.ProcessSummary;
-import org.apache.beehive.test.tools.tch.core.test.TestRegistry;
-import org.apache.beehive.test.tools.tch.logger.LoggerSingleton;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-
-public class AutoStartProcessesTask extends BaseTask
-{
- private ProcessRegistry processRegistry = ProcessRegistry.getRegistry();
-
- // Get the test registry. If autostart fails, need to submit skip results
- // for all tests
- private TestRegistry testRegistry = TestRegistry.getRegistry();
-
- // ProcessHandler Objects
- private Collection startedProcesses = new HashSet();
-
- public void execute()
- {
- autoStartProcesses();
- }
-
- private void autoStartProcesses()
- {
- Collection startedProcesses = new HashSet();
-
- boolean skipTests = false;
- ProcessRegistry.Entry currentEntry = null;
-
- for (Iterator iter = processRegistry.getEntryIterator(); iter.hasNext();)
- {
- ProcessRegistry.Entry entry = (ProcessRegistry.Entry)iter.next();
-
- if (entry.getProcess().isActive()
- && entry.getProcess().isAutoStartEnabled())
- try
- {
- if (startedProcesses.isEmpty())
- {
- // first process that has auto-start enabled
- log("Will start processes that have auto-start enabled...");
- }
- log(" checking dependencies for " + entry.getProcess().getName());
- // FIXME - this does not seem to handle more than one level of requires-started
- // correctly
- // p1 requires p2 requires p3 would not start p3 (?)
-
- Collection requiresStarted =
- entry.getProcess().getProcessesRequiredToStartBefore();
- if (!requiresStarted.isEmpty())
- {
- log(" requires started " + requiresStarted);
- for (Iterator iter2 = requiresStarted.iterator(); iter2.hasNext();)
- {
- String processName = (String)iter2.next();
- ProcessRegistry.Entry entry2 =
- processRegistry.getProcessEntry(processName);
- currentEntry = entry2;
- // might already be active, ok to activate again
- entry2.getProcess().activate();
- startProcess(
- entry2.getProcessHandler(),
- entry2.getProcess().getWaitSecondsAfterStarted());
- }
- }
- currentEntry = entry;
- startProcess(
- entry.getProcessHandler(),
- entry.getProcess().getWaitSecondsAfterStarted());
- }
- catch (Exception ex)
- {
- skipTests = true;
- log("Failed to start process " + entry.getProcess().getName());
- log("Shutting down Process Managers");
- try
- {
- processRegistry.cleanUpProcessManagers();
- }
- catch (Throwable th)
- {
- }
-
- // Create a SCRATCH result to log. We also want to put the process output
- // in the scratch result.
- TestResultAdapter res =
- new TestResultAdapter(
- TchConstants.SCRATCH_LEVEL_INT,
- "",
- "Process "
- + entry.getProcess().getName()
- + " failed to auto-start.",
- ex);
- ProcessManager processManager = currentEntry.getProcessManager();
- if (processManager instanceof ProcessSummaryProvider)
- {
- // set the ProcessSummary in the result so that the process output
- // will be logged to the tch.debug-all log
- ProcessSummary processSummary =
- (
- (
- ProcessSummaryProvider)processManager)
- .getProcessSummaryNoThrow(
- currentEntry.getProcess());
- res.setProcessSummary(entry.getProcess().getName(), processSummary);
- }
-
- // log the scratch, and then skip all tests we were about to run
- LoggerSingleton.getLogger().log(res);
- testRegistry.skipAllTests("Process auto-start failure.");
- break;
- }
- }
- log("");
- }
-
- private void startProcess(
- ProcessHandler ph,
- Integer sleepSecondsAfterStarted)
- {
- if (startedProcesses.contains(ph))
- {
- log(" already started process " + ph.getName() + " skipping it");
- }
- else
- {
- log(" will start: " + ph.getName());
- startedProcesses.add(ph);
- ph.startup();
- if (sleepSecondsAfterStarted != null)
- {
- try
- {
- log(
- "Started "
- + ph.getName()
- + ", sleeping for "
- + sleepSecondsAfterStarted
- + " seconds");
- Thread.sleep(sleepSecondsAfterStarted.intValue() * 1000);
- }
- catch (InterruptedException ex)
- {
- }
- }
- }
- log("");
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.apache.beehive.test.tools.tch.core.process.ProcessHandler;
+import org.apache.beehive.test.tools.tch.core.process.ProcessManager;
+import org.apache.beehive.test.tools.tch.core.process.ProcessRegistry;
+import org.apache.beehive.test.tools.tch.core.process.ProcessSummaryProvider;
+import org.apache.beehive.test.tools.tch.core.remote.ProcessSummary;
+import org.apache.beehive.test.tools.tch.core.test.TestRegistry;
+import org.apache.beehive.test.tools.tch.logger.LoggerSingleton;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+
+public class AutoStartProcessesTask extends BaseTask
+{
+ private ProcessRegistry processRegistry = ProcessRegistry.getRegistry();
+
+ // Get the test registry. If autostart fails, need to submit skip results
+ // for all tests
+ private TestRegistry testRegistry = TestRegistry.getRegistry();
+
+ // ProcessHandler Objects
+ private Collection startedProcesses = new HashSet();
+
+ public void execute()
+ {
+ autoStartProcesses();
+ }
+
+ private void autoStartProcesses()
+ {
+ Collection startedProcesses = new HashSet();
+
+ boolean skipTests = false;
+ ProcessRegistry.Entry currentEntry = null;
+
+ for (Iterator iter = processRegistry.getEntryIterator(); iter.hasNext();)
+ {
+ ProcessRegistry.Entry entry = (ProcessRegistry.Entry)iter.next();
+
+ if (entry.getProcess().isActive()
+ && entry.getProcess().isAutoStartEnabled())
+ try
+ {
+ if (startedProcesses.isEmpty())
+ {
+ // first process that has auto-start enabled
+ log("Will start processes that have auto-start enabled...");
+ }
+ log(" checking dependencies for " + entry.getProcess().getName());
+ // FIXME - this does not seem to handle more than one level of requires-started
+ // correctly
+ // p1 requires p2 requires p3 would not start p3 (?)
+
+ Collection requiresStarted =
+ entry.getProcess().getProcessesRequiredToStartBefore();
+ if (!requiresStarted.isEmpty())
+ {
+ log(" requires started " + requiresStarted);
+ for (Iterator iter2 = requiresStarted.iterator(); iter2.hasNext();)
+ {
+ String processName = (String)iter2.next();
+ ProcessRegistry.Entry entry2 =
+ processRegistry.getProcessEntry(processName);
+ currentEntry = entry2;
+ // might already be active, ok to activate again
+ entry2.getProcess().activate();
+ startProcess(
+ entry2.getProcessHandler(),
+ entry2.getProcess().getWaitSecondsAfterStarted());
+ }
+ }
+ currentEntry = entry;
+ startProcess(
+ entry.getProcessHandler(),
+ entry.getProcess().getWaitSecondsAfterStarted());
+ }
+ catch (Exception ex)
+ {
+ skipTests = true;
+ log("Failed to start process " + entry.getProcess().getName());
+ log("Shutting down Process Managers");
+ try
+ {
+ processRegistry.cleanUpProcessManagers();
+ }
+ catch (Throwable th)
+ {
+ }
+
+ // Create a SCRATCH result to log. We also want to put the process output
+ // in the scratch result.
+ TestResultAdapter res =
+ new TestResultAdapter(
+ TchConstants.SCRATCH_LEVEL_INT,
+ "",
+ "Process "
+ + entry.getProcess().getName()
+ + " failed to auto-start.",
+ ex);
+ ProcessManager processManager = currentEntry.getProcessManager();
+ if (processManager instanceof ProcessSummaryProvider)
+ {
+ // set the ProcessSummary in the result so that the process output
+ // will be logged to the tch.debug-all log
+ ProcessSummary processSummary =
+ (
+ (
+ ProcessSummaryProvider)processManager)
+ .getProcessSummaryNoThrow(
+ currentEntry.getProcess());
+ res.setProcessSummary(entry.getProcess().getName(), processSummary);
+ }
+
+ // log the scratch, and then skip all tests we were about to run
+ LoggerSingleton.getLogger().log(res);
+ testRegistry.skipAllTests("Process auto-start failure.");
+ break;
+ }
+ }
+ log("");
+ }
+
+ private void startProcess(
+ ProcessHandler ph,
+ Integer sleepSecondsAfterStarted)
+ {
+ if (startedProcesses.contains(ph))
+ {
+ log(" already started process " + ph.getName() + " skipping it");
+ }
+ else
+ {
+ log(" will start: " + ph.getName());
+ startedProcesses.add(ph);
+ ph.startup();
+ if (sleepSecondsAfterStarted != null)
+ {
+ try
+ {
+ log(
+ "Started "
+ + ph.getName()
+ + ", sleeping for "
+ + sleepSecondsAfterStarted
+ + " seconds");
+ Thread.sleep(sleepSecondsAfterStarted.intValue() * 1000);
+ }
+ catch (InterruptedException ex)
+ {
+ }
+ }
+ }
+ log("");
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/AutoStartProcessesTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTask.java Fri Aug 12 08:12:28 2005
@@ -1,188 +1,188 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.tools.ant.Task;
-
-import org.apache.beehive.test.tools.tch.core.configuration.InvalidationManager;
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationAggregate;
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.util.PropertyResolver;
-import org.apache.beehive.test.tools.tch.util.ValueHandler;
-
-/**
- * This is a base task for all framework and user-extension tasks
- * It contains logic for invalidation, and interaction with Ant properties
- *
- */
-public abstract class BaseTask
- extends Task
- implements KnownTask, TestSuiteChild, ExtendedAntTask, PropertyResolver
-{
- // the test suite this task is nested in
- private TestSuiteTask testSuiteTask = null;
-
- private ValueHandler valueHandler = null;
-
- private InvalidationManager invalidationManager = new InvalidationManager();
-
- public boolean isValid()
- {
- return invalidationManager.isValid();
- }
-
- public NonfatalValidationAggregate getNonfatalValidationAggregate()
- {
- return invalidationManager.getNonfatalValidationAggregate();
- }
-
- /**
- * Called to indicate that a validation failure has occured
- *
- * @param ex the specific validation failure
- */
- public final void invalidate(NonfatalValidationException ex)
- {
- invalidationManager.addInvalidation(ex, this);
- }
-
- /**
- * Called to indicate that a validation failure has occurred
- *
- * @param inNVA contains one or more validation failures
- */
- protected final void addInvalidations(NonfatalValidationAggregate inNVA)
- {
- invalidationManager.addInvalidation(inNVA);
- }
-
- /**
- * Get a printable, text formatted version of the validation failures
- * associated with the current task
- *
- * @return
- */
- protected final String getInvalidationMessage()
- {
- return invalidationManager.getMessage();
- }
-
- /**
- * Get the CallingChain used to reach the current task
- *
- * @return current CallingChain
- */
- public CallingChain getCallingChain()
- {
- if (getTestSuiteTask() == null)
- {
- // if this task does not have a ref to its test-suite
- // make a bogus, empty calling chain
- return new CallingChain(new ArrayList());
- }
- else
- {
- return getTestSuiteTask().getCallingChain();
- }
- }
-
- /**
- * Get all properties which have been accessed by any tests
- *
- * @return Collection of String test property names
- */
- public Collection getUsedProps()
- {
- return getValueHandler().getUsedProps();
- }
-
- /**
- * Gets the TestSuiteTask which the current task is nested in. Tasks which
- *
- * @see org.apache.beehive.test.tools.tch.core.TestSuiteChild#getTestSuiteTask()
- */
- public TestSuiteTask getTestSuiteTask()
- {
- return testSuiteTask;
- }
-
- /**
- * Sets the TestSuiteTask which the current task is nested in.
- *
- * @see org.apache.beehive.test.tools.tch.core.TestSuiteChild#setTestSuiteTask(org.apache.beehive.test.tools.tch.core.TestSuiteTask)
- */
- public void setTestSuiteTask(TestSuiteTask in)
- {
- testSuiteTask = in;
- }
-
- /**
- * Get the TestSuiteCallTask which was used to reach the TestSuiteTask
- * that the current task is nested in
- *
- * @return TestSuiteCallTask used to reach the current task
- */
- public TestSuiteCallTask getTestSuiteCall()
- {
- return (TestSuiteCallTask)getTestSuiteTask().getTestParent();
- }
-
- protected final void setNestedPropertyReferencer(PropertyReferencer propRef)
- {
- getValueHandler().addNestedPropertyReferencer(propRef);
- }
-
- /**
- * This method should be called for any string value that supports the syntax for
- * referencing an Ant property (%{propname}). The ${propname} syntax cannot be used
- * since Ant will automatically expand that before our code can handle it, and we
- * need to know what property it came from to handle the command line properly.
- *
- * If the argument is of form "%{propname}", the corresponding property value for the
- * property named "propname" will be returned. A nonexistent property will be handled
- * in the usual manner.
- *
- * If the argument is not of that form, it will simply be returned.
- */
- protected final String handleValue(String value)
- {
- String val = getValueHandler().handleValue(value);
- if (getValueHandler().hasUnresolvedProps())
- {
- for (Iterator iter =
- getValueHandler().getUnresolvedPropsAndClear().iterator();
- iter.hasNext();
- )
- {
- invalidate(
- new NonfatalValidationException(
- ErrorMessageConstants.ANT_PROPERTY_NOT_FOUND_ERROR_CODE,
- ErrorMessageConstants.PROPNAME,
- (String)iter.next()));
- }
- return "null";
- }
- else
- return val;
- }
-
- // PropertyResolver
- /**
- * Returns the value of the specified property
- *
- * @return String containing the property value
- */
- public String getValue(String propertyName)
- {
- return getProject().getProperty(propertyName);
- }
-
- private ValueHandler getValueHandler()
- {
- if (valueHandler == null)
- valueHandler = new ValueHandler(this);
- return valueHandler;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tools.ant.Task;
+
+import org.apache.beehive.test.tools.tch.core.configuration.InvalidationManager;
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationAggregate;
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.util.PropertyResolver;
+import org.apache.beehive.test.tools.tch.util.ValueHandler;
+
+/**
+ * This is a base task for all framework and user-extension tasks
+ * It contains logic for invalidation, and interaction with Ant properties
+ *
+ */
+public abstract class BaseTask
+ extends Task
+ implements KnownTask, TestSuiteChild, ExtendedAntTask, PropertyResolver
+{
+ // the test suite this task is nested in
+ private TestSuiteTask testSuiteTask = null;
+
+ private ValueHandler valueHandler = null;
+
+ private InvalidationManager invalidationManager = new InvalidationManager();
+
+ public boolean isValid()
+ {
+ return invalidationManager.isValid();
+ }
+
+ public NonfatalValidationAggregate getNonfatalValidationAggregate()
+ {
+ return invalidationManager.getNonfatalValidationAggregate();
+ }
+
+ /**
+ * Called to indicate that a validation failure has occured
+ *
+ * @param ex the specific validation failure
+ */
+ public final void invalidate(NonfatalValidationException ex)
+ {
+ invalidationManager.addInvalidation(ex, this);
+ }
+
+ /**
+ * Called to indicate that a validation failure has occurred
+ *
+ * @param inNVA contains one or more validation failures
+ */
+ protected final void addInvalidations(NonfatalValidationAggregate inNVA)
+ {
+ invalidationManager.addInvalidation(inNVA);
+ }
+
+ /**
+ * Get a printable, text formatted version of the validation failures
+ * associated with the current task
+ *
+ * @return
+ */
+ protected final String getInvalidationMessage()
+ {
+ return invalidationManager.getMessage();
+ }
+
+ /**
+ * Get the CallingChain used to reach the current task
+ *
+ * @return current CallingChain
+ */
+ public CallingChain getCallingChain()
+ {
+ if (getTestSuiteTask() == null)
+ {
+ // if this task does not have a ref to its test-suite
+ // make a bogus, empty calling chain
+ return new CallingChain(new ArrayList());
+ }
+ else
+ {
+ return getTestSuiteTask().getCallingChain();
+ }
+ }
+
+ /**
+ * Get all properties which have been accessed by any tests
+ *
+ * @return Collection of String test property names
+ */
+ public Collection getUsedProps()
+ {
+ return getValueHandler().getUsedProps();
+ }
+
+ /**
+ * Gets the TestSuiteTask which the current task is nested in. Tasks which
+ *
+ * @see org.apache.beehive.test.tools.tch.core.TestSuiteChild#getTestSuiteTask()
+ */
+ public TestSuiteTask getTestSuiteTask()
+ {
+ return testSuiteTask;
+ }
+
+ /**
+ * Sets the TestSuiteTask which the current task is nested in.
+ *
+ * @see org.apache.beehive.test.tools.tch.core.TestSuiteChild#setTestSuiteTask(org.apache.beehive.test.tools.tch.core.TestSuiteTask)
+ */
+ public void setTestSuiteTask(TestSuiteTask in)
+ {
+ testSuiteTask = in;
+ }
+
+ /**
+ * Get the TestSuiteCallTask which was used to reach the TestSuiteTask
+ * that the current task is nested in
+ *
+ * @return TestSuiteCallTask used to reach the current task
+ */
+ public TestSuiteCallTask getTestSuiteCall()
+ {
+ return (TestSuiteCallTask)getTestSuiteTask().getTestParent();
+ }
+
+ protected final void setNestedPropertyReferencer(PropertyReferencer propRef)
+ {
+ getValueHandler().addNestedPropertyReferencer(propRef);
+ }
+
+ /**
+ * This method should be called for any string value that supports the syntax for
+ * referencing an Ant property (%{propname}). The ${propname} syntax cannot be used
+ * since Ant will automatically expand that before our code can handle it, and we
+ * need to know what property it came from to handle the command line properly.
+ *
+ * If the argument is of form "%{propname}", the corresponding property value for the
+ * property named "propname" will be returned. A nonexistent property will be handled
+ * in the usual manner.
+ *
+ * If the argument is not of that form, it will simply be returned.
+ */
+ protected final String handleValue(String value)
+ {
+ String val = getValueHandler().handleValue(value);
+ if (getValueHandler().hasUnresolvedProps())
+ {
+ for (Iterator iter =
+ getValueHandler().getUnresolvedPropsAndClear().iterator();
+ iter.hasNext();
+ )
+ {
+ invalidate(
+ new NonfatalValidationException(
+ ErrorMessageConstants.ANT_PROPERTY_NOT_FOUND_ERROR_CODE,
+ ErrorMessageConstants.PROPNAME,
+ (String)iter.next()));
+ }
+ return "null";
+ }
+ else
+ return val;
+ }
+
+ // PropertyResolver
+ /**
+ * Returns the value of the specified property
+ *
+ * @return String containing the property value
+ */
+ public String getValue(String propertyName)
+ {
+ return getProject().getProperty(propertyName);
+ }
+
+ private ValueHandler getValueHandler()
+ {
+ if (valueHandler == null)
+ valueHandler = new ValueHandler(this);
+ return valueHandler;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTaskContainer.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTaskContainer.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTaskContainer.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTaskContainer.java Fri Aug 12 08:12:28 2005
@@ -1,239 +1,239 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.TaskContainer;
-import org.apache.tools.ant.UnknownElement;
-import org.apache.tools.ant.taskdefs.Property;
-import org.apache.beehive.test.tools.tch.util.AntUtils;
-
-/**
- * This is a base task for all framework Ant tasks
- * that contain other sub-tasks.
- *
- * As an extension of BaseTwoPassTask, these tasks implement
- * TwoPassTask, and will be executed twice by Ant.
- * In addition, other tasks
- * that need to be called twice but do not fit in
- * this hierarchy may implement TwoPassTask, and they
- * will be run twice as well.
- *
- * Tasks run only once will be run during the second
- * pass, or "Execution Mode".
- *
- * The operation of this class is that execute() is called
- * on sub-tasks before it is called on itself
- *
- * @see TwoPassTask
- */
-
-public abstract class BaseTaskContainer
- extends BaseTwoPassTask
- implements TaskContainer
-{
- private Collection twoPassTasks = new ArrayList();
- private Collection allTasks = new ArrayList();
-
- /*
- * Called for each child task.
- * @see org.apache.tools.ant.TaskContainer#addTask(org.apache.tools.ant.Task)
- */
- public final void addTask(Task in)
- {
- boolean in_is_unknown = false;
- /*
- * Ant 1.6 seems to return UnknownElement instead of the actual
- * task. When this is the case, initialize the task element and get
- * the Task object to make this more consistent with pre-1.6 behavior
- */
- if (in instanceof UnknownElement)
- {
- in_is_unknown = true;
- // 1.6 will also cause a difference here since we need to call maybeConfigure() here
- // explicitly to get the task type This will end up calling the addTask/handleTask
- // for child elements recursively. Thus addTask is called from
- // bottom to top instead of top to bottom.
- ((UnknownElement)in).maybeConfigure();
- in = ((UnknownElement)in).getTask();
- if (in instanceof TwoPassTask)
- {
- twoPassTasks.add(in);
- }
- allTasks.add(in);
- if (this instanceof TestSuiteTask)
- {
- // recursiveHandleTask only really needs to be called once from the top level
- // BaseTaskContainer which should be TestSuiteTask
- recursiveHandleTask(this, in);
- }
- }
-
- if (shouldRecurse(in))
- {
- // in effect this filters out Ant 1.6 since it always passes in
- // an UnknownElement
- if (!in_is_unknown)
- {
- if (in instanceof TwoPassTask)
- {
- twoPassTasks.add(in);
- }
- allTasks.add(in);
- // this should not be called for Ant 1.6 since UnknownElement is always passed in
- handleTask(in); //hook
- }
- }
-
- }
-
- /*
- * This is added to support Ant 1.6 . Since addTask() is no longer called from top
- * to bottom for each task, we need a recursive method to call each subtask's
- * handleTask() method from top to bottom. This will in-effect simulate the
- * behavior from Ant 1.5
- *
- * This might be a hack, but couldn't think of a better way to do this without
- * changing lots of code in the tasks
- */
- public final void recursiveHandleTask(Task parenttask, Task childtask)
- {
- if (parenttask instanceof BaseTaskContainer)
- {
- ((BaseTaskContainer)parenttask).handleTask(childtask);
- }
- else if (parenttask instanceof AnythingTask)
- {
- ((AnythingTask)parenttask).handleTask(childtask);
- }
- else if (parenttask instanceof TestParallelTask)
- {
- // this logic comes from TestParallelTask
- if (((TestParallelTask)parenttask).getParentTask()
- instanceof BaseTaskContainer)
- (
- (BaseTaskContainer) ((TestParallelTask)parenttask)
- .getParentTask())
- .handleTask(
- childtask);
- }
- else if (parenttask instanceof TestSequentialTask)
- {
- // this logic comes from TestSequentialTask
- if (((TestSequentialTask)parenttask).getParentTask()
- instanceof BaseTaskContainer)
- (
- (BaseTaskContainer) ((TestSequentialTask)parenttask)
- .getParentTask())
- .handleTask(
- childtask);
- }
-
- Iterator iter = null;
- if (childtask instanceof BaseTaskContainer)
- iter = ((BaseTaskContainer)childtask).getAllTasks().iterator();
- else if (childtask instanceof AnythingTask)
- iter = ((AnythingTask)childtask).getAllTasks().iterator();
- else if (childtask instanceof TestParallelTask)
- iter = ((TestParallelTask)childtask).getAllTasks().iterator();
- else if (childtask instanceof TestSequentialTask)
- iter = ((TestSequentialTask)childtask).getAllTasks().iterator();
-
- if (iter != null)
- {
- while (iter.hasNext())
- {
- Task task = (Task)iter.next();
- recursiveHandleTask(childtask, task);
- }
- }
- }
-
- public Collection getAllTasks()
- {
- return allTasks;
- }
-
- /**
- * The hook for handling tasks, since addTask is final (above).
- * This method returns the Task, so that subclasses can either get the
- * task if it needs to be further handled, or get a null if it is
- * to no longer be handled, as deemed by the superclass
- */
- public Task handleTask(Task in)
- {
- if (in instanceof TestSuiteChild)
- {
- //log("BaseTaskContainer.handleTask for " + in.getClass().getName() + " setting to null? " + (getTestSuiteTask()==null));
- ((TestSuiteChild)in).setTestSuiteTask(getTestSuiteTask());
- }
- //Set parent if child is a ChildTask
- if (in instanceof ChildTask)
- {
- ((ChildTask)in).setParentTask(this);
- }
- return in;
- }
-
- public final boolean preAlwaysDo() throws BuildException
- {
- boolean rtn = super.preAlwaysDo();
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preAlwaysDo on task: "+getClass().getName(), getLocation());
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Two-pass tasks: "+twoPassTasks, getLocation());
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("All tasks: "+allTasks, getLocation());
- if (!beforeAlwaysDo())
- return false; //short circuit option for hook
- if (DirtyClass.isFirstPass())
- {
- AntUtils.perform(filterTasks(twoPassTasks));
- //only do the two pass for two-pass tasks
- }
- else
- {
- AntUtils.perform(filterTasks(allTasks));
- }
- return rtn;
- }
-
- private Collection filterTasks(Collection tasks)
- {
- Collection newTasks = new ArrayList();
- for (Iterator iter = tasks.iterator(); iter.hasNext();)
- {
- Task task = (Task)iter.next();
- if (task instanceof RunOnceTask && !((RunOnceTask)task).isFirstCall())
- {
- //Don't add the task. Has been done already
- }
- else
- {
- if (!(task instanceof Property))
- newTasks.add(task);
- }
- }
- return newTasks;
- }
-
- /**
- * Yet another hook to provide a way to
- * do something before any execution, of this
- * task or its contained tasks.
- *
- * Needed because preAlwaysDo is final in order
- * ensure the proper order of execution.
- *
- * Return false to stop any other execution
- */
- protected boolean beforeAlwaysDo()
- {
- return true;
- }
-
- protected boolean shouldRecurse(Task in)
- {
- return true;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.UnknownElement;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.beehive.test.tools.tch.util.AntUtils;
+
+/**
+ * This is a base task for all framework Ant tasks
+ * that contain other sub-tasks.
+ *
+ * As an extension of BaseTwoPassTask, these tasks implement
+ * TwoPassTask, and will be executed twice by Ant.
+ * In addition, other tasks
+ * that need to be called twice but do not fit in
+ * this hierarchy may implement TwoPassTask, and they
+ * will be run twice as well.
+ *
+ * Tasks run only once will be run during the second
+ * pass, or "Execution Mode".
+ *
+ * The operation of this class is that execute() is called
+ * on sub-tasks before it is called on itself
+ *
+ * @see TwoPassTask
+ */
+
+public abstract class BaseTaskContainer
+ extends BaseTwoPassTask
+ implements TaskContainer
+{
+ private Collection twoPassTasks = new ArrayList();
+ private Collection allTasks = new ArrayList();
+
+ /*
+ * Called for each child task.
+ * @see org.apache.tools.ant.TaskContainer#addTask(org.apache.tools.ant.Task)
+ */
+ public final void addTask(Task in)
+ {
+ boolean in_is_unknown = false;
+ /*
+ * Ant 1.6 seems to return UnknownElement instead of the actual
+ * task. When this is the case, initialize the task element and get
+ * the Task object to make this more consistent with pre-1.6 behavior
+ */
+ if (in instanceof UnknownElement)
+ {
+ in_is_unknown = true;
+ // 1.6 will also cause a difference here since we need to call maybeConfigure() here
+ // explicitly to get the task type This will end up calling the addTask/handleTask
+ // for child elements recursively. Thus addTask is called from
+ // bottom to top instead of top to bottom.
+ ((UnknownElement)in).maybeConfigure();
+ in = ((UnknownElement)in).getTask();
+ if (in instanceof TwoPassTask)
+ {
+ twoPassTasks.add(in);
+ }
+ allTasks.add(in);
+ if (this instanceof TestSuiteTask)
+ {
+ // recursiveHandleTask only really needs to be called once from the top level
+ // BaseTaskContainer which should be TestSuiteTask
+ recursiveHandleTask(this, in);
+ }
+ }
+
+ if (shouldRecurse(in))
+ {
+ // in effect this filters out Ant 1.6 since it always passes in
+ // an UnknownElement
+ if (!in_is_unknown)
+ {
+ if (in instanceof TwoPassTask)
+ {
+ twoPassTasks.add(in);
+ }
+ allTasks.add(in);
+ // this should not be called for Ant 1.6 since UnknownElement is always passed in
+ handleTask(in); //hook
+ }
+ }
+
+ }
+
+ /*
+ * This is added to support Ant 1.6 . Since addTask() is no longer called from top
+ * to bottom for each task, we need a recursive method to call each subtask's
+ * handleTask() method from top to bottom. This will in-effect simulate the
+ * behavior from Ant 1.5
+ *
+ * This might be a hack, but couldn't think of a better way to do this without
+ * changing lots of code in the tasks
+ */
+ public final void recursiveHandleTask(Task parenttask, Task childtask)
+ {
+ if (parenttask instanceof BaseTaskContainer)
+ {
+ ((BaseTaskContainer)parenttask).handleTask(childtask);
+ }
+ else if (parenttask instanceof AnythingTask)
+ {
+ ((AnythingTask)parenttask).handleTask(childtask);
+ }
+ else if (parenttask instanceof TestParallelTask)
+ {
+ // this logic comes from TestParallelTask
+ if (((TestParallelTask)parenttask).getParentTask()
+ instanceof BaseTaskContainer)
+ (
+ (BaseTaskContainer) ((TestParallelTask)parenttask)
+ .getParentTask())
+ .handleTask(
+ childtask);
+ }
+ else if (parenttask instanceof TestSequentialTask)
+ {
+ // this logic comes from TestSequentialTask
+ if (((TestSequentialTask)parenttask).getParentTask()
+ instanceof BaseTaskContainer)
+ (
+ (BaseTaskContainer) ((TestSequentialTask)parenttask)
+ .getParentTask())
+ .handleTask(
+ childtask);
+ }
+
+ Iterator iter = null;
+ if (childtask instanceof BaseTaskContainer)
+ iter = ((BaseTaskContainer)childtask).getAllTasks().iterator();
+ else if (childtask instanceof AnythingTask)
+ iter = ((AnythingTask)childtask).getAllTasks().iterator();
+ else if (childtask instanceof TestParallelTask)
+ iter = ((TestParallelTask)childtask).getAllTasks().iterator();
+ else if (childtask instanceof TestSequentialTask)
+ iter = ((TestSequentialTask)childtask).getAllTasks().iterator();
+
+ if (iter != null)
+ {
+ while (iter.hasNext())
+ {
+ Task task = (Task)iter.next();
+ recursiveHandleTask(childtask, task);
+ }
+ }
+ }
+
+ public Collection getAllTasks()
+ {
+ return allTasks;
+ }
+
+ /**
+ * The hook for handling tasks, since addTask is final (above).
+ * This method returns the Task, so that subclasses can either get the
+ * task if it needs to be further handled, or get a null if it is
+ * to no longer be handled, as deemed by the superclass
+ */
+ public Task handleTask(Task in)
+ {
+ if (in instanceof TestSuiteChild)
+ {
+ //log("BaseTaskContainer.handleTask for " + in.getClass().getName() + " setting to null? " + (getTestSuiteTask()==null));
+ ((TestSuiteChild)in).setTestSuiteTask(getTestSuiteTask());
+ }
+ //Set parent if child is a ChildTask
+ if (in instanceof ChildTask)
+ {
+ ((ChildTask)in).setParentTask(this);
+ }
+ return in;
+ }
+
+ public final boolean preAlwaysDo() throws BuildException
+ {
+ boolean rtn = super.preAlwaysDo();
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preAlwaysDo on task: "+getClass().getName(), getLocation());
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Two-pass tasks: "+twoPassTasks, getLocation());
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("All tasks: "+allTasks, getLocation());
+ if (!beforeAlwaysDo())
+ return false; //short circuit option for hook
+ if (DirtyClass.isFirstPass())
+ {
+ AntUtils.perform(filterTasks(twoPassTasks));
+ //only do the two pass for two-pass tasks
+ }
+ else
+ {
+ AntUtils.perform(filterTasks(allTasks));
+ }
+ return rtn;
+ }
+
+ private Collection filterTasks(Collection tasks)
+ {
+ Collection newTasks = new ArrayList();
+ for (Iterator iter = tasks.iterator(); iter.hasNext();)
+ {
+ Task task = (Task)iter.next();
+ if (task instanceof RunOnceTask && !((RunOnceTask)task).isFirstCall())
+ {
+ //Don't add the task. Has been done already
+ }
+ else
+ {
+ if (!(task instanceof Property))
+ newTasks.add(task);
+ }
+ }
+ return newTasks;
+ }
+
+ /**
+ * Yet another hook to provide a way to
+ * do something before any execution, of this
+ * task or its contained tasks.
+ *
+ * Needed because preAlwaysDo is final in order
+ * ensure the proper order of execution.
+ *
+ * Return false to stop any other execution
+ */
+ protected boolean beforeAlwaysDo()
+ {
+ return true;
+ }
+
+ protected boolean shouldRecurse(Task in)
+ {
+ return true;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTaskContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTwoPassTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTwoPassTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTwoPassTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTwoPassTask.java Fri Aug 12 08:12:28 2005
@@ -1,202 +1,202 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- * This is a base Task for all framework Ant tasks, as these
- * tasks will be executed twice by Ant, once referred to as
- * "Initialization Mode" and the the second time referred to
- * as "Execution Mode", referring to the execution of tests.
- * <p>
- * All child classes which extend BaseTwoPassTask should override
- * one or more of the following methods:
- * <p>
- * Run during initialization phase:
- * <pre>
- * preInitialize()
- * preAlwaysDo()
- * initialize()
- * alwaysDo()
- * </pre>
- * Run during execute phase:
- * <pre>
- * preRun()
- * preAlwaysDo()
- * run()
- * postRun()
- * alwaysDo()
- * </pre>
- * <p>
- * These hook methods are the main execution entry points meant to be overridden
- * by child tasks.
- * <p>
- * execute() is final, so there are optional hooks to override
- * to get custom behavior. See below for details.
- *
- */
-public abstract class BaseTwoPassTask extends BaseTask implements TwoPassTask
-{
- private boolean firstCall = true;
-
- /**
- * The execute() method is Ant's entry point into the task. As described above,
- * this is set up to be called twice, once for initialization and once for
- * execution
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- public final void execute() throws BuildException
- {
- if (!(this instanceof StartupTask))
- org.apache.beehive.test.tools.tch.util.DebugLogger.log(
- "Calling execute on task: " + getClass().getName(),
- getLocation());
-
- callHooks();
-
- firstCall = false; //done with first call of execute to this task instance
- }
-
- /**
- * Call all initialization and execution hook methods in order
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- private void callHooks() throws BuildException
- {
- if (DirtyClass.isFirstPass())
- {
- if (!preInitialize())
- return;
- if (!preAlwaysDo())
- return;
- if (!initialize())
- return;
- }
- else
- if (DirtyClass.runAll() || DirtyClass.isRunSubsetPass())
- {
- if (!preRun())
- return;
- if (!preAlwaysDo())
- return;
- if (!run())
- return;
- if (!postRun())
- return;
- }
- alwaysDo(); //Currently the last thing, so the return is irrelevant
- }
-
- /**
- * Check whether execute() has already been called on this task instance
- *
- * @return true if execute() has already been called on this task instance
- */
- public boolean isFirstCall()
- {
- return firstCall;
- }
-
- // Six hooks to use, always call super!
-
- /**
- * Hook method called in Initialization Mode only. Hook methods in
- * BaseTwoPassTask are meant to be overridden and called with
- * super.<methodname> from child classes. Thus there is no
- * real method body here.
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean initialize() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling initialize on task: "+getClass().getName(), getLocation());
- return true;
- }
-
- /**
- * Called in Initialization Mode only
- * before preAlwaysDo
- * Return false to stop any other execution
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean preInitialize() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preInitialize on task: "+getClass().getName(), getLocation());
- return true;
- }
-
- /**
- * Called in both modes
- * After initialize or run
- * Currently the last method called
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean alwaysDo() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling alwaysDo on task: "+getClass().getName(), getLocation());
- return true;
- }
-
- /**
- * Called in both modes
- * before either initialize or run
- * Return false to stop any other execution
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean preAlwaysDo() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preAlwaysDo on task: "+getClass().getName(), getLocation());
- return true;
- }
-
- /**
- * Called in Execution Mode only
- * Return false to stop any other execution
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean run() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling run on task: "+getClass().getName(), getLocation());
- return true;
- }
-
- /**
- * Called in Execution Mode only
- * before preAlwaysDo
- * Return false to stop any other execution
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean preRun() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preRun on task: "+getClass().getName(), getLocation());
- return true;
- }
-
- /**
- * Called in Execution Mode only
- * after run()
- * Return false to stop any other execution
- *
- * @throws BuildException various error conditions can throw this in order to
- * fail the ant build
- */
- protected boolean postRun() throws BuildException
- {
- //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling postRun on task: "+getClass().getName(), getLocation());
- return true;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * This is a base Task for all framework Ant tasks, as these
+ * tasks will be executed twice by Ant, once referred to as
+ * "Initialization Mode" and the the second time referred to
+ * as "Execution Mode", referring to the execution of tests.
+ * <p>
+ * All child classes which extend BaseTwoPassTask should override
+ * one or more of the following methods:
+ * <p>
+ * Run during initialization phase:
+ * <pre>
+ * preInitialize()
+ * preAlwaysDo()
+ * initialize()
+ * alwaysDo()
+ * </pre>
+ * Run during execute phase:
+ * <pre>
+ * preRun()
+ * preAlwaysDo()
+ * run()
+ * postRun()
+ * alwaysDo()
+ * </pre>
+ * <p>
+ * These hook methods are the main execution entry points meant to be overridden
+ * by child tasks.
+ * <p>
+ * execute() is final, so there are optional hooks to override
+ * to get custom behavior. See below for details.
+ *
+ */
+public abstract class BaseTwoPassTask extends BaseTask implements TwoPassTask
+{
+ private boolean firstCall = true;
+
+ /**
+ * The execute() method is Ant's entry point into the task. As described above,
+ * this is set up to be called twice, once for initialization and once for
+ * execution
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ public final void execute() throws BuildException
+ {
+ if (!(this instanceof StartupTask))
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log(
+ "Calling execute on task: " + getClass().getName(),
+ getLocation());
+
+ callHooks();
+
+ firstCall = false; //done with first call of execute to this task instance
+ }
+
+ /**
+ * Call all initialization and execution hook methods in order
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ private void callHooks() throws BuildException
+ {
+ if (DirtyClass.isFirstPass())
+ {
+ if (!preInitialize())
+ return;
+ if (!preAlwaysDo())
+ return;
+ if (!initialize())
+ return;
+ }
+ else
+ if (DirtyClass.runAll() || DirtyClass.isRunSubsetPass())
+ {
+ if (!preRun())
+ return;
+ if (!preAlwaysDo())
+ return;
+ if (!run())
+ return;
+ if (!postRun())
+ return;
+ }
+ alwaysDo(); //Currently the last thing, so the return is irrelevant
+ }
+
+ /**
+ * Check whether execute() has already been called on this task instance
+ *
+ * @return true if execute() has already been called on this task instance
+ */
+ public boolean isFirstCall()
+ {
+ return firstCall;
+ }
+
+ // Six hooks to use, always call super!
+
+ /**
+ * Hook method called in Initialization Mode only. Hook methods in
+ * BaseTwoPassTask are meant to be overridden and called with
+ * super.<methodname> from child classes. Thus there is no
+ * real method body here.
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean initialize() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling initialize on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+
+ /**
+ * Called in Initialization Mode only
+ * before preAlwaysDo
+ * Return false to stop any other execution
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean preInitialize() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preInitialize on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+
+ /**
+ * Called in both modes
+ * After initialize or run
+ * Currently the last method called
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean alwaysDo() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling alwaysDo on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+
+ /**
+ * Called in both modes
+ * before either initialize or run
+ * Return false to stop any other execution
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean preAlwaysDo() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preAlwaysDo on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+
+ /**
+ * Called in Execution Mode only
+ * Return false to stop any other execution
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean run() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling run on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+
+ /**
+ * Called in Execution Mode only
+ * before preAlwaysDo
+ * Return false to stop any other execution
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean preRun() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling preRun on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+
+ /**
+ * Called in Execution Mode only
+ * after run()
+ * Return false to stop any other execution
+ *
+ * @throws BuildException various error conditions can throw this in order to
+ * fail the ant build
+ */
+ protected boolean postRun() throws BuildException
+ {
+ //org.apache.beehive.test.tools.tch.util.DebugLogger.log("Calling postRun on task: "+getClass().getName(), getLocation());
+ return true;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BaseTwoPassTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BuildStatus.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BuildStatus.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BuildStatus.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BuildStatus.java Fri Aug 12 08:12:28 2005
@@ -1,23 +1,23 @@
-/*
- * Created on Apr 23, 2003
- *
- * Just a static place to put information on how we want to treat the Ant build
- */
-package org.apache.beehive.test.tools.tch.core;
-
-/**
- */
-public class BuildStatus
-{
- private static boolean failed = false;
-
- public static boolean isFailed()
- {
- return failed;
- }
-
- public static void setFailed()
- {
- failed = true;
- }
-}
+/*
+ * Created on Apr 23, 2003
+ *
+ * Just a static place to put information on how we want to treat the Ant build
+ */
+package org.apache.beehive.test.tools.tch.core;
+
+/**
+ */
+public class BuildStatus
+{
+ private static boolean failed = false;
+
+ public static boolean isFailed()
+ {
+ return failed;
+ }
+
+ public static void setFailed()
+ {
+ failed = true;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/BuildStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChain.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChain.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChain.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChain.java Fri Aug 12 08:12:28 2005
@@ -1,97 +1,97 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.tools.ant.Location;
-import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents the path we took through the tree of test scripts to reach
- * a particular test.
- */
-public class CallingChain implements Cloneable
-{
- List callingChain = null;
- // CallingChainLink Objects
-
- Location currentLocation = null;
-
- public CallingChain(List inList)
- {
- callingChain = new ArrayList(inList);
- }
-
- public void setCurrentLocation(Location in)
- {
- currentLocation = in;
- }
-
- public Location getCurrentLocation()
- {
- return currentLocation;
- }
-
- public boolean endsAtSamePlace(CallingChain in)
- {
- if (in.isEmpty() || callingChain.isEmpty())
- return false;
- return (
- getLastFile().getName().trim().equals(in.getLastFile().getName().trim()));
- }
-
- /*
- * It's only a real chain if it has more than one link.
- */
- public boolean hasMoreThanOneLink()
- {
- return (callingChain.size() > 1);
- }
-
- public Object clone()
- {
- Object clone = null;
- try
- {
- clone = super.clone();
- }
- catch (CloneNotSupportedException ex)
- {
- throw new NestedRuntimeException(ex);
- }
- return clone;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- CallingChainLink links[] =
- (CallingChainLink[]) callingChain.toArray(new CallingChainLink[] {
- });
- for (int i = 0; i < links.length; i++)
- {
- File f = links[i].getFile();
- if (i == 0)
- sb.append(f.getAbsolutePath());
- else
- sb.append(f);
- if ((i + 1) < links.length)
- sb.append(" (").append(links[i + 1].calledFromLine()).append(
- ")").append(
- " --> ");
- }
- return sb.toString();
- }
-
- private boolean isEmpty()
- {
- return callingChain.isEmpty();
- }
-
- private File getLastFile()
- {
- return ((CallingChainLink) callingChain.get(callingChain.size() - 1))
- .getFile();
- }
-
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.tools.ant.Location;
+import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents the path we took through the tree of test scripts to reach
+ * a particular test.
+ */
+public class CallingChain implements Cloneable
+{
+ List callingChain = null;
+ // CallingChainLink Objects
+
+ Location currentLocation = null;
+
+ public CallingChain(List inList)
+ {
+ callingChain = new ArrayList(inList);
+ }
+
+ public void setCurrentLocation(Location in)
+ {
+ currentLocation = in;
+ }
+
+ public Location getCurrentLocation()
+ {
+ return currentLocation;
+ }
+
+ public boolean endsAtSamePlace(CallingChain in)
+ {
+ if (in.isEmpty() || callingChain.isEmpty())
+ return false;
+ return (
+ getLastFile().getName().trim().equals(in.getLastFile().getName().trim()));
+ }
+
+ /*
+ * It's only a real chain if it has more than one link.
+ */
+ public boolean hasMoreThanOneLink()
+ {
+ return (callingChain.size() > 1);
+ }
+
+ public Object clone()
+ {
+ Object clone = null;
+ try
+ {
+ clone = super.clone();
+ }
+ catch (CloneNotSupportedException ex)
+ {
+ throw new NestedRuntimeException(ex);
+ }
+ return clone;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ CallingChainLink links[] =
+ (CallingChainLink[]) callingChain.toArray(new CallingChainLink[] {
+ });
+ for (int i = 0; i < links.length; i++)
+ {
+ File f = links[i].getFile();
+ if (i == 0)
+ sb.append(f.getAbsolutePath());
+ else
+ sb.append(f);
+ if ((i + 1) < links.length)
+ sb.append(" (").append(links[i + 1].calledFromLine()).append(
+ ")").append(
+ " --> ");
+ }
+ return sb.toString();
+ }
+
+ private boolean isEmpty()
+ {
+ return callingChain.isEmpty();
+ }
+
+ private File getLastFile()
+ {
+ return ((CallingChainLink) callingChain.get(callingChain.size() - 1))
+ .getFile();
+ }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChain.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChainLink.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChainLink.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChainLink.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChainLink.java Fri Aug 12 08:12:28 2005
@@ -1,73 +1,73 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.File;
-
-import org.apache.tools.ant.Location;
-
-import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
-import org.apache.beehive.test.tools.tch.util.AntUtils;
-
-/**
- * A CallingChain is made out of many calling chain links.
- */
-public class CallingChainLink implements Cloneable
-{
- private File file = null;
- private Location location = null;
-
- public CallingChainLink(File inFile, Location inLocation)
- {
- file = inFile;
- location = inLocation;
- }
-
- public File getFile()
- {
- return file;
- }
-
-
- public Location getLocation()
- {
- return location;
- }
-
- public String calledFromLine()
- {
- return AntUtils.getLineNumber(location);
- }
-
- public String toString()
- {
- return file.toString() + "\n" + location;
- }
-
- public boolean equals(Object obj)
- {
- if(obj != null && obj instanceof CallingChainLink)
- {
- CallingChainLink link = (CallingChainLink)obj;
- if(link.file.getName().equals(file.getName()) && link.location.toString().equals(location.toString()))
- return true;
- }
- return false;
- }
-
- public int hashCode()
- {
- return file.hashCode() ^ location.hashCode();
- }
-
- public Object clone()
- {
- CallingChainLink clone = null;
- try
- {
- clone = (CallingChainLink)super.clone();
- } catch (CloneNotSupportedException ex)
- {
- throw new NestedRuntimeException(ex);
- }
- return clone;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.File;
+
+import org.apache.tools.ant.Location;
+
+import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
+import org.apache.beehive.test.tools.tch.util.AntUtils;
+
+/**
+ * A CallingChain is made out of many calling chain links.
+ */
+public class CallingChainLink implements Cloneable
+{
+ private File file = null;
+ private Location location = null;
+
+ public CallingChainLink(File inFile, Location inLocation)
+ {
+ file = inFile;
+ location = inLocation;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+
+ public Location getLocation()
+ {
+ return location;
+ }
+
+ public String calledFromLine()
+ {
+ return AntUtils.getLineNumber(location);
+ }
+
+ public String toString()
+ {
+ return file.toString() + "\n" + location;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if(obj != null && obj instanceof CallingChainLink)
+ {
+ CallingChainLink link = (CallingChainLink)obj;
+ if(link.file.getName().equals(file.getName()) && link.location.toString().equals(location.toString()))
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return file.hashCode() ^ location.hashCode();
+ }
+
+ public Object clone()
+ {
+ CallingChainLink clone = null;
+ try
+ {
+ clone = (CallingChainLink)super.clone();
+ } catch (CloneNotSupportedException ex)
+ {
+ throw new NestedRuntimeException(ex);
+ }
+ return clone;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/CallingChainLink.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ChildTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ChildTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ChildTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ChildTask.java Fri Aug 12 08:12:28 2005
@@ -1,8 +1,8 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.tools.ant.Task;
-
-public interface ChildTask
-{
- public void setParentTask(Task parent);
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.tools.ant.Task;
+
+public interface ChildTask
+{
+ public void setParentTask(Task parent);
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ChildTask.java
------------------------------------------------------------------------------
svn:eol-style = native