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 [56/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/TestTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestTask.java Fri Aug 12 08:12:28 2005
@@ -1,335 +1,335 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.core.process.OutputProducerProcessHandler;
-import org.apache.beehive.test.tools.tch.core.process.ProcessHandler;
-import org.apache.beehive.test.tools.tch.core.process.ProcessRegistry;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-
-/**
- * This class represents a single test entity. It wraps a single execution task
- * and provides many services for it, such as configuring the ProcessEngine and
- * receiving and populating test results.
- */
-public class TestTask extends AbstractTestTask
-{
- public static final String NO_EXECUTION_TASK_ERROR =
- "The Test Task must contain at least one ExecutionTask";
-
- private ExecutionTask executionTask = null;
-
- private boolean validatedSubtestNames = false;
-
- /**
- * handleTask is generally run as part of the initialization during ant parsing time
- * to control parenting and propogation of helper objects
- */
- public Task handleTask(Task task)
- {
- org.apache.beehive.test.tools.tch.util.DebugLogger.log(
- "TestTask.handleTask()",
- getLocation());
-
- task = super.handleTask(task); //Remember to call super!!!
- if (task != null && task instanceof ExecutionTask)
- {
- executionTask = (ExecutionTask)task;
- executionTask.setHelper(getNewConfiguredExecutionTaskHelper());
- }
- if (task != null && task instanceof TestVehicleTask)
- {
- TestVehicleTask testVehicleTask = (TestVehicleTask)task;
- testVehicleTask.setHelper(getNewConfiguredExecutionTaskHelper());
- }
- // review - we should handle utility tasks differently
- // they should just be ant tasks.
- if (task != null && task instanceof AbstractUtilityTask)
- {
- AbstractUtilityTask utilityTask = (AbstractUtilityTask)task;
- utilityTask.setHelper(getNewConfiguredExecutionTaskHelper());
- }
-
- return task;
- }
-
- protected boolean preInitialize() throws BuildException
- {
- if (super.preInitialize())
- {
- getHelper().setProcessEngine(this);
- return true;
- }
- else
- return false;
- }
-
- protected boolean initialize() throws BuildException
- {
- if (super.initialize()) //only if AbstractTestTask decided to keep going
- {
- //First we call the validation hook, but only if this test
- //will actually run. If it has been filtered out, don't validate it
- if (willRun())
- {
- try
- {
- executionTask.validate();
- }
- catch (ExecutionTaskValidationException ex)
- {
- //VALIDATION EXCEPTION
- invalidate(
- new NonfatalValidationException(
- ex,
- ErrorMessageConstants.EXEC_TASK_WRAPPED_ERROR_CODE));
- }
- }
-
- //Now the framework kind of validation, will also catch test vehicle kinds of exceptions
- addInvalidations(executionTask.getNonfatalValidationAggregate());
-
- return true;
- }
- else
- return false;
- }
-
- protected boolean preRun() throws BuildException
- {
- if (super.preRun())
- {
- if (shouldRun())
- {
- // remove all previous process output from the buffer
- // so that when we log result(s) for this test we get the the ouput
- // that applies to this test
- clearProcessOutput();
-
- notifyProcesses(); // ...that we're about to start running this test.
-
- //System.out.println("In PreRun.");
- // FIXME - move timeout mechanism out of execution task, into test task
- executionTask.setTestTimeoutSeconds(getTestTimeoutSeconds());
- }
- return true;
- //Still return true if we are skipping, need to do the right logging and such
- }
- else
- return false;
- }
-
- protected boolean postRun() throws BuildException
- {
- if (super.postRun())
- {
- if (shouldRun())
- {
- notifyProcessesPostTest();
- }
- return true;
- }
- else
- return false;
- }
-
- //Now we check this later, at exec task run time, since embededd custom tasks may result in test skipping
-
- public void checkSkip()
- {
- if (!shouldRun())
- {
- handleSkip(); //mostly for logging
- }
- }
-
- public Collection getExecutionTasks()
- {
- HashSet rtn = new HashSet(1);
- rtn.add(executionTask);
- return rtn;
- }
-
- private void handleSkip()
- {
- if (isTestNode())
- {
- if (isValidationSkipped())
- {
- executionTask.setValidationSkip(
- "Skipping due to a Tch validation error. Invalidation for test "
- + getName()
- + "\n\n"
- + getValidationSkipMessage(true));
- }
- else
- {
- executionTask.setSkip("Skipping test because: " + getSkipMessage());
- }
- }
- else
- {
- //Must have been nested test, so we don't report an outcome, just a message
- String message = null;
- if (isValidationSkipped())
- message = " of a Tch validation error.";
- else
- message = getSkipMessage();
- executionTask.setNestedSkip(
- "Skipping test in the test-block "
- + getTestNode().getName()
- + " because "
- + message);
- }
- }
-
- /**
- * Returns number of outcome results this test task's execution task will
- * submit.
- * //override
- * @return the number of outcome results this execution task will submit.
- */
- public int getNumOutcomes()
- {
- return executionTask.getNumOutcomes();
- }
-
- /**
- * Get all subtests in the execution task which are supposed to run. This should
- * take into account test replication and other settings which might control the
- * selectivity of subtests to run.
- *
- * @return Collection of subtest names
- */
- public final Collection getSubtestsConfiguredToRun()
- {
- return executionTask.getSubtestsConfiguredToRun();
- }
-
- /**
- * Get all subtests in the execution task without the <test-unit>.<test> prefix
- *
- * @return Collection of subtest names
- */
- public Collection getNonQualifiedSubtestNames()
- {
- return executionTask.getAllSubtestNames();
- }
-
- /**
- * Get all the fully qualified name of all subtests in the execution task
- *
- * @return Collection of subtest names
- */
- public Collection getFullyQualifiedSubtestNames()
- {
- Collection subtestNames = getNonQualifiedSubtestNames();
- if (subtestNames == null)
- {
- return null;
- }
- else
- {
- // add the fully qualified test name in front
- Collection ret = new ArrayList();
- for (Iterator iter = subtestNames.iterator(); iter.hasNext();)
- {
- String subtestName = (String)iter.next();
- String testName =
- getShortName() + TchConstants.RESULT_NAME_SEP + subtestName;
-
- //validate the test name without the testunit.
-
- // VALIDATION ERROR
- // We also validate the logical-test-name without subtest name in
- // AbstractTestTask. Might want to combine these two validations
- // at some point. We will get duplicate validation errors
- // if the logical-test-name without subtest name exceeds the limit.
- // That's ok since INVALIDATIONs are not outcomes
- if (!validatedSubtestNames
- && AntProperties.isTestNameLengthValidationEnabled()
- && testName.length() > TchConstants.MAX_TEST_NAME_LENGTH)
- {
- addTestNameExceedsMaxLengthInvalidation(
- testName,
- TchConstants.MAX_TEST_NAME_LENGTH);
- }
- ret.add(getTestUnit() + TchConstants.RESULT_NAME_SEP + testName);
- }
- validatedSubtestNames = true;
- // want to return fully qualified, so add the testunit
- return ret;
- }
- }
-
- protected String getTestCaseName()
- {
- return executionTask.getTestCaseName();
- }
-
- // TestVehicleTask calls this when it handles its execution task.
- public void setExecutionTask(ExecutionTask in)
- {
- executionTask = in;
- }
-
- /**
- * Private method to create a new ExecutionTaskHelper for the current test.
- *
- * @return ExecutionTaskHelper for the current test
- */
- private ExecutionTaskHelper getNewConfiguredExecutionTaskHelper()
- {
- ExecutionTaskHelper executionTaskHelper = new ExecutionTaskHelper();
- executionTaskHelper.setResultHandler(this);
- executionTaskHelper.setTestTask(this);
- return executionTaskHelper;
- }
-
- private void notifyProcesses()
- {
- for (Iterator iter = getAllProcessEntries().iterator(); iter.hasNext();)
- {
- ProcessRegistry.Entry processEntry = (ProcessRegistry.Entry)iter.next();
- processEntry.getProcessManager().perTestCallback(
- processEntry.getProcess(),
- getName());
- }
- }
-
- /**
- * Private method used to call the postTestCallback() method on all processes which are
- * mapped for the current test
- */
- private void notifyProcessesPostTest()
- {
- for (Iterator iter = getAllProcessEntries().iterator(); iter.hasNext();)
- {
- ProcessRegistry.Entry processEntry = (ProcessRegistry.Entry)iter.next();
- processEntry.getProcessManager().postTestCallback(
- processEntry.getProcess(),
- getName());
- }
- }
-
- private void clearProcessOutput()
- {
- for (Iterator iter = getAllActiveProcessHandlers().iterator();
- iter.hasNext();
- )
- {
- ProcessHandler ph = (ProcessHandler)iter.next();
- if (ph instanceof OutputProducerProcessHandler)
- {
- ((OutputProducerProcessHandler)ph).clearProcessOutput();
- }
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.core.process.OutputProducerProcessHandler;
+import org.apache.beehive.test.tools.tch.core.process.ProcessHandler;
+import org.apache.beehive.test.tools.tch.core.process.ProcessRegistry;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+
+/**
+ * This class represents a single test entity. It wraps a single execution task
+ * and provides many services for it, such as configuring the ProcessEngine and
+ * receiving and populating test results.
+ */
+public class TestTask extends AbstractTestTask
+{
+ public static final String NO_EXECUTION_TASK_ERROR =
+ "The Test Task must contain at least one ExecutionTask";
+
+ private ExecutionTask executionTask = null;
+
+ private boolean validatedSubtestNames = false;
+
+ /**
+ * handleTask is generally run as part of the initialization during ant parsing time
+ * to control parenting and propogation of helper objects
+ */
+ public Task handleTask(Task task)
+ {
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log(
+ "TestTask.handleTask()",
+ getLocation());
+
+ task = super.handleTask(task); //Remember to call super!!!
+ if (task != null && task instanceof ExecutionTask)
+ {
+ executionTask = (ExecutionTask)task;
+ executionTask.setHelper(getNewConfiguredExecutionTaskHelper());
+ }
+ if (task != null && task instanceof TestVehicleTask)
+ {
+ TestVehicleTask testVehicleTask = (TestVehicleTask)task;
+ testVehicleTask.setHelper(getNewConfiguredExecutionTaskHelper());
+ }
+ // review - we should handle utility tasks differently
+ // they should just be ant tasks.
+ if (task != null && task instanceof AbstractUtilityTask)
+ {
+ AbstractUtilityTask utilityTask = (AbstractUtilityTask)task;
+ utilityTask.setHelper(getNewConfiguredExecutionTaskHelper());
+ }
+
+ return task;
+ }
+
+ protected boolean preInitialize() throws BuildException
+ {
+ if (super.preInitialize())
+ {
+ getHelper().setProcessEngine(this);
+ return true;
+ }
+ else
+ return false;
+ }
+
+ protected boolean initialize() throws BuildException
+ {
+ if (super.initialize()) //only if AbstractTestTask decided to keep going
+ {
+ //First we call the validation hook, but only if this test
+ //will actually run. If it has been filtered out, don't validate it
+ if (willRun())
+ {
+ try
+ {
+ executionTask.validate();
+ }
+ catch (ExecutionTaskValidationException ex)
+ {
+ //VALIDATION EXCEPTION
+ invalidate(
+ new NonfatalValidationException(
+ ex,
+ ErrorMessageConstants.EXEC_TASK_WRAPPED_ERROR_CODE));
+ }
+ }
+
+ //Now the framework kind of validation, will also catch test vehicle kinds of exceptions
+ addInvalidations(executionTask.getNonfatalValidationAggregate());
+
+ return true;
+ }
+ else
+ return false;
+ }
+
+ protected boolean preRun() throws BuildException
+ {
+ if (super.preRun())
+ {
+ if (shouldRun())
+ {
+ // remove all previous process output from the buffer
+ // so that when we log result(s) for this test we get the the ouput
+ // that applies to this test
+ clearProcessOutput();
+
+ notifyProcesses(); // ...that we're about to start running this test.
+
+ //System.out.println("In PreRun.");
+ // FIXME - move timeout mechanism out of execution task, into test task
+ executionTask.setTestTimeoutSeconds(getTestTimeoutSeconds());
+ }
+ return true;
+ //Still return true if we are skipping, need to do the right logging and such
+ }
+ else
+ return false;
+ }
+
+ protected boolean postRun() throws BuildException
+ {
+ if (super.postRun())
+ {
+ if (shouldRun())
+ {
+ notifyProcessesPostTest();
+ }
+ return true;
+ }
+ else
+ return false;
+ }
+
+ //Now we check this later, at exec task run time, since embededd custom tasks may result in test skipping
+
+ public void checkSkip()
+ {
+ if (!shouldRun())
+ {
+ handleSkip(); //mostly for logging
+ }
+ }
+
+ public Collection getExecutionTasks()
+ {
+ HashSet rtn = new HashSet(1);
+ rtn.add(executionTask);
+ return rtn;
+ }
+
+ private void handleSkip()
+ {
+ if (isTestNode())
+ {
+ if (isValidationSkipped())
+ {
+ executionTask.setValidationSkip(
+ "Skipping due to a Tch validation error. Invalidation for test "
+ + getName()
+ + "\n\n"
+ + getValidationSkipMessage(true));
+ }
+ else
+ {
+ executionTask.setSkip("Skipping test because: " + getSkipMessage());
+ }
+ }
+ else
+ {
+ //Must have been nested test, so we don't report an outcome, just a message
+ String message = null;
+ if (isValidationSkipped())
+ message = " of a Tch validation error.";
+ else
+ message = getSkipMessage();
+ executionTask.setNestedSkip(
+ "Skipping test in the test-block "
+ + getTestNode().getName()
+ + " because "
+ + message);
+ }
+ }
+
+ /**
+ * Returns number of outcome results this test task's execution task will
+ * submit.
+ * //override
+ * @return the number of outcome results this execution task will submit.
+ */
+ public int getNumOutcomes()
+ {
+ return executionTask.getNumOutcomes();
+ }
+
+ /**
+ * Get all subtests in the execution task which are supposed to run. This should
+ * take into account test replication and other settings which might control the
+ * selectivity of subtests to run.
+ *
+ * @return Collection of subtest names
+ */
+ public final Collection getSubtestsConfiguredToRun()
+ {
+ return executionTask.getSubtestsConfiguredToRun();
+ }
+
+ /**
+ * Get all subtests in the execution task without the <test-unit>.<test> prefix
+ *
+ * @return Collection of subtest names
+ */
+ public Collection getNonQualifiedSubtestNames()
+ {
+ return executionTask.getAllSubtestNames();
+ }
+
+ /**
+ * Get all the fully qualified name of all subtests in the execution task
+ *
+ * @return Collection of subtest names
+ */
+ public Collection getFullyQualifiedSubtestNames()
+ {
+ Collection subtestNames = getNonQualifiedSubtestNames();
+ if (subtestNames == null)
+ {
+ return null;
+ }
+ else
+ {
+ // add the fully qualified test name in front
+ Collection ret = new ArrayList();
+ for (Iterator iter = subtestNames.iterator(); iter.hasNext();)
+ {
+ String subtestName = (String)iter.next();
+ String testName =
+ getShortName() + TchConstants.RESULT_NAME_SEP + subtestName;
+
+ //validate the test name without the testunit.
+
+ // VALIDATION ERROR
+ // We also validate the logical-test-name without subtest name in
+ // AbstractTestTask. Might want to combine these two validations
+ // at some point. We will get duplicate validation errors
+ // if the logical-test-name without subtest name exceeds the limit.
+ // That's ok since INVALIDATIONs are not outcomes
+ if (!validatedSubtestNames
+ && AntProperties.isTestNameLengthValidationEnabled()
+ && testName.length() > TchConstants.MAX_TEST_NAME_LENGTH)
+ {
+ addTestNameExceedsMaxLengthInvalidation(
+ testName,
+ TchConstants.MAX_TEST_NAME_LENGTH);
+ }
+ ret.add(getTestUnit() + TchConstants.RESULT_NAME_SEP + testName);
+ }
+ validatedSubtestNames = true;
+ // want to return fully qualified, so add the testunit
+ return ret;
+ }
+ }
+
+ protected String getTestCaseName()
+ {
+ return executionTask.getTestCaseName();
+ }
+
+ // TestVehicleTask calls this when it handles its execution task.
+ public void setExecutionTask(ExecutionTask in)
+ {
+ executionTask = in;
+ }
+
+ /**
+ * Private method to create a new ExecutionTaskHelper for the current test.
+ *
+ * @return ExecutionTaskHelper for the current test
+ */
+ private ExecutionTaskHelper getNewConfiguredExecutionTaskHelper()
+ {
+ ExecutionTaskHelper executionTaskHelper = new ExecutionTaskHelper();
+ executionTaskHelper.setResultHandler(this);
+ executionTaskHelper.setTestTask(this);
+ return executionTaskHelper;
+ }
+
+ private void notifyProcesses()
+ {
+ for (Iterator iter = getAllProcessEntries().iterator(); iter.hasNext();)
+ {
+ ProcessRegistry.Entry processEntry = (ProcessRegistry.Entry)iter.next();
+ processEntry.getProcessManager().perTestCallback(
+ processEntry.getProcess(),
+ getName());
+ }
+ }
+
+ /**
+ * Private method used to call the postTestCallback() method on all processes which are
+ * mapped for the current test
+ */
+ private void notifyProcessesPostTest()
+ {
+ for (Iterator iter = getAllProcessEntries().iterator(); iter.hasNext();)
+ {
+ ProcessRegistry.Entry processEntry = (ProcessRegistry.Entry)iter.next();
+ processEntry.getProcessManager().postTestCallback(
+ processEntry.getProcess(),
+ getName());
+ }
+ }
+
+ private void clearProcessOutput()
+ {
+ for (Iterator iter = getAllActiveProcessHandlers().iterator();
+ iter.hasNext();
+ )
+ {
+ ProcessHandler ph = (ProcessHandler)iter.next();
+ if (ph instanceof OutputProducerProcessHandler)
+ {
+ ((OutputProducerProcessHandler)ph).clearProcessOutput();
+ }
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitModifierTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitModifierTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitModifierTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitModifierTask.java Fri Aug 12 08:12:28 2005
@@ -1,5 +1,5 @@
-package org.apache.beehive.test.tools.tch.core;
-
-public class TestUnitModifierTask extends AbstractTestEntityModifierTask
-{
-}
+package org.apache.beehive.test.tools.tch.core;
+
+public class TestUnitModifierTask extends AbstractTestEntityModifierTask
+{
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitModifierTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitOverrideTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitOverrideTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitOverrideTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitOverrideTask.java Fri Aug 12 08:12:28 2005
@@ -1,32 +1,32 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-
-public class TestUnitOverrideTask extends BaseTask
-{
- private String value = null;
-
- public void setValue(String inValue)
- {
- try
- {
- TchUtils.validateName(inValue);
- }
- catch (NonfatalValidationException ex)
- {
- invalidate(ex);
- }
- value = inValue;
- }
-
-/**
- *
- *
- * @return String Will never be null, schema will enforce.
- */
- public String getValue()
- {
- return value;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+
+public class TestUnitOverrideTask extends BaseTask
+{
+ private String value = null;
+
+ public void setValue(String inValue)
+ {
+ try
+ {
+ TchUtils.validateName(inValue);
+ }
+ catch (NonfatalValidationException ex)
+ {
+ invalidate(ex);
+ }
+ value = inValue;
+ }
+
+/**
+ *
+ *
+ * @return String Will never be null, schema will enforce.
+ */
+ public String getValue()
+ {
+ return value;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestUnitOverrideTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestVehicleTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestVehicleTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestVehicleTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestVehicleTask.java Fri Aug 12 08:12:28 2005
@@ -1,105 +1,105 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-
-public class TestVehicleTask
- extends BaseTaskContainer
- implements PropertyReferencer
-{
- private String testVehicleType = null;
- private String testVehicleProcessName = null;
- private ExecutionTaskHelper helper = null;
- private ExecutionTask executionTask = null;
-
- public Task handleTask(Task task)
- {
- task = super.handleTask(task); //Remember to call super!!!
- if (task != null)
- {
- if (task instanceof ExecutionTask)
- {
- executionTask = (ExecutionTask)task;
- executionTask.setHelper(helper);
- // we may be able to set the test-vehicle type and process on the helper.
- // then the execution task will have access to it
- getHelper().getTestTask().setExecutionTask(executionTask);
- }
- if (task instanceof PropertyReferencer)
- {
- setNestedPropertyReferencer((PropertyReferencer)task);
- }
- }
- return task;
- }
-
- public void setHelper(ExecutionTaskHelper in)
- {
- helper = in;
- }
-
- //Keeping this around for backward compatibility
-
- public void setName(String in)
- {
- setType(in);
- }
-
- //The new way to specify, see above
-
- public void setType(String in)
- {
- testVehicleType = handleValue(in);
- }
-
- public void setProcess(String in)
- {
- testVehicleProcessName = handleValue(in);
- }
-
- protected boolean initialize() throws BuildException
- {
- super.initialize();
- addInvalidations(executionTask.getNonfatalValidationAggregate());
- return true;
- }
-
- protected boolean preInitialize() throws BuildException
- {
- if (super.initialize())
- {
- getHelper().setTestVehicleType(testVehicleType);
- getHelper().setTestVehicleProcessName(testVehicleProcessName);
-
- // added to the registry for domain gen purposes. This will
- // not be used for test execution.
- getHelper().registerTestVehicleWithTestRegistry();
- return true;
- }
- else
- {
- return false;
- }
- }
-
- protected boolean preRun() throws BuildException
- {
- if (super.preRun())
- {
- getHelper().setTestVehicleType(testVehicleType);
- getHelper().setTestVehicleProcessName(testVehicleProcessName);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- private ExecutionTaskHelper getHelper()
- {
- return helper;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+
+public class TestVehicleTask
+ extends BaseTaskContainer
+ implements PropertyReferencer
+{
+ private String testVehicleType = null;
+ private String testVehicleProcessName = null;
+ private ExecutionTaskHelper helper = null;
+ private ExecutionTask executionTask = null;
+
+ public Task handleTask(Task task)
+ {
+ task = super.handleTask(task); //Remember to call super!!!
+ if (task != null)
+ {
+ if (task instanceof ExecutionTask)
+ {
+ executionTask = (ExecutionTask)task;
+ executionTask.setHelper(helper);
+ // we may be able to set the test-vehicle type and process on the helper.
+ // then the execution task will have access to it
+ getHelper().getTestTask().setExecutionTask(executionTask);
+ }
+ if (task instanceof PropertyReferencer)
+ {
+ setNestedPropertyReferencer((PropertyReferencer)task);
+ }
+ }
+ return task;
+ }
+
+ public void setHelper(ExecutionTaskHelper in)
+ {
+ helper = in;
+ }
+
+ //Keeping this around for backward compatibility
+
+ public void setName(String in)
+ {
+ setType(in);
+ }
+
+ //The new way to specify, see above
+
+ public void setType(String in)
+ {
+ testVehicleType = handleValue(in);
+ }
+
+ public void setProcess(String in)
+ {
+ testVehicleProcessName = handleValue(in);
+ }
+
+ protected boolean initialize() throws BuildException
+ {
+ super.initialize();
+ addInvalidations(executionTask.getNonfatalValidationAggregate());
+ return true;
+ }
+
+ protected boolean preInitialize() throws BuildException
+ {
+ if (super.initialize())
+ {
+ getHelper().setTestVehicleType(testVehicleType);
+ getHelper().setTestVehicleProcessName(testVehicleProcessName);
+
+ // added to the registry for domain gen purposes. This will
+ // not be used for test execution.
+ getHelper().registerTestVehicleWithTestRegistry();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ protected boolean preRun() throws BuildException
+ {
+ if (super.preRun())
+ {
+ getHelper().setTestVehicleType(testVehicleType);
+ getHelper().setTestVehicleProcessName(testVehicleProcessName);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private ExecutionTaskHelper getHelper()
+ {
+ return helper;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestVehicleTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TwoPassTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TwoPassTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TwoPassTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TwoPassTask.java Fri Aug 12 08:12:28 2005
@@ -1,6 +1,6 @@
-package org.apache.beehive.test.tools.tch.core;
-
-public interface TwoPassTask
- extends KnownTask
-{
-}
+package org.apache.beehive.test.tools.tch.core;
+
+public interface TwoPassTask
+ extends KnownTask
+{
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TwoPassTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UnsupportedTaskRuntimeException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UnsupportedTaskRuntimeException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UnsupportedTaskRuntimeException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UnsupportedTaskRuntimeException.java Fri Aug 12 08:12:28 2005
@@ -1,22 +1,22 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
-
-public class UnsupportedTaskRuntimeException
- extends NestedRuntimeException
-{
- public UnsupportedTaskRuntimeException(String message)
- {
- super(message);
- }
-
- public UnsupportedTaskRuntimeException(Exception ex)
- {
- super(ex);
- }
-
- public UnsupportedTaskRuntimeException(Exception ex, String message)
- {
- super(ex, message);
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
+
+public class UnsupportedTaskRuntimeException
+ extends NestedRuntimeException
+{
+ public UnsupportedTaskRuntimeException(String message)
+ {
+ super(message);
+ }
+
+ public UnsupportedTaskRuntimeException(Exception ex)
+ {
+ super(ex);
+ }
+
+ public UnsupportedTaskRuntimeException(Exception ex, String message)
+ {
+ super(ex, message);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UnsupportedTaskRuntimeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UtilityTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UtilityTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UtilityTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UtilityTask.java Fri Aug 12 08:12:28 2005
@@ -1,105 +1,105 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildException;
-
-//import org.apache.beehive.test.tools.tch.common.subject.BasicWLRoster;
-import org.apache.beehive.test.tools.tch.compose.InvalidTestClassException;
-import org.apache.beehive.test.tools.tch.compose.internal.TestNode;
-import org.apache.beehive.test.tools.tch.compose.internal.context.AtomicTestContext;
-import org.apache.beehive.test.tools.tch.core.test.BasicInternalParameters;
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-import org.apache.beehive.test.tools.tch.util.ant.ArgElement;
-
-// I think we can blow this class away - need to make sure
-// but this has been replaced by org.apache.beehive.test.tools.tch.extension.exectask.javatest.JavatestUtilityTask
-//========================================================
-// FIXME only supports javatest utility methods
-public class UtilityTask extends AbstractUtilityTask
-{
-
- private static String DELIMITER = ",";
-
- private String className = null;
- private String methodName = null;
- private Properties props = new Properties();
-
- public void setClassName(String in)
- {
- className = in;
- }
-
- public void setMethodName(String in)
- {
- methodName = in;
- }
-
- public void addConfiguredArg(ArgElement in)
- {
- props.setProperty(in.getName(), in.getValue());
- }
-
- public boolean initialize()
- {
- if (super.initialize())
- {
- try
- {
- validate();
- }
- catch (ExecutionTaskValidationException ex)
- {
- // FIXME: instead of dying right here, we should validate all execution
- // tasks for the run, and report all errors at the same time, instead
- // of one by one.
- throw new BuildException(
- "Validation failed for UtilityTask" + ": " + ex.getMessage(),
- ex,
- getLocation());
- }
- return true;
- }
- return false;
- }
-
- public boolean run()
- {
- if (super.run())
- {
- TestNode n = getLocalTestNode();
- log("Will run utility, class " + className + ", method(s) " + methodName);
- log("params are: " + n.getParameters());
- n.run();
- return true;
- }
- return false;
- }
-
- public void validate() throws ExecutionTaskValidationException
- {
- try
- {
- getLocalTestNode();
- }
- catch (InvalidTestClassException ex)
- {
- throw new ExecutionTaskValidationException(ex, "Could not load class");
- }
- }
-
- private TestNode getLocalTestNode()
- {
- BasicInternalParameters javatestProps = new BasicInternalParameters(props);
- Collection methods = new ArrayList();
- TchUtils.parseStringToStrings(methodName, DELIMITER, methods);
- TestNode n =
- new AtomicTestContext(className, javatestProps, methods);
- n.setResultHandler(getResultHandler());
- n.setProcessEngine(getProcessEngine());
- //n.setRoster(new BasicWLRoster(getProcessEngine()));
- return n;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Properties;
+
+import org.apache.tools.ant.BuildException;
+
+//import org.apache.beehive.test.tools.tch.common.subject.BasicWLRoster;
+import org.apache.beehive.test.tools.tch.compose.InvalidTestClassException;
+import org.apache.beehive.test.tools.tch.compose.internal.TestNode;
+import org.apache.beehive.test.tools.tch.compose.internal.context.AtomicTestContext;
+import org.apache.beehive.test.tools.tch.core.test.BasicInternalParameters;
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+import org.apache.beehive.test.tools.tch.util.ant.ArgElement;
+
+// I think we can blow this class away - need to make sure
+// but this has been replaced by org.apache.beehive.test.tools.tch.extension.exectask.javatest.JavatestUtilityTask
+//========================================================
+// FIXME only supports javatest utility methods
+public class UtilityTask extends AbstractUtilityTask
+{
+
+ private static String DELIMITER = ",";
+
+ private String className = null;
+ private String methodName = null;
+ private Properties props = new Properties();
+
+ public void setClassName(String in)
+ {
+ className = in;
+ }
+
+ public void setMethodName(String in)
+ {
+ methodName = in;
+ }
+
+ public void addConfiguredArg(ArgElement in)
+ {
+ props.setProperty(in.getName(), in.getValue());
+ }
+
+ public boolean initialize()
+ {
+ if (super.initialize())
+ {
+ try
+ {
+ validate();
+ }
+ catch (ExecutionTaskValidationException ex)
+ {
+ // FIXME: instead of dying right here, we should validate all execution
+ // tasks for the run, and report all errors at the same time, instead
+ // of one by one.
+ throw new BuildException(
+ "Validation failed for UtilityTask" + ": " + ex.getMessage(),
+ ex,
+ getLocation());
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public boolean run()
+ {
+ if (super.run())
+ {
+ TestNode n = getLocalTestNode();
+ log("Will run utility, class " + className + ", method(s) " + methodName);
+ log("params are: " + n.getParameters());
+ n.run();
+ return true;
+ }
+ return false;
+ }
+
+ public void validate() throws ExecutionTaskValidationException
+ {
+ try
+ {
+ getLocalTestNode();
+ }
+ catch (InvalidTestClassException ex)
+ {
+ throw new ExecutionTaskValidationException(ex, "Could not load class");
+ }
+ }
+
+ private TestNode getLocalTestNode()
+ {
+ BasicInternalParameters javatestProps = new BasicInternalParameters(props);
+ Collection methods = new ArrayList();
+ TchUtils.parseStringToStrings(methodName, DELIMITER, methods);
+ TestNode n =
+ new AtomicTestContext(className, javatestProps, methods);
+ n.setResultHandler(getResultHandler());
+ n.setProcessEngine(getProcessEngine());
+ //n.setRoster(new BasicWLRoster(getProcessEngine()));
+ return n;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/UtilityTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/VersionGenerator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/VersionGenerator.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/VersionGenerator.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/VersionGenerator.java Fri Aug 12 08:12:28 2005
@@ -1,138 +1,138 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.Date;
-import java.util.StringTokenizer;
-
-import org.apache.beehive.test.tools.tch.util.env.Environment;
-
-/**
- * Generates the Version class for tch
- *
- * @version 1.0, Sept 3, 2001
- */
-public class VersionGenerator
-{
-
- private static final String SRC_PROPERTY = "beehive.tch.src";
- private static final String VERSION_PROPERTY = "beehive.tch.version";
-
- private static String packageName = "package org.apache.beehive.test.tools.tch.core;";
- private static String fileName = "./core/version.java";
-
- public static void main(String[] argv)
- {
- try
- {
- System.out.println("Entered VersionGenerator");
- String build = null;
- String info = null;
-
- String branch = System.getProperty(SRC_PROPERTY);
- String version = System.getProperty(VERSION_PROPERTY);
-
- String javaVersion = System.getProperty("java.version");
-
- build =
- "\\n"
- + "Beehive Tch "
- + version
- + "\\n"
- + new Date()
- + " #"
- + branch
- + " branch"
- + "\\n"
- + "java.version at build-time: "
- + javaVersion +
- "\\n";
-
- File generatedf = new File(fileName);
- System.out.println("Generating file: " + generatedf.getCanonicalPath());
- generatedf.delete();
- PrintWriter pw = new PrintWriter(new FileOutputStream(generatedf));
- pw.println(packageName);
- pw.println("");
- pw.println("public class version {");
- pw.println("");
- pw.println(" public static String VERSION =\"" + build + "\";");
- pw.println("public static void main(String[] argv) {");
- pw.println("System.out.println(VERSION);");
- pw.println("}");
- pw.println("}");
- pw.flush();
- pw.close();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- private static String exec(String cmd) throws IOException
- {
- InputStream is = Runtime.getRuntime().exec(cmd).getInputStream();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buf = new byte[2000];
- for (;;)
- {
- int n = is.read(buf);
- if (n == -1)
- break;
- baos.write(buf, 0, n);
- }
- return new String(baos.toByteArray());
- }
- private static String word(String s, int n)
- {
- StringTokenizer st = new StringTokenizer(s);
- if (!st.hasMoreTokens())
- return "<no change number>";
- for (; n > 0; n--)
- {
- st.nextToken();
- }
- return st.nextToken();
- }
-
- private static String getLocalInfo()
- {
- try
- {
- String localInfo = "";
- String p4Info = exec("p4 info");
- String user = restLine("User name: ", p4Info);
- if (!user.equals("bt") && !user.startsWith("rel"))
- {
- localInfo =
- localInfo
- + "Internal build by "
- + user
- + " on client "
- + restLine("Client name: ", p4Info);
- }
- return localInfo;
- }
- catch (IOException ioe)
- {
- return "(unknown)";
- }
- }
-
- private static String restLine(String key, String s)
- {
- int i = s.indexOf(key);
- return i == -1 ? "" : restLine(s, i + key.length());
- }
-
- private static String restLine(String s, int i)
- {
- int j = s.indexOf('\n', i);
- return (j == -1 ? s.substring(i) : s.substring(i, j)).trim();
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.Date;
+import java.util.StringTokenizer;
+
+import org.apache.beehive.test.tools.tch.util.env.Environment;
+
+/**
+ * Generates the Version class for tch
+ *
+ * @version 1.0, Sept 3, 2001
+ */
+public class VersionGenerator
+{
+
+ private static final String SRC_PROPERTY = "beehive.tch.src";
+ private static final String VERSION_PROPERTY = "beehive.tch.version";
+
+ private static String packageName = "package org.apache.beehive.test.tools.tch.core;";
+ private static String fileName = "./core/version.java";
+
+ public static void main(String[] argv)
+ {
+ try
+ {
+ System.out.println("Entered VersionGenerator");
+ String build = null;
+ String info = null;
+
+ String branch = System.getProperty(SRC_PROPERTY);
+ String version = System.getProperty(VERSION_PROPERTY);
+
+ String javaVersion = System.getProperty("java.version");
+
+ build =
+ "\\n"
+ + "Beehive Tch "
+ + version
+ + "\\n"
+ + new Date()
+ + " #"
+ + branch
+ + " branch"
+ + "\\n"
+ + "java.version at build-time: "
+ + javaVersion +
+ "\\n";
+
+ File generatedf = new File(fileName);
+ System.out.println("Generating file: " + generatedf.getCanonicalPath());
+ generatedf.delete();
+ PrintWriter pw = new PrintWriter(new FileOutputStream(generatedf));
+ pw.println(packageName);
+ pw.println("");
+ pw.println("public class version {");
+ pw.println("");
+ pw.println(" public static String VERSION =\"" + build + "\";");
+ pw.println("public static void main(String[] argv) {");
+ pw.println("System.out.println(VERSION);");
+ pw.println("}");
+ pw.println("}");
+ pw.flush();
+ pw.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static String exec(String cmd) throws IOException
+ {
+ InputStream is = Runtime.getRuntime().exec(cmd).getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buf = new byte[2000];
+ for (;;)
+ {
+ int n = is.read(buf);
+ if (n == -1)
+ break;
+ baos.write(buf, 0, n);
+ }
+ return new String(baos.toByteArray());
+ }
+ private static String word(String s, int n)
+ {
+ StringTokenizer st = new StringTokenizer(s);
+ if (!st.hasMoreTokens())
+ return "<no change number>";
+ for (; n > 0; n--)
+ {
+ st.nextToken();
+ }
+ return st.nextToken();
+ }
+
+ private static String getLocalInfo()
+ {
+ try
+ {
+ String localInfo = "";
+ String p4Info = exec("p4 info");
+ String user = restLine("User name: ", p4Info);
+ if (!user.equals("bt") && !user.startsWith("rel"))
+ {
+ localInfo =
+ localInfo
+ + "Internal build by "
+ + user
+ + " on client "
+ + restLine("Client name: ", p4Info);
+ }
+ return localInfo;
+ }
+ catch (IOException ioe)
+ {
+ return "(unknown)";
+ }
+ }
+
+ private static String restLine(String key, String s)
+ {
+ int i = s.indexOf(key);
+ return i == -1 ? "" : restLine(s, i + key.length());
+ }
+
+ private static String restLine(String s, int i)
+ {
+ int j = s.indexOf('\n', i);
+ return (j == -1 ? s.substring(i) : s.substring(i, j)).trim();
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/VersionGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ant/TchLogTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ant/TchLogTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ant/TchLogTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ant/TchLogTask.java Fri Aug 12 08:12:28 2005
@@ -1,26 +1,26 @@
-package org.apache.beehive.test.tools.tch.core.ant;
-
-import org.apache.beehive.test.tools.tch.core.AnythingTask;
-
-/**
- * Logs an INFORM to Tch's logger.
- */
-public class TchLogTask extends AnythingTask
-{
- private String message = "";
-
- public void setMessage(String s)
- {
- message = handleValue(s);
- }
-
- public boolean run()
- {
- if (super.run())
- {
- inform(message);
- return true;
- }
- return false;
- }
-}
+package org.apache.beehive.test.tools.tch.core.ant;
+
+import org.apache.beehive.test.tools.tch.core.AnythingTask;
+
+/**
+ * Logs an INFORM to Tch's logger.
+ */
+public class TchLogTask extends AnythingTask
+{
+ private String message = "";
+
+ public void setMessage(String s)
+ {
+ message = handleValue(s);
+ }
+
+ public boolean run()
+ {
+ if (super.run())
+ {
+ inform(message);
+ return true;
+ }
+ return false;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ant/TchLogTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractMinimalConfigurationInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractMinimalConfigurationInfo.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractMinimalConfigurationInfo.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractMinimalConfigurationInfo.java Fri Aug 12 08:12:28 2005
@@ -1,29 +1,29 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-import java.util.Map;
-
-import org.apache.tools.ant.BuildException;
-
-import org.apache.beehive.test.tools.tch.core.process.ProcessOverride;
-
-/**
- */
-public abstract class AbstractMinimalConfigurationInfo
- implements MinimalConfigurationInfo
-{
- public AbstractMinimalConfigurationInfo()
- {
- }
-
- public Object cloneWithOverride(ProcessOverride processOverride)
- {
- throw new BuildException("cloneWithOverride unsupported in AbstractMinimalConfigurationInfo");
- }
-
- public Object cloneWithOverride(
- ProcessOverride processOverride,
- Map overrideHandlerMap)
- {
- throw new BuildException("cloneWithOverride unsupported in AbstractMinimalConfigurationInfo");
- }
-}
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+
+import org.apache.beehive.test.tools.tch.core.process.ProcessOverride;
+
+/**
+ */
+public abstract class AbstractMinimalConfigurationInfo
+ implements MinimalConfigurationInfo
+{
+ public AbstractMinimalConfigurationInfo()
+ {
+ }
+
+ public Object cloneWithOverride(ProcessOverride processOverride)
+ {
+ throw new BuildException("cloneWithOverride unsupported in AbstractMinimalConfigurationInfo");
+ }
+
+ public Object cloneWithOverride(
+ ProcessOverride processOverride,
+ Map overrideHandlerMap)
+ {
+ throw new BuildException("cloneWithOverride unsupported in AbstractMinimalConfigurationInfo");
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractMinimalConfigurationInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractUnitConfigurationInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractUnitConfigurationInfo.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractUnitConfigurationInfo.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractUnitConfigurationInfo.java Fri Aug 12 08:12:28 2005
@@ -1,29 +1,29 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-import org.apache.tools.ant.Location;
-
-import org.apache.beehive.test.tools.tch.core.CallingChain;
-
-/**
- */
-public abstract class AbstractUnitConfigurationInfo implements UnitConfigurationInfo
-{
- private Location location = null;
- private CallingChain chain = null;
-
- public AbstractUnitConfigurationInfo(Location inLocation, CallingChain inChain)
- {
- location = inLocation;
- chain = inChain;
- }
-
- public Location getLocation()
- {
- return location;
- }
-
- public CallingChain getCallingChain()
- {
- return chain;
- }
-}
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+import org.apache.tools.ant.Location;
+
+import org.apache.beehive.test.tools.tch.core.CallingChain;
+
+/**
+ */
+public abstract class AbstractUnitConfigurationInfo implements UnitConfigurationInfo
+{
+ private Location location = null;
+ private CallingChain chain = null;
+
+ public AbstractUnitConfigurationInfo(Location inLocation, CallingChain inChain)
+ {
+ location = inLocation;
+ chain = inChain;
+ }
+
+ public Location getLocation()
+ {
+ return location;
+ }
+
+ public CallingChain getCallingChain()
+ {
+ return chain;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractUnitConfigurationInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractXMLHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractXMLHandler.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractXMLHandler.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractXMLHandler.java Fri Aug 12 08:12:28 2005
@@ -1,37 +1,37 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-import org.apache.beehive.test.tools.tch.util.GeneralUtil;
-
-/**
- * Provide convenience methods for parsing/converting strings into various types.
- * Have the logic here to ignore "unresolved" process config values, for which
- * we'll get a validation error post-parsing.
- *
- */
-public abstract class AbstractXMLHandler implements XMLHandler
-{
- protected boolean parseBoolean(String in)
- {
- if (parseValueOk(in))
- {
- return GeneralUtil.parseBoolean(in);
- }
- // default
- return false;
- }
-
- protected int parseInt(String in)
- {
- if (parseValueOk(in))
- {
- return Integer.parseInt(in);
- }
- return -1;
- }
-
- private boolean parseValueOk(String val)
- {
- // if not ok should get validation error for unresolved prop
- return (!val.startsWith("%{"));
- }
-}
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+import org.apache.beehive.test.tools.tch.util.GeneralUtil;
+
+/**
+ * Provide convenience methods for parsing/converting strings into various types.
+ * Have the logic here to ignore "unresolved" process config values, for which
+ * we'll get a validation error post-parsing.
+ *
+ */
+public abstract class AbstractXMLHandler implements XMLHandler
+{
+ protected boolean parseBoolean(String in)
+ {
+ if (parseValueOk(in))
+ {
+ return GeneralUtil.parseBoolean(in);
+ }
+ // default
+ return false;
+ }
+
+ protected int parseInt(String in)
+ {
+ if (parseValueOk(in))
+ {
+ return Integer.parseInt(in);
+ }
+ return -1;
+ }
+
+ private boolean parseValueOk(String val)
+ {
+ // if not ok should get validation error for unresolved prop
+ return (!val.startsWith("%{"));
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/AbstractXMLHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ElementConstants.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ElementConstants.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ElementConstants.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ElementConstants.java Fri Aug 12 08:12:28 2005
@@ -1,63 +1,63 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-public interface ElementConstants
-{
-
- //config-root element
- public static final String CONFIG_ROOT_ELEMENT = "config-root";
-
- //machine element
- public static final String MACHINE_CONFIG_ROOT_ELEMENT = "machine-config";
- public static final String MACHINE_ELEMENT = "machine";
- public static final String MACHINE_NAME_ATTR = "name";
- public static final String MACHINE_HOST_ATTR = "host";
-
- //process element
- //all of the following elements are contained within the process element
- public static final String PROCESS_CONFIG_ROOT_ELEMENT = "process-config";
-
- //configured process type element (block)
- public static final String CONFIGURED_PROCESS_TYPE_ELEMENT =
- "configured-process-type";
- public static final String CONFIGURED_PROCESS_TYPE_NAME_ATTR = "name";
- public static final String CONFIGURED_PROCESS_TYPE_PROCESS_TYPE_ATTR =
- "process-type";
- public static final String CONFIGURED_PROCESS_TYPE_ENV_ATTR = "env";
- public static final String CONFIGURED_PROCESS_TYPE_CONFIGURATION_ATTR =
- "configuration";
-
- //exec process config element (block)
- //FIXME: these element names are hardcoded for now. figure out
- //a process for dealing with dynamic element names
-
- public static final String LISTENER_PROCESS_CONFIG_ELEMENT =
- "listener-process-config";
- public static final String TCH_AGENT_PROCESS_CONFIG_ELEMENT =
- "tch-agent-process-config";
- public static final String LISTENER_PROCESS_CONFIG_NAME_ATTR = "name";
- public static final String LISTENER_PROCESS_CONFIG_PORT_ATTR = "port";
- public static final String LISTENER_PROCESS_CONFIG_BINDNAME_ATTR = "bindname";
- public static final String LISTENER_PROCESS_CONFIG_JAVAOPTS_ATTR = "javaopts";
- public static final String LISTENER_PROCESS_CONFIG_PROPERTY_ELEMENT = "property";
- public static final String LISTENER_PROCESS_CONFIG_PROPERTY_ELEMENT_NAME_ATTR =
- "name";
- public static final String LISTENER_PROCESS_CONFIG_PROPERTY_ELEMENT_VALUE_ATTR =
- "value";
- public static final String LISTENER_PROCESS_CONFIG_STARTUP_TIMEOUT_ATTR =
- "startup-timeout";
-
-
- //process element
- public static final String PROCESS_ELEMENT = "process";
- public static final String PROCESS_NAME_ATTR = "name";
- public static final String PROCESS_MACHINE_ATTR = "machine";
- public static final String PROCESS_IMPLICIT_ATTR = "implicit";
- public static final String PROCESS_AUTOSTART_ATTR = "auto-start";
- public static final String PROCESS_WINDOW_ATTR = "window";
- public static final String PROCESS_HOME_ATTR = "home";
- public static final String PROCESS_JAVA_HOME_ATTR = "java-home";
- public static final String PROCESS_CONFIGURED_PROCESS_TYPE_ATTR =
- "configured-process-type";
- public static final String PROCESS_NESTED_PROCESS_ELEMENT = "nested-process";
- public static final String PROCESS_NESTED_PROCESS_NAME_ATTR = "name";
-}
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+public interface ElementConstants
+{
+
+ //config-root element
+ public static final String CONFIG_ROOT_ELEMENT = "config-root";
+
+ //machine element
+ public static final String MACHINE_CONFIG_ROOT_ELEMENT = "machine-config";
+ public static final String MACHINE_ELEMENT = "machine";
+ public static final String MACHINE_NAME_ATTR = "name";
+ public static final String MACHINE_HOST_ATTR = "host";
+
+ //process element
+ //all of the following elements are contained within the process element
+ public static final String PROCESS_CONFIG_ROOT_ELEMENT = "process-config";
+
+ //configured process type element (block)
+ public static final String CONFIGURED_PROCESS_TYPE_ELEMENT =
+ "configured-process-type";
+ public static final String CONFIGURED_PROCESS_TYPE_NAME_ATTR = "name";
+ public static final String CONFIGURED_PROCESS_TYPE_PROCESS_TYPE_ATTR =
+ "process-type";
+ public static final String CONFIGURED_PROCESS_TYPE_ENV_ATTR = "env";
+ public static final String CONFIGURED_PROCESS_TYPE_CONFIGURATION_ATTR =
+ "configuration";
+
+ //exec process config element (block)
+ //FIXME: these element names are hardcoded for now. figure out
+ //a process for dealing with dynamic element names
+
+ public static final String LISTENER_PROCESS_CONFIG_ELEMENT =
+ "listener-process-config";
+ public static final String TCH_AGENT_PROCESS_CONFIG_ELEMENT =
+ "tch-agent-process-config";
+ public static final String LISTENER_PROCESS_CONFIG_NAME_ATTR = "name";
+ public static final String LISTENER_PROCESS_CONFIG_PORT_ATTR = "port";
+ public static final String LISTENER_PROCESS_CONFIG_BINDNAME_ATTR = "bindname";
+ public static final String LISTENER_PROCESS_CONFIG_JAVAOPTS_ATTR = "javaopts";
+ public static final String LISTENER_PROCESS_CONFIG_PROPERTY_ELEMENT = "property";
+ public static final String LISTENER_PROCESS_CONFIG_PROPERTY_ELEMENT_NAME_ATTR =
+ "name";
+ public static final String LISTENER_PROCESS_CONFIG_PROPERTY_ELEMENT_VALUE_ATTR =
+ "value";
+ public static final String LISTENER_PROCESS_CONFIG_STARTUP_TIMEOUT_ATTR =
+ "startup-timeout";
+
+
+ //process element
+ public static final String PROCESS_ELEMENT = "process";
+ public static final String PROCESS_NAME_ATTR = "name";
+ public static final String PROCESS_MACHINE_ATTR = "machine";
+ public static final String PROCESS_IMPLICIT_ATTR = "implicit";
+ public static final String PROCESS_AUTOSTART_ATTR = "auto-start";
+ public static final String PROCESS_WINDOW_ATTR = "window";
+ public static final String PROCESS_HOME_ATTR = "home";
+ public static final String PROCESS_JAVA_HOME_ATTR = "java-home";
+ public static final String PROCESS_CONFIGURED_PROCESS_TYPE_ATTR =
+ "configured-process-type";
+ public static final String PROCESS_NESTED_PROCESS_ELEMENT = "nested-process";
+ public static final String PROCESS_NESTED_PROCESS_NAME_ATTR = "name";
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ElementConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageConstants.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageConstants.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageConstants.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageConstants.java Fri Aug 12 08:12:28 2005
@@ -1,18 +1,18 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-public interface ErrorMessageConstants
-{
- public static final int NO_TESTS_FOUND_ERROR_CODE = 140;
-
- public static final int PROCESS_MANAGEMENT_ERROR_CODE = 800;
- public static final int FATAL_PROCESS_MANAGEMENT_ERROR_CODE = 801;
- public static final String MESSAGE = "message";
-}
-
-
-
-
-
-
-
-
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+public interface ErrorMessageConstants
+{
+ public static final int NO_TESTS_FOUND_ERROR_CODE = 140;
+
+ public static final int PROCESS_MANAGEMENT_ERROR_CODE = 800;
+ public static final int FATAL_PROCESS_MANAGEMENT_ERROR_CODE = 801;
+ public static final String MESSAGE = "message";
+}
+
+
+
+
+
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageStore.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageStore.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageStore.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageStore.java Fri Aug 12 08:12:28 2005
@@ -1,167 +1,167 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.Reader;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.InputSource;
-
-import org.apache.beehive.test.tools.tch.core.AntProperties;
-import org.apache.beehive.test.tools.tch.core.text.MessageFormatFactory;
-import org.apache.beehive.test.tools.tch.util.GeneralUtil;
-import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
-
-/**
- * Right now, this class creates MessageFormats, and stores other metadata, retrievable given a String key
- */
-
-public class ErrorMessageStore
-{
- private static ErrorMessageStore instance = new ErrorMessageStore();
-
- private static final String ERROR_KEY_PREFIX = "error-";
- private static final String ID_ATT = "id";
- private static final String GLOBAL_ATT = "global";
- private static final String FATAL_ATT = "fatal";
- private static final String SHORT_MESSAGE_TYPE = "short-message";
-
- //we always know about sep = System.getProperty("line.separator");
- private static final String SEP_NAME = "sep";
- private static final String SEP_VALUE = System.getProperty("line.separator");
- private static final Map sepMap = new HashMap();
- static
- {
- sepMap.put(SEP_NAME, SEP_VALUE);
- }
-
- private MessageFormatFactory messageFact = new MessageFormatFactory();
-
- private Collection fatalSet = new HashSet();
- private Collection globalSet = new HashSet();
-
- public static ErrorMessageStore getInstance()
- {
- return instance;
- }
-
- public String formatMessage(int errorID,
- String paramName,
- String paramValue)
- {
- Map m = new HashMap(1);
- m.put(paramName, paramValue);
- return messageFact.formatMessage(getErrorKey(errorID),m);
- }
-
- public String formatMessage(int errorID)
- {
- return messageFact.formatMessage(getErrorKey(errorID));
- }
-
- /**
- * Take a Map of (String -> String), for param name/value to subst into the message
- */
-
- public String formatMessage(int errorID, Map params)
- {
- Map m = new HashMap(params);
- m.putAll(sepMap);
- return messageFact.formatMessage(getErrorKey(errorID),m);
- }
-
- public boolean isFatal(int errorID)
- {
- return fatalSet.contains(getErrorKey(errorID));
- }
-
- public boolean isGlobal(int errorID)
- {
- return globalSet.contains(getErrorKey(errorID));
- }
-
- public void populate()
- {
- //DOM code to get data out and create MessageFormats
- Document doc = getDocument(AntProperties.getValidationErrorMetadataFile());
- Element root = doc.getDocumentElement();
- NodeList nl = root.getChildNodes();
- for(int i=0; i<nl.getLength(); i++)
- {
- Node node = nl.item(i);
- if(node instanceof Element)
- {
- Element errorElem = (Element)node;
- int errorID = Integer.parseInt(errorElem.getAttribute(ID_ATT));
-
- String globalString = errorElem.getAttribute(GLOBAL_ATT);
- if(!"".equals(globalString) && GeneralUtil.parseBoolean(globalString))
- globalSet.add(getErrorKey(errorID));
-
- String fatalString = errorElem.getAttribute(FATAL_ATT);
- if(!"".equals(fatalString) && GeneralUtil.parseBoolean(fatalString))
- fatalSet.add(getErrorKey(errorID));
-
- String shortMessage = "";
-
- NodeList nl2 = errorElem.getChildNodes();
- for(int j=0; j<nl2.getLength(); j++)
- {
- Node node2 = nl2.item(j);
- if(node2 instanceof Element)
- {
- Element nestedElem = (Element)node2;
- if(nestedElem.getTagName().equals(SHORT_MESSAGE_TYPE))
- {
- NodeList nl3 = nestedElem.getChildNodes();
- for(int k=nl3.getLength(); k >= 0; k--)
- {
- if (nl3.item(k) instanceof Text)
- {
- shortMessage = nl3.item(k).getNodeValue();
- break;
- }
- }
- }
- }
- }
- messageFact.addEntry(getErrorKey(errorID),shortMessage);
- }
- }
- }
-
- private Object getErrorKey(int errorID)
- {
- return ERROR_KEY_PREFIX+errorID;
- }
-
- private Document getDocument(File file)
- {
- try
- {
- Reader reader = new FileReader(file);
- 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(reader));
- }
- catch(Exception ex)
- {
- throw new NestedRuntimeException(ex);
- }
- }
-}
-
-
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.InputSource;
+
+import org.apache.beehive.test.tools.tch.core.AntProperties;
+import org.apache.beehive.test.tools.tch.core.text.MessageFormatFactory;
+import org.apache.beehive.test.tools.tch.util.GeneralUtil;
+import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
+
+/**
+ * Right now, this class creates MessageFormats, and stores other metadata, retrievable given a String key
+ */
+
+public class ErrorMessageStore
+{
+ private static ErrorMessageStore instance = new ErrorMessageStore();
+
+ private static final String ERROR_KEY_PREFIX = "error-";
+ private static final String ID_ATT = "id";
+ private static final String GLOBAL_ATT = "global";
+ private static final String FATAL_ATT = "fatal";
+ private static final String SHORT_MESSAGE_TYPE = "short-message";
+
+ //we always know about sep = System.getProperty("line.separator");
+ private static final String SEP_NAME = "sep";
+ private static final String SEP_VALUE = System.getProperty("line.separator");
+ private static final Map sepMap = new HashMap();
+ static
+ {
+ sepMap.put(SEP_NAME, SEP_VALUE);
+ }
+
+ private MessageFormatFactory messageFact = new MessageFormatFactory();
+
+ private Collection fatalSet = new HashSet();
+ private Collection globalSet = new HashSet();
+
+ public static ErrorMessageStore getInstance()
+ {
+ return instance;
+ }
+
+ public String formatMessage(int errorID,
+ String paramName,
+ String paramValue)
+ {
+ Map m = new HashMap(1);
+ m.put(paramName, paramValue);
+ return messageFact.formatMessage(getErrorKey(errorID),m);
+ }
+
+ public String formatMessage(int errorID)
+ {
+ return messageFact.formatMessage(getErrorKey(errorID));
+ }
+
+ /**
+ * Take a Map of (String -> String), for param name/value to subst into the message
+ */
+
+ public String formatMessage(int errorID, Map params)
+ {
+ Map m = new HashMap(params);
+ m.putAll(sepMap);
+ return messageFact.formatMessage(getErrorKey(errorID),m);
+ }
+
+ public boolean isFatal(int errorID)
+ {
+ return fatalSet.contains(getErrorKey(errorID));
+ }
+
+ public boolean isGlobal(int errorID)
+ {
+ return globalSet.contains(getErrorKey(errorID));
+ }
+
+ public void populate()
+ {
+ //DOM code to get data out and create MessageFormats
+ Document doc = getDocument(AntProperties.getValidationErrorMetadataFile());
+ Element root = doc.getDocumentElement();
+ NodeList nl = root.getChildNodes();
+ for(int i=0; i<nl.getLength(); i++)
+ {
+ Node node = nl.item(i);
+ if(node instanceof Element)
+ {
+ Element errorElem = (Element)node;
+ int errorID = Integer.parseInt(errorElem.getAttribute(ID_ATT));
+
+ String globalString = errorElem.getAttribute(GLOBAL_ATT);
+ if(!"".equals(globalString) && GeneralUtil.parseBoolean(globalString))
+ globalSet.add(getErrorKey(errorID));
+
+ String fatalString = errorElem.getAttribute(FATAL_ATT);
+ if(!"".equals(fatalString) && GeneralUtil.parseBoolean(fatalString))
+ fatalSet.add(getErrorKey(errorID));
+
+ String shortMessage = "";
+
+ NodeList nl2 = errorElem.getChildNodes();
+ for(int j=0; j<nl2.getLength(); j++)
+ {
+ Node node2 = nl2.item(j);
+ if(node2 instanceof Element)
+ {
+ Element nestedElem = (Element)node2;
+ if(nestedElem.getTagName().equals(SHORT_MESSAGE_TYPE))
+ {
+ NodeList nl3 = nestedElem.getChildNodes();
+ for(int k=nl3.getLength(); k >= 0; k--)
+ {
+ if (nl3.item(k) instanceof Text)
+ {
+ shortMessage = nl3.item(k).getNodeValue();
+ break;
+ }
+ }
+ }
+ }
+ }
+ messageFact.addEntry(getErrorKey(errorID),shortMessage);
+ }
+ }
+ }
+
+ private Object getErrorKey(int errorID)
+ {
+ return ERROR_KEY_PREFIX+errorID;
+ }
+
+ private Document getDocument(File file)
+ {
+ try
+ {
+ Reader reader = new FileReader(file);
+ 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(reader));
+ }
+ catch(Exception ex)
+ {
+ throw new NestedRuntimeException(ex);
+ }
+ }
+}
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/ErrorMessageStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/FinalValidationCheckTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/FinalValidationCheckTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/FinalValidationCheckTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/FinalValidationCheckTask.java Fri Aug 12 08:12:28 2005
@@ -1,106 +1,106 @@
-package org.apache.beehive.test.tools.tch.core.configuration;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.condition.IsFalse;
-
-import org.apache.beehive.test.tools.tch.core.AntProperties;
-import org.apache.beehive.test.tools.tch.core.BaseTask;
-import org.apache.beehive.test.tools.tch.core.test.TestRegistry;
-import org.apache.beehive.test.tools.tch.text.Messages;
-
-public class FinalValidationCheckTask extends BaseTask
-{
- // This task runs more than once - if this is set to true,
- // we check for fatal errors, which prevent us from
- // continuing
- // this is set from tch-root.xml
- private boolean checkForFatalOnly = false;
-
- // the global instance that has all validation errors
- private NonfatalValidationAggregate globalInstanceNVA =
- NonfatalValidationAggregate.getGlobalInstance();
-
- // test registry
- private TestRegistry testReg = TestRegistry.getRegistry();
-
- public void execute()
- {
- // if isValidationFailed() == true, it means this task was already run previously
- // and had a failure, so don't run again.
- if (AntProperties.isValidationFailed())
- return;
-
- // if we don't have any tests to run, log a fatal validation error
- checkForZeroTests();
-
- // if we have fatal validation errors, log them and give up
- // (also logs other validation errors as a side effect, but
- // that's ok, since the fatal once keep us from proceeding)
- if (globalInstanceNVA.hasFatalValidationErrors())
- {
- failBuildIfValidationErrors(globalInstanceNVA);
- if (AntProperties.isValidationFailed())
- return;
- }
-
- // if we only care about checking final validation errors, stop here
- if (checkFatalErrorsOnly())
- return;
- if (AntProperties.isInitModeOnly()
- || AntProperties.isFailfastValidationOn())
- {
- if (AntProperties.isIndividualTestModeOn())
- {
- // get validation errors only for the tests we are going to run
- failBuildIfValidationErrors(
- testReg.getValidationErrorsForAllTestsConfiguredToRun());
- }
- else
- {
- // report all validation errors we have
- failBuildIfValidationErrors(globalInstanceNVA);
- }
- }
- }
-
- public void setCheckFatalOnly(boolean in)
- {
- checkForFatalOnly = in;
- }
-
- private void checkForZeroTests()
- {
- if (testReg.getExpectedNumTests() == 0)
- InvalidationManager.addFatalInvalidation(
- new NonfatalValidationException(
- ErrorMessageConstants.NO_TESTS_FOUND_ERROR_CODE));
- }
-
- private boolean checkFatalErrorsOnly()
- {
- return checkForFatalOnly;
- }
-
- private void failBuildIfValidationErrors(NonfatalValidationAggregate nva)
- {
- if (!nva.hasExceptions())
- return;
-
- log(nva.getMessage(true));
-
- if (AntProperties.failBuild())
- throw new BuildException("Validation errors terminated the run.");
- // this will make the run stop, but not fail the build (which stupid Ant interprets as need to do a System.exit
- else
- {
- getProject().setProperty(
- "tch.internal.init-mode-only-enabled",
- "true");
- AntProperties.setValidationFailed(true);
- //so the message task won't run
- AntProperties.setInitModeOnly(true);
- //so all the other tasks/targets won't run
- log(Messages.BAD_RUN_MESSAGE);
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core.configuration;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.IsFalse;
+
+import org.apache.beehive.test.tools.tch.core.AntProperties;
+import org.apache.beehive.test.tools.tch.core.BaseTask;
+import org.apache.beehive.test.tools.tch.core.test.TestRegistry;
+import org.apache.beehive.test.tools.tch.text.Messages;
+
+public class FinalValidationCheckTask extends BaseTask
+{
+ // This task runs more than once - if this is set to true,
+ // we check for fatal errors, which prevent us from
+ // continuing
+ // this is set from tch-root.xml
+ private boolean checkForFatalOnly = false;
+
+ // the global instance that has all validation errors
+ private NonfatalValidationAggregate globalInstanceNVA =
+ NonfatalValidationAggregate.getGlobalInstance();
+
+ // test registry
+ private TestRegistry testReg = TestRegistry.getRegistry();
+
+ public void execute()
+ {
+ // if isValidationFailed() == true, it means this task was already run previously
+ // and had a failure, so don't run again.
+ if (AntProperties.isValidationFailed())
+ return;
+
+ // if we don't have any tests to run, log a fatal validation error
+ checkForZeroTests();
+
+ // if we have fatal validation errors, log them and give up
+ // (also logs other validation errors as a side effect, but
+ // that's ok, since the fatal once keep us from proceeding)
+ if (globalInstanceNVA.hasFatalValidationErrors())
+ {
+ failBuildIfValidationErrors(globalInstanceNVA);
+ if (AntProperties.isValidationFailed())
+ return;
+ }
+
+ // if we only care about checking final validation errors, stop here
+ if (checkFatalErrorsOnly())
+ return;
+ if (AntProperties.isInitModeOnly()
+ || AntProperties.isFailfastValidationOn())
+ {
+ if (AntProperties.isIndividualTestModeOn())
+ {
+ // get validation errors only for the tests we are going to run
+ failBuildIfValidationErrors(
+ testReg.getValidationErrorsForAllTestsConfiguredToRun());
+ }
+ else
+ {
+ // report all validation errors we have
+ failBuildIfValidationErrors(globalInstanceNVA);
+ }
+ }
+ }
+
+ public void setCheckFatalOnly(boolean in)
+ {
+ checkForFatalOnly = in;
+ }
+
+ private void checkForZeroTests()
+ {
+ if (testReg.getExpectedNumTests() == 0)
+ InvalidationManager.addFatalInvalidation(
+ new NonfatalValidationException(
+ ErrorMessageConstants.NO_TESTS_FOUND_ERROR_CODE));
+ }
+
+ private boolean checkFatalErrorsOnly()
+ {
+ return checkForFatalOnly;
+ }
+
+ private void failBuildIfValidationErrors(NonfatalValidationAggregate nva)
+ {
+ if (!nva.hasExceptions())
+ return;
+
+ log(nva.getMessage(true));
+
+ if (AntProperties.failBuild())
+ throw new BuildException("Validation errors terminated the run.");
+ // this will make the run stop, but not fail the build (which stupid Ant interprets as need to do a System.exit
+ else
+ {
+ getProject().setProperty(
+ "tch.internal.init-mode-only-enabled",
+ "true");
+ AntProperties.setValidationFailed(true);
+ //so the message task won't run
+ AntProperties.setInitModeOnly(true);
+ //so all the other tasks/targets won't run
+ log(Messages.BAD_RUN_MESSAGE);
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/configuration/FinalValidationCheckTask.java
------------------------------------------------------------------------------
svn:eol-style = native