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 [53/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...
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/PropertyReferencer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ReferenceCheckTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ReferenceCheckTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ReferenceCheckTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ReferenceCheckTask.java Fri Aug 12 08:12:28 2005
@@ -1,419 +1,419 @@
-/*
- * Created on Jul 10, 2003
- *
- * Check for invalid requiresRun and requiresSuccess
- * references.
- */
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.tools.ant.Task;
-
-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.core.test.TestRegistry;
-import org.apache.beehive.test.tools.tch.logger.Logger;
-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.TchUtils;
-import org.apache.beehive.test.tools.tch.util.TestResult;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-
-/**
- *
- * Checks whether all requiresRun and requiresSuccess references are legal
- * and that there are no cyclical dependancies
- */
-public class ReferenceCheckTask extends BaseTwoPassTask
-{
- private NonfatalValidationAggregate nva = new NonfatalValidationAggregate();
-
- private static TestRegistry testRegistry = TestRegistry.getRegistry();
-
- private void addDependencies(
- LogicalTest currTest,
- DependencyChecker dependencyChecker)
- {
- // add self
- String taskName = currTest.getName();
- EntryPoint currEntryPoint = currTest.getEntryPoint();
- if (!dependencyChecker.addEntry(taskName))
- {
- // already added so short-circuit
- return;
- }
- String[] requiresRun = currTest.getRequiresRun();
- String[] requiresSuccess = currTest.getRequiresSuccess();
- int rr_len = (requiresRun == null) ? 0 : requiresRun.length;
- int rs_len = (requiresSuccess == null) ? 0 : requiresSuccess.length;
- String[] requiresArray = new String[rr_len + rs_len];
-
- int i = 0;
- for (i = 0; i < rr_len; ++i)
- {
- requiresArray[i] = requiresRun[i];
- }
- for (int j = 0; j < rs_len; ++j)
- {
- requiresArray[i + j] = requiresSuccess[j];
- }
-
- for (i = 0; i < requiresArray.length; ++i)
- {
- // first add just the required test (even if it doesn't exist since validation will
- // be done later
- dependencyChecker.addDependency(taskName, requiresArray[i]);
- // Add all tests in the same entry point as the requires tests.
- // However, if the source and target of the dependency are both in the same
- // entry point, do not do this!
- LogicalTest requireTest = testRegistry.getLogicalTest(requiresArray[i]);
- if (requireTest != null)
- {
- // requireTest may be null if user specifies non-existent test as a requires attribute
- EntryPoint entryPoint = requireTest.getEntryPoint();
- if (currEntryPoint != entryPoint)
- {
- Collection containedTests = entryPoint.getContainedLogicalTests();
- Iterator iter = containedTests.iterator();
- while (iter.hasNext())
- {
- LogicalTest sameEntryPointTest = (LogicalTest)iter.next();
- // Just add the test name as a dependency
- // in case the source and target of the requires is in the same
- // entry point, don't add a dependency to itself
- dependencyChecker.addDependency(
- taskName,
- sameEntryPointTest.getName());
- // recursively call this on each logical test in the requires
- addDependencies(sameEntryPointTest, dependencyChecker);
- }
- }
- }
- }
- }
-
- public boolean alwaysDo()
- {
- LogicalTest currTest = null;
- DependencyChecker depedencyChecker = new DependencyChecker();
-
- Collection testEntries = testRegistry.getAllLogicalTestEntries();
- DependencyChecker dependencyChecker = new DependencyChecker();
- // iterate through all test entries
- TestRegistry.Entry currEntry = null;
- Iterator iter = testEntries.iterator();
- while (iter.hasNext())
- {
- currEntry = (TestRegistry.Entry)iter.next();
- currTest = currEntry.getLogicalTest();
- addDependencies(currTest, dependencyChecker);
- }
-
- // find all references that do not exist
- Set badReferences = dependencyChecker.getBadReferences();
- if (badReferences.size() > 0)
- {
- TestReference reference = null;
- Iterator refiter = badReferences.iterator();
- while (refiter.hasNext())
- {
- reference = (TestReference)refiter.next();
- LogicalTest logicalTest =
- testRegistry.getLogicalTest(reference.getSource());
- Map params = new HashMap(1);
- params.put(
- ErrorMessageConstants.REFERENCE,
- "(" + reference.getSource() + " -> " + reference.getTarget() + ")");
- NonfatalValidationException ex =
- new NonfatalValidationException(
- ErrorMessageConstants.MISSING_REQUIRES_REFERENCE,
- params);
- logicalTest.invalidate(ex);
- }
- }
-
- // find all references to tests which are not in the same test-suite
- badReferences = dependencyChecker.getNonTestsuiteReferences();
- if (badReferences.size() > 0)
- {
- TestReference reference = null;
-
- Iterator refiter = badReferences.iterator();
- while (refiter.hasNext())
- {
- reference = (TestReference)refiter.next();
- // For references outside the current test-suite, we want to report the location of
- // the bad target as well, so get both the source and target logical tests here
- LogicalTest sourceLogicalTest =
- testRegistry.getLogicalTest(reference.getSource());
- LogicalTest targetLogicalTest =
- testRegistry.getLogicalTest(reference.getTarget());
- Map params = new HashMap(1);
- params.put(
- ErrorMessageConstants.REFERENCE,
- reference.getSource()
- + " -> "
- + reference.getTarget()
- + " ("
- + targetLogicalTest.getLocation()
- + ")");
- NonfatalValidationException ex =
- new NonfatalValidationException(
- ErrorMessageConstants.NON_TESTSUITE_REQUIRES_REFERENCE,
- params);
- sourceLogicalTest.invalidate(ex);
- }
- }
-
- // find all cyclical references
- badReferences = dependencyChecker.getCyclicalReferences();
- if (badReferences.size() > 0)
- {
- TestReference reference = null;
-
- Iterator refiter = badReferences.iterator();
- while (refiter.hasNext())
- {
- reference = (TestReference)refiter.next();
- LogicalTest logicalTest =
- testRegistry.getLogicalTest(reference.getSource());
- Map params = new HashMap(1);
- params.put(
- ErrorMessageConstants.REFERENCE,
- "(" + reference.getSource() + " -> " + reference.getTarget() + ")");
- NonfatalValidationException ex =
- new NonfatalValidationException(
- ErrorMessageConstants.CYCLICAL_REQUIRES_REFERENCE,
- params);
- logicalTest.invalidate(ex);
- }
- }
- return true;
- }
-
- /*
- * iternal utility class used for checking dependencies
- * Note: The dependency checking methods must be called in the
- * following order:
- * 1. getBadReferences
- * 2. getNonTestunitReferences
- * 3. getCyclicalReferences
- * The getters will actually change the state of the underlying data structure, so
- * this is the order that must be used to insure that the proper checks are made.
- */
- class DependencyChecker
- {
- // String->Collection. The key is the source, the value is a
- // Collection of targets
- HashMap dependencyMap;
-
- public DependencyChecker()
- {
- dependencyMap = new HashMap();
- }
- // return true if entry added. Return false if entry already existed
- public boolean addEntry(String entry)
- {
- if (dependencyMap.get(entry) == null)
- {
- dependencyMap.put(entry, new HashSet());
- return true;
- }
- else
- {
- return false;
- }
- }
- public void addDependency(String source, String target)
- {
- HashSet currentTargets = (HashSet)dependencyMap.get(source);
- if (currentTargets == null)
- {
- HashSet newTargetSet = new HashSet();
- newTargetSet.add(target);
- dependencyMap.put(source, newTargetSet);
- }
- else
- {
- currentTargets.add(target);
- }
- }
-
- public void removeDependency(String source, String target)
- {
- Set targetSet = ((Set)dependencyMap.get(source));
- targetSet.remove(target);
- return;
- }
-
- private Set getTargets(String source)
- {
- return ((Set)dependencyMap.get(source));
- }
-
- private Set getSources(String target)
- {
- Set sourceDependants = new HashSet();
- Set keySet = dependencyMap.keySet();
- Iterator iter = keySet.iterator();
- while (iter.hasNext())
- {
- String sourceName = (String)iter.next();
- Set referenceSet = (Set)dependencyMap.get(sourceName);
- if (referenceSet.contains(target))
- {
- sourceDependants.add(sourceName);
- }
- }
- return sourceDependants;
- }
-
- /*
- * Remove one reference which will not effect cyclical dependency checks
- * true indicates a reference can and was removed
- * false indicates that a reference could not be removed either because there
- * are no references left or there are only cyclical dependencies left.
- */
- public boolean removeOneReference()
- {
- // first find terminal nodes (nodes which have no requires clause)
- Set keySet = dependencyMap.keySet();
- Iterator iter = keySet.iterator();
- while (iter.hasNext())
- {
- Set targetSet = null;
- String name = (String)iter.next();
- targetSet = getTargets(name);
- if ((targetSet == null) || (targetSet.size() == 0))
- {
- // terminal node
- // remove source dependencies
- Set sourceSet = getSources(name);
- String[] dependArray = (String[])sourceSet.toArray(new String[0]);
- for (int i = 0; i < dependArray.length; ++i)
- {
- removeDependency(dependArray[i], name);
- return true;
- }
- }
- }
- return false;
- }
-
- /*
- * Gets the set of all missing dependencies.
- * Removes the bad ones as well.
- */
- public Set getBadReferences()
- {
- Set badRefSet = new HashSet();
- Set keySet = dependencyMap.keySet();
- Iterator keyIter = keySet.iterator();
- while (keyIter.hasNext())
- {
- String keyVal = (String)keyIter.next();
- Set referenceSet = (Set)dependencyMap.get(keyVal);
- Iterator refIter = referenceSet.iterator();
- while (refIter.hasNext())
- {
- String reference = (String)refIter.next();
- if (!dependencyMap.containsKey(reference))
- {
- removeDependency(keyVal, reference);
- badRefSet.add(new TestReference(keyVal, reference));
- }
- }
- }
- return badRefSet;
- }
-
- /*
- * Gets the set of all non-test-suite references
- * Removes these as well
- */
- public Set getNonTestsuiteReferences()
- {
- Set badRefSet = new HashSet();
- Set keySet = dependencyMap.keySet();
- Iterator keyIter = keySet.iterator();
- while (keyIter.hasNext())
- {
- String keyVal = (String)keyIter.next();
- Set referenceSet = (Set)dependencyMap.get(keyVal);
- Iterator refIter = referenceSet.iterator();
- LogicalTest sourceTest = testRegistry.getLogicalTest(keyVal);
- while (refIter.hasNext())
- {
- String reference = (String)refIter.next();
- LogicalTest targetTest = testRegistry.getLogicalTest(reference);
- if (!TchUtils.sameSuite(sourceTest, targetTest))
- {
- removeDependency(keyVal, reference);
- badRefSet.add(new TestReference(keyVal, reference));
- }
- }
- }
- return badRefSet;
- }
-
- /*
- * Gets the set of all cyclical dependencies. This call will alter the
- * data structure, so should only be called once.
- */
- public Set getCyclicalReferences()
- {
- boolean done = false;
- while (removeOneReference())
- {
- }
-
- Set cyclicalReferenceSet = new HashSet();
- Set keySet = dependencyMap.keySet();
- Iterator iter = keySet.iterator();
- while (iter.hasNext())
- {
- String key = (String)iter.next();
- Set targetSet = (Set)dependencyMap.get(key);
- if (targetSet.size() > 0)
- {
- String[] targetArray = (String[])targetSet.toArray(new String[0]);
- for (int i = 0; i < targetArray.length; ++i)
- {
- cyclicalReferenceSet.add(new TestReference(key, targetArray[i]));
- }
- }
- }
-
- // return all entries that still have references
- return cyclicalReferenceSet;
- }
- }
-
- class TestReference
- {
- public String source;
- public String target;
-
- public TestReference(String inSource, String inTarget)
- {
- source = inSource;
- target = inTarget;
- }
- public String getSource()
- {
- return source;
- }
- public String getTarget()
- {
- return target;
- }
- }
-}
+/*
+ * Created on Jul 10, 2003
+ *
+ * Check for invalid requiresRun and requiresSuccess
+ * references.
+ */
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.tools.ant.Task;
+
+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.core.test.TestRegistry;
+import org.apache.beehive.test.tools.tch.logger.Logger;
+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.TchUtils;
+import org.apache.beehive.test.tools.tch.util.TestResult;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+
+/**
+ *
+ * Checks whether all requiresRun and requiresSuccess references are legal
+ * and that there are no cyclical dependancies
+ */
+public class ReferenceCheckTask extends BaseTwoPassTask
+{
+ private NonfatalValidationAggregate nva = new NonfatalValidationAggregate();
+
+ private static TestRegistry testRegistry = TestRegistry.getRegistry();
+
+ private void addDependencies(
+ LogicalTest currTest,
+ DependencyChecker dependencyChecker)
+ {
+ // add self
+ String taskName = currTest.getName();
+ EntryPoint currEntryPoint = currTest.getEntryPoint();
+ if (!dependencyChecker.addEntry(taskName))
+ {
+ // already added so short-circuit
+ return;
+ }
+ String[] requiresRun = currTest.getRequiresRun();
+ String[] requiresSuccess = currTest.getRequiresSuccess();
+ int rr_len = (requiresRun == null) ? 0 : requiresRun.length;
+ int rs_len = (requiresSuccess == null) ? 0 : requiresSuccess.length;
+ String[] requiresArray = new String[rr_len + rs_len];
+
+ int i = 0;
+ for (i = 0; i < rr_len; ++i)
+ {
+ requiresArray[i] = requiresRun[i];
+ }
+ for (int j = 0; j < rs_len; ++j)
+ {
+ requiresArray[i + j] = requiresSuccess[j];
+ }
+
+ for (i = 0; i < requiresArray.length; ++i)
+ {
+ // first add just the required test (even if it doesn't exist since validation will
+ // be done later
+ dependencyChecker.addDependency(taskName, requiresArray[i]);
+ // Add all tests in the same entry point as the requires tests.
+ // However, if the source and target of the dependency are both in the same
+ // entry point, do not do this!
+ LogicalTest requireTest = testRegistry.getLogicalTest(requiresArray[i]);
+ if (requireTest != null)
+ {
+ // requireTest may be null if user specifies non-existent test as a requires attribute
+ EntryPoint entryPoint = requireTest.getEntryPoint();
+ if (currEntryPoint != entryPoint)
+ {
+ Collection containedTests = entryPoint.getContainedLogicalTests();
+ Iterator iter = containedTests.iterator();
+ while (iter.hasNext())
+ {
+ LogicalTest sameEntryPointTest = (LogicalTest)iter.next();
+ // Just add the test name as a dependency
+ // in case the source and target of the requires is in the same
+ // entry point, don't add a dependency to itself
+ dependencyChecker.addDependency(
+ taskName,
+ sameEntryPointTest.getName());
+ // recursively call this on each logical test in the requires
+ addDependencies(sameEntryPointTest, dependencyChecker);
+ }
+ }
+ }
+ }
+ }
+
+ public boolean alwaysDo()
+ {
+ LogicalTest currTest = null;
+ DependencyChecker depedencyChecker = new DependencyChecker();
+
+ Collection testEntries = testRegistry.getAllLogicalTestEntries();
+ DependencyChecker dependencyChecker = new DependencyChecker();
+ // iterate through all test entries
+ TestRegistry.Entry currEntry = null;
+ Iterator iter = testEntries.iterator();
+ while (iter.hasNext())
+ {
+ currEntry = (TestRegistry.Entry)iter.next();
+ currTest = currEntry.getLogicalTest();
+ addDependencies(currTest, dependencyChecker);
+ }
+
+ // find all references that do not exist
+ Set badReferences = dependencyChecker.getBadReferences();
+ if (badReferences.size() > 0)
+ {
+ TestReference reference = null;
+ Iterator refiter = badReferences.iterator();
+ while (refiter.hasNext())
+ {
+ reference = (TestReference)refiter.next();
+ LogicalTest logicalTest =
+ testRegistry.getLogicalTest(reference.getSource());
+ Map params = new HashMap(1);
+ params.put(
+ ErrorMessageConstants.REFERENCE,
+ "(" + reference.getSource() + " -> " + reference.getTarget() + ")");
+ NonfatalValidationException ex =
+ new NonfatalValidationException(
+ ErrorMessageConstants.MISSING_REQUIRES_REFERENCE,
+ params);
+ logicalTest.invalidate(ex);
+ }
+ }
+
+ // find all references to tests which are not in the same test-suite
+ badReferences = dependencyChecker.getNonTestsuiteReferences();
+ if (badReferences.size() > 0)
+ {
+ TestReference reference = null;
+
+ Iterator refiter = badReferences.iterator();
+ while (refiter.hasNext())
+ {
+ reference = (TestReference)refiter.next();
+ // For references outside the current test-suite, we want to report the location of
+ // the bad target as well, so get both the source and target logical tests here
+ LogicalTest sourceLogicalTest =
+ testRegistry.getLogicalTest(reference.getSource());
+ LogicalTest targetLogicalTest =
+ testRegistry.getLogicalTest(reference.getTarget());
+ Map params = new HashMap(1);
+ params.put(
+ ErrorMessageConstants.REFERENCE,
+ reference.getSource()
+ + " -> "
+ + reference.getTarget()
+ + " ("
+ + targetLogicalTest.getLocation()
+ + ")");
+ NonfatalValidationException ex =
+ new NonfatalValidationException(
+ ErrorMessageConstants.NON_TESTSUITE_REQUIRES_REFERENCE,
+ params);
+ sourceLogicalTest.invalidate(ex);
+ }
+ }
+
+ // find all cyclical references
+ badReferences = dependencyChecker.getCyclicalReferences();
+ if (badReferences.size() > 0)
+ {
+ TestReference reference = null;
+
+ Iterator refiter = badReferences.iterator();
+ while (refiter.hasNext())
+ {
+ reference = (TestReference)refiter.next();
+ LogicalTest logicalTest =
+ testRegistry.getLogicalTest(reference.getSource());
+ Map params = new HashMap(1);
+ params.put(
+ ErrorMessageConstants.REFERENCE,
+ "(" + reference.getSource() + " -> " + reference.getTarget() + ")");
+ NonfatalValidationException ex =
+ new NonfatalValidationException(
+ ErrorMessageConstants.CYCLICAL_REQUIRES_REFERENCE,
+ params);
+ logicalTest.invalidate(ex);
+ }
+ }
+ return true;
+ }
+
+ /*
+ * iternal utility class used for checking dependencies
+ * Note: The dependency checking methods must be called in the
+ * following order:
+ * 1. getBadReferences
+ * 2. getNonTestunitReferences
+ * 3. getCyclicalReferences
+ * The getters will actually change the state of the underlying data structure, so
+ * this is the order that must be used to insure that the proper checks are made.
+ */
+ class DependencyChecker
+ {
+ // String->Collection. The key is the source, the value is a
+ // Collection of targets
+ HashMap dependencyMap;
+
+ public DependencyChecker()
+ {
+ dependencyMap = new HashMap();
+ }
+ // return true if entry added. Return false if entry already existed
+ public boolean addEntry(String entry)
+ {
+ if (dependencyMap.get(entry) == null)
+ {
+ dependencyMap.put(entry, new HashSet());
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ public void addDependency(String source, String target)
+ {
+ HashSet currentTargets = (HashSet)dependencyMap.get(source);
+ if (currentTargets == null)
+ {
+ HashSet newTargetSet = new HashSet();
+ newTargetSet.add(target);
+ dependencyMap.put(source, newTargetSet);
+ }
+ else
+ {
+ currentTargets.add(target);
+ }
+ }
+
+ public void removeDependency(String source, String target)
+ {
+ Set targetSet = ((Set)dependencyMap.get(source));
+ targetSet.remove(target);
+ return;
+ }
+
+ private Set getTargets(String source)
+ {
+ return ((Set)dependencyMap.get(source));
+ }
+
+ private Set getSources(String target)
+ {
+ Set sourceDependants = new HashSet();
+ Set keySet = dependencyMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext())
+ {
+ String sourceName = (String)iter.next();
+ Set referenceSet = (Set)dependencyMap.get(sourceName);
+ if (referenceSet.contains(target))
+ {
+ sourceDependants.add(sourceName);
+ }
+ }
+ return sourceDependants;
+ }
+
+ /*
+ * Remove one reference which will not effect cyclical dependency checks
+ * true indicates a reference can and was removed
+ * false indicates that a reference could not be removed either because there
+ * are no references left or there are only cyclical dependencies left.
+ */
+ public boolean removeOneReference()
+ {
+ // first find terminal nodes (nodes which have no requires clause)
+ Set keySet = dependencyMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext())
+ {
+ Set targetSet = null;
+ String name = (String)iter.next();
+ targetSet = getTargets(name);
+ if ((targetSet == null) || (targetSet.size() == 0))
+ {
+ // terminal node
+ // remove source dependencies
+ Set sourceSet = getSources(name);
+ String[] dependArray = (String[])sourceSet.toArray(new String[0]);
+ for (int i = 0; i < dependArray.length; ++i)
+ {
+ removeDependency(dependArray[i], name);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Gets the set of all missing dependencies.
+ * Removes the bad ones as well.
+ */
+ public Set getBadReferences()
+ {
+ Set badRefSet = new HashSet();
+ Set keySet = dependencyMap.keySet();
+ Iterator keyIter = keySet.iterator();
+ while (keyIter.hasNext())
+ {
+ String keyVal = (String)keyIter.next();
+ Set referenceSet = (Set)dependencyMap.get(keyVal);
+ Iterator refIter = referenceSet.iterator();
+ while (refIter.hasNext())
+ {
+ String reference = (String)refIter.next();
+ if (!dependencyMap.containsKey(reference))
+ {
+ removeDependency(keyVal, reference);
+ badRefSet.add(new TestReference(keyVal, reference));
+ }
+ }
+ }
+ return badRefSet;
+ }
+
+ /*
+ * Gets the set of all non-test-suite references
+ * Removes these as well
+ */
+ public Set getNonTestsuiteReferences()
+ {
+ Set badRefSet = new HashSet();
+ Set keySet = dependencyMap.keySet();
+ Iterator keyIter = keySet.iterator();
+ while (keyIter.hasNext())
+ {
+ String keyVal = (String)keyIter.next();
+ Set referenceSet = (Set)dependencyMap.get(keyVal);
+ Iterator refIter = referenceSet.iterator();
+ LogicalTest sourceTest = testRegistry.getLogicalTest(keyVal);
+ while (refIter.hasNext())
+ {
+ String reference = (String)refIter.next();
+ LogicalTest targetTest = testRegistry.getLogicalTest(reference);
+ if (!TchUtils.sameSuite(sourceTest, targetTest))
+ {
+ removeDependency(keyVal, reference);
+ badRefSet.add(new TestReference(keyVal, reference));
+ }
+ }
+ }
+ return badRefSet;
+ }
+
+ /*
+ * Gets the set of all cyclical dependencies. This call will alter the
+ * data structure, so should only be called once.
+ */
+ public Set getCyclicalReferences()
+ {
+ boolean done = false;
+ while (removeOneReference())
+ {
+ }
+
+ Set cyclicalReferenceSet = new HashSet();
+ Set keySet = dependencyMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext())
+ {
+ String key = (String)iter.next();
+ Set targetSet = (Set)dependencyMap.get(key);
+ if (targetSet.size() > 0)
+ {
+ String[] targetArray = (String[])targetSet.toArray(new String[0]);
+ for (int i = 0; i < targetArray.length; ++i)
+ {
+ cyclicalReferenceSet.add(new TestReference(key, targetArray[i]));
+ }
+ }
+ }
+
+ // return all entries that still have references
+ return cyclicalReferenceSet;
+ }
+ }
+
+ class TestReference
+ {
+ public String source;
+ public String target;
+
+ public TestReference(String inSource, String inTarget)
+ {
+ source = inSource;
+ target = inTarget;
+ }
+ public String getSource()
+ {
+ return source;
+ }
+ public String getTarget()
+ {
+ return target;
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/ReferenceCheckTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresDependentTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresDependentTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresDependentTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresDependentTask.java Fri Aug 12 08:12:28 2005
@@ -1,44 +1,44 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.tools.ant.Task;
-
-import org.apache.beehive.test.tools.tch.util.TestResultBean;
-
-/**
- * This class encompases a block of required tasks and a block of dependent tasks
- * The required tasks are executed first, and if they *all* succeed without error,
- * the the dependent tasks are run. If there is any problem with the requires tasks,
- * all the dependent tasks (and the remaining requires tasks) are skipped.
- */
-
-public class RequiresDependentTask
- extends AbstractMinimalTestNodeTask
-{
- private RequiresTask requiresTask = null;
-
- public Task handleTask(Task task)
- {
- task = super.handleTask(task);
- if(task instanceof RequiresTask)
- requiresTask = (RequiresTask)task;
- return task;
- }
-
- public boolean isTestNode()
- {
- return true;
- }
-
- public String getName()
- {
- return "requires-dependent block";
- }
-
- protected void notifyOnResultHook(TestResultBean tr)
- {
- if(!isSkipped() && requiresTask.isSkipped()) //means that it was a requires error, so we skip the whole thing
- {
- skip("Test "+tr.getName()+" failed.");
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.tools.ant.Task;
+
+import org.apache.beehive.test.tools.tch.util.TestResultBean;
+
+/**
+ * This class encompases a block of required tasks and a block of dependent tasks
+ * The required tasks are executed first, and if they *all* succeed without error,
+ * the the dependent tasks are run. If there is any problem with the requires tasks,
+ * all the dependent tasks (and the remaining requires tasks) are skipped.
+ */
+
+public class RequiresDependentTask
+ extends AbstractMinimalTestNodeTask
+{
+ private RequiresTask requiresTask = null;
+
+ public Task handleTask(Task task)
+ {
+ task = super.handleTask(task);
+ if(task instanceof RequiresTask)
+ requiresTask = (RequiresTask)task;
+ return task;
+ }
+
+ public boolean isTestNode()
+ {
+ return true;
+ }
+
+ public String getName()
+ {
+ return "requires-dependent block";
+ }
+
+ protected void notifyOnResultHook(TestResultBean tr)
+ {
+ if(!isSkipped() && requiresTask.isSkipped()) //means that it was a requires error, so we skip the whole thing
+ {
+ skip("Test "+tr.getName()+" failed.");
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresDependentTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresTask.java Fri Aug 12 08:12:28 2005
@@ -1,27 +1,27 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.TestResult;
-import org.apache.beehive.test.tools.tch.util.TestResultBean;
-
-public class RequiresTask
- extends AbstractMinimalTestNodeTask
-{
- public boolean isTestNode()
- {
- return true;
- }
-
- public String getName()
- {
- return "requires block";
- }
-
- protected void notifyOnResultHook(TestResultBean tr)
- {
- if(!isSkipped() && tr.getType() == TchConstants.FAILURE_LEVEL_INT) //skip if any contained test failed
- {
- skip("Test "+tr.getName()+" failed.");
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.TestResult;
+import org.apache.beehive.test.tools.tch.util.TestResultBean;
+
+public class RequiresTask
+ extends AbstractMinimalTestNodeTask
+{
+ public boolean isTestNode()
+ {
+ return true;
+ }
+
+ public String getName()
+ {
+ return "requires block";
+ }
+
+ protected void notifyOnResultHook(TestResultBean tr)
+ {
+ if(!isSkipped() && tr.getType() == TchConstants.FAILURE_LEVEL_INT) //skip if any contained test failed
+ {
+ skip("Test "+tr.getName()+" failed.");
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RequiresTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RunOnceTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RunOnceTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RunOnceTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RunOnceTask.java Fri Aug 12 08:12:28 2005
@@ -1,8 +1,8 @@
-package org.apache.beehive.test.tools.tch.core;
-
-public interface RunOnceTask
-{
- public boolean isFirstCall();
-}
-
-
+package org.apache.beehive.test.tools.tch.core;
+
+public interface RunOnceTask
+{
+ public boolean isFirstCall();
+}
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/RunOnceTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SchemaValidate.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SchemaValidate.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SchemaValidate.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SchemaValidate.java Fri Aug 12 08:12:28 2005
@@ -1,145 +1,145 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.lang.StringBuffer;
-
-import org.apache.tools.ant.BuildException;
-import org.xml.sax.HandlerBase;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.ParserFactory;
-
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlError;
-
-class MyHandlerBase extends HandlerBase
-{
-
- private String buildErrorString = "";
- private int errorNum = 1;
-
- public String getBuildErrorString()
- {
- return buildErrorString;
- }
-
- public boolean errorFound()
- {
- return (boolean) (!buildErrorString.equals(""));
- }
-
- public void warning(SAXParseException ex)
- {
- org.apache.beehive.test.tools.tch.util.DebugLogger.log(
- "[Warning] " + getLocationString(ex) + ": " + ex.getMessage());
- }
-
- public void error(SAXParseException ex)
- {
- org.apache.beehive.test.tools.tch.util.DebugLogger.log(
- "[Error] " + getLocationString(ex) + ": " + ex.getMessage());
- buildErrorString += "[Error"
- + errorNum
- + "] "
- + getLocationString(ex)
- + ": "
- + ex.getMessage()
- + "\n";
- errorNum++;
- /*
- throw new BuildException("[Error] "+
- getLocationString(ex)+": "+
- ex.getMessage(), ex);
- */
- }
- public void fatalError(SAXParseException ex) throws SAXException
- {
- org.apache.beehive.test.tools.tch.util.DebugLogger.log(
- "[Fatal Error] " + getLocationString(ex) + ": " + ex.getMessage());
- throw new BuildException(
- "[FatalError] " + getLocationString(ex) + ": " + ex.getMessage(),
- ex);
- }
-
- public void startDocument()
- {
- }
- public void ignorableWhitespace(char ch[], int start, int length)
- {
- }
-
- /** Returns a string of the location. */
- private String getLocationString(SAXParseException ex)
- {
- StringBuffer str = new StringBuffer();
-
- String systemId = ex.getSystemId();
- if (systemId != null)
- {
- int index = systemId.lastIndexOf('/');
- if (index != -1)
- systemId = systemId.substring(index + 1);
- str.append(systemId);
- }
- str.append(':');
- str.append(ex.getLineNumber());
- str.append(':');
- str.append(ex.getColumnNumber());
-
- return str.toString();
-
- }
-}
-
-public class SchemaValidate
-{
-
- private final static boolean debug = false;
-
- public SchemaValidate()
- {
- }
- //always use the apache parser
- private static final String parserName =
- "org.apache.xerces.parsers.SAXParser";
-
- //default schema name for build files
- private String schemaName;
-
- public void validatingParse(String uri) throws Exception
- {
- File f = new File(uri);
- noNamespace.ProjectDocument projectDoc = noNamespace.ProjectDocument.Factory.parse(f);
-
- //parse the document
- XmlOptions validateOptions = new XmlOptions();
- ArrayList errorList = new ArrayList();
- validateOptions.setErrorListener(errorList);
-
- try{
- projectDoc.validate(validateOptions);
- }
- finally{
- if (errorList.size() > 0)
- {
- StringBuffer str = new StringBuffer();
- for (int i = 0; i < errorList.size(); i++)
- {
- XmlError error = (XmlError) errorList.get(i);
- str.append("\n");
- str.append("Message: " + error.getMessage() + "\n");
- str.append("Location of invalid XML: " + error.getCursorLocation().xmlText() + "\n");
- }
- throw new BuildException(str.toString());
- }
- }
- }
-
- public void setSchemaName(String inName)
- {
- schemaName = inName;
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.lang.StringBuffer;
+
+import org.apache.tools.ant.BuildException;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.Parser;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.ParserFactory;
+
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlError;
+
+class MyHandlerBase extends HandlerBase
+{
+
+ private String buildErrorString = "";
+ private int errorNum = 1;
+
+ public String getBuildErrorString()
+ {
+ return buildErrorString;
+ }
+
+ public boolean errorFound()
+ {
+ return (boolean) (!buildErrorString.equals(""));
+ }
+
+ public void warning(SAXParseException ex)
+ {
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log(
+ "[Warning] " + getLocationString(ex) + ": " + ex.getMessage());
+ }
+
+ public void error(SAXParseException ex)
+ {
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log(
+ "[Error] " + getLocationString(ex) + ": " + ex.getMessage());
+ buildErrorString += "[Error"
+ + errorNum
+ + "] "
+ + getLocationString(ex)
+ + ": "
+ + ex.getMessage()
+ + "\n";
+ errorNum++;
+ /*
+ throw new BuildException("[Error] "+
+ getLocationString(ex)+": "+
+ ex.getMessage(), ex);
+ */
+ }
+ public void fatalError(SAXParseException ex) throws SAXException
+ {
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log(
+ "[Fatal Error] " + getLocationString(ex) + ": " + ex.getMessage());
+ throw new BuildException(
+ "[FatalError] " + getLocationString(ex) + ": " + ex.getMessage(),
+ ex);
+ }
+
+ public void startDocument()
+ {
+ }
+ public void ignorableWhitespace(char ch[], int start, int length)
+ {
+ }
+
+ /** Returns a string of the location. */
+ private String getLocationString(SAXParseException ex)
+ {
+ StringBuffer str = new StringBuffer();
+
+ String systemId = ex.getSystemId();
+ if (systemId != null)
+ {
+ int index = systemId.lastIndexOf('/');
+ if (index != -1)
+ systemId = systemId.substring(index + 1);
+ str.append(systemId);
+ }
+ str.append(':');
+ str.append(ex.getLineNumber());
+ str.append(':');
+ str.append(ex.getColumnNumber());
+
+ return str.toString();
+
+ }
+}
+
+public class SchemaValidate
+{
+
+ private final static boolean debug = false;
+
+ public SchemaValidate()
+ {
+ }
+ //always use the apache parser
+ private static final String parserName =
+ "org.apache.xerces.parsers.SAXParser";
+
+ //default schema name for build files
+ private String schemaName;
+
+ public void validatingParse(String uri) throws Exception
+ {
+ File f = new File(uri);
+ noNamespace.ProjectDocument projectDoc = noNamespace.ProjectDocument.Factory.parse(f);
+
+ //parse the document
+ XmlOptions validateOptions = new XmlOptions();
+ ArrayList errorList = new ArrayList();
+ validateOptions.setErrorListener(errorList);
+
+ try{
+ projectDoc.validate(validateOptions);
+ }
+ finally{
+ if (errorList.size() > 0)
+ {
+ StringBuffer str = new StringBuffer();
+ for (int i = 0; i < errorList.size(); i++)
+ {
+ XmlError error = (XmlError) errorList.get(i);
+ str.append("\n");
+ str.append("Message: " + error.getMessage() + "\n");
+ str.append("Location of invalid XML: " + error.getCursorLocation().xmlText() + "\n");
+ }
+ throw new BuildException(str.toString());
+ }
+ }
+ }
+
+ public void setSchemaName(String inName)
+ {
+ schemaName = inName;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SchemaValidate.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SimpleTaskContainer.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SimpleTaskContainer.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SimpleTaskContainer.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SimpleTaskContainer.java Fri Aug 12 08:12:28 2005
@@ -1,50 +1,50 @@
-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;
-
-/**
- * This is a utility task simply calls other sub-tasks.
- */
-
-public class SimpleTaskContainer
- extends BaseTaskContainer
-{
- private Collection baseTasks = new ArrayList();
-
- public Task handleTask(Task task)
- {
- task = super.handleTask(task);
- if(task instanceof BaseTask)
- baseTasks.add(task);
- return task;
- }
-
- protected boolean initialize()
- throws BuildException
- {
- if(super.initialize())
- {
- for(Iterator iter = baseTasks.iterator(); iter.hasNext();)
- {
- addInvalidations(((BaseTask)iter.next()).getNonfatalValidationAggregate());
- }
- return true;
- }
- else
- return false;
- }
-}
-
-
-
-
-
-
-
-
-
+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;
+
+/**
+ * This is a utility task simply calls other sub-tasks.
+ */
+
+public class SimpleTaskContainer
+ extends BaseTaskContainer
+{
+ private Collection baseTasks = new ArrayList();
+
+ public Task handleTask(Task task)
+ {
+ task = super.handleTask(task);
+ if(task instanceof BaseTask)
+ baseTasks.add(task);
+ return task;
+ }
+
+ protected boolean initialize()
+ throws BuildException
+ {
+ if(super.initialize())
+ {
+ for(Iterator iter = baseTasks.iterator(); iter.hasNext();)
+ {
+ addInvalidations(((BaseTask)iter.next()).getNonfatalValidationAggregate());
+ }
+ return true;
+ }
+ else
+ return false;
+ }
+}
+
+
+
+
+
+
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/SimpleTaskContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/Snapshot.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/Snapshot.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/Snapshot.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/Snapshot.java Fri Aug 12 08:12:28 2005
@@ -1,50 +1,50 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.apache.tools.ant.Location;
-
-import org.apache.beehive.test.tools.tch.util.PerThreadCache;
-
-public class Snapshot
-{
- public static final String PROPERTIES = "props";
- public static final String RELATIVE_PATH = "relativePath";
- public static final String TEST_SUITE_CALL_TASK = "testSuiteCallTask";
- public static final String LOCATION = "location";
-
- private static PerThreadCache perThreadCache = PerThreadCache.getInstance();
-
- public static void snap(
- String nextDir,
- Properties props,
- File fileLoc,
- Location location,
- TestSuiteCallTask tsct)
- {
- org.apache.beehive.test.tools.tch.util.DebugLogger.log(
- "**********Here are the props stuck in the cache: " + props.size());
-
- perThreadCache.addToParentList(
- LOCATION,
- new CallingChainLink(fileLoc, location));
- perThreadCache.addToList(RELATIVE_PATH, nextDir);
- perThreadCache.set(TEST_SUITE_CALL_TASK, tsct);
-
- snap(props);
- }
-
- public static void snap(Properties props)
- {
- perThreadCache.addToList(PROPERTIES, props);
- }
-
- public static void unsnap()
- {
- perThreadCache.removeFromList(PROPERTIES);
- perThreadCache.removeFromList(RELATIVE_PATH);
- perThreadCache.removeFromParentList(LOCATION);
- perThreadCache.remove(TEST_SUITE_CALL_TASK);
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.tools.ant.Location;
+
+import org.apache.beehive.test.tools.tch.util.PerThreadCache;
+
+public class Snapshot
+{
+ public static final String PROPERTIES = "props";
+ public static final String RELATIVE_PATH = "relativePath";
+ public static final String TEST_SUITE_CALL_TASK = "testSuiteCallTask";
+ public static final String LOCATION = "location";
+
+ private static PerThreadCache perThreadCache = PerThreadCache.getInstance();
+
+ public static void snap(
+ String nextDir,
+ Properties props,
+ File fileLoc,
+ Location location,
+ TestSuiteCallTask tsct)
+ {
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log(
+ "**********Here are the props stuck in the cache: " + props.size());
+
+ perThreadCache.addToParentList(
+ LOCATION,
+ new CallingChainLink(fileLoc, location));
+ perThreadCache.addToList(RELATIVE_PATH, nextDir);
+ perThreadCache.set(TEST_SUITE_CALL_TASK, tsct);
+
+ snap(props);
+ }
+
+ public static void snap(Properties props)
+ {
+ perThreadCache.addToList(PROPERTIES, props);
+ }
+
+ public static void unsnap()
+ {
+ perThreadCache.removeFromList(PROPERTIES);
+ perThreadCache.removeFromList(RELATIVE_PATH);
+ perThreadCache.removeFromParentList(LOCATION);
+ perThreadCache.remove(TEST_SUITE_CALL_TASK);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/Snapshot.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/StartupTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/StartupTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/StartupTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/StartupTask.java Fri Aug 12 08:12:28 2005
@@ -1,91 +1,91 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.File;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.tools.ant.BuildException;
-
-import org.apache.beehive.test.tools.tch.TchVMTask;
-import org.apache.beehive.test.tools.tch.core.configuration.ErrorMessageStore;
-import org.apache.beehive.test.tools.tch.core.remote.RemoteTchManagerImpl;
-import org.apache.beehive.test.tools.tch.core.test.vehicle.LocalTestVehicle;
-import org.apache.beehive.test.tools.tch.core.test.vehicle.ServletTestVehicle;
-import org.apache.beehive.test.tools.tch.core.test.vehicle.TestVehicle;
-import org.apache.beehive.test.tools.tch.core.test.vehicle.TestVehicleRegistry;
-import org.apache.beehive.test.tools.tch.extension.process.listener.RemoteListenerTestVehicle;
-
-public class StartupTask extends BaseTaskContainer
-{
- public boolean alwaysDo() throws BuildException
- {
- boolean rtn = super.alwaysDo();
- mapScopedProperties();
- AntProperties.init(getProject());
- AntProperties.populate();
- ErrorMessageStore.getInstance().populate();
- AntProperties.validate();
- registerDefaultTestVehicles();
- if (AntProperties.isVerboseOn())
- {
- echoProcessDynamicProps();
- }
- // set up the manager rmi object. This will currently be
- // used to do proper process cleanup upon tch shutdown
- RemoteTchManagerImpl.activateTchManager();
- return rtn;
- }
-
- private void registerDefaultTestVehicles()
- {
- registerTestVehicle(new LocalTestVehicle("local"));
- registerTestVehicle(new RemoteListenerTestVehicle("remote"));
- registerTestVehicle(new ServletTestVehicle("servlet"));
- }
-
- private void registerTestVehicle(TestVehicle tv)
- {
- TestVehicleRegistry.getRegistry().setTestVehicleEntry(tv.getType(), tv);
- log("Registering test vehicle: " + tv);
- }
-
- private void echoProcessDynamicProps()
- {
- Iterator iter =
- AntProperties
- .getStrippedDynamicProcessConfigProps()
- .entrySet()
- .iterator();
- if (iter.hasNext())
- {
- log("Dynamic process config properties:");
- for (; iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry)iter.next();
- log(" " + entry.getKey() + "=" + entry.getValue());
- }
- }
-
- }
-
- private void mapScopedProperties()
- {
- for (Iterator iter = getProject().getUserProperties().entrySet().iterator();
- iter.hasNext();
- )
- {
- Map.Entry me = (Map.Entry)iter.next();
- String name = (String)me.getKey();
- if (name.startsWith("."))
- getProject().setProperty(
- name.substring(1, name.length()),
- (String)me.getValue());
- }
- //delete the magic file created by the TchVMTask if it was set
- File f = new File(TchVMTask.TEMP_TCH_PROPERTYFILE_NAME);
- if (f.exists())
- f.delete();
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.File;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+
+import org.apache.beehive.test.tools.tch.TchVMTask;
+import org.apache.beehive.test.tools.tch.core.configuration.ErrorMessageStore;
+import org.apache.beehive.test.tools.tch.core.remote.RemoteTchManagerImpl;
+import org.apache.beehive.test.tools.tch.core.test.vehicle.LocalTestVehicle;
+import org.apache.beehive.test.tools.tch.core.test.vehicle.ServletTestVehicle;
+import org.apache.beehive.test.tools.tch.core.test.vehicle.TestVehicle;
+import org.apache.beehive.test.tools.tch.core.test.vehicle.TestVehicleRegistry;
+import org.apache.beehive.test.tools.tch.extension.process.listener.RemoteListenerTestVehicle;
+
+public class StartupTask extends BaseTaskContainer
+{
+ public boolean alwaysDo() throws BuildException
+ {
+ boolean rtn = super.alwaysDo();
+ mapScopedProperties();
+ AntProperties.init(getProject());
+ AntProperties.populate();
+ ErrorMessageStore.getInstance().populate();
+ AntProperties.validate();
+ registerDefaultTestVehicles();
+ if (AntProperties.isVerboseOn())
+ {
+ echoProcessDynamicProps();
+ }
+ // set up the manager rmi object. This will currently be
+ // used to do proper process cleanup upon tch shutdown
+ RemoteTchManagerImpl.activateTchManager();
+ return rtn;
+ }
+
+ private void registerDefaultTestVehicles()
+ {
+ registerTestVehicle(new LocalTestVehicle("local"));
+ registerTestVehicle(new RemoteListenerTestVehicle("remote"));
+ registerTestVehicle(new ServletTestVehicle("servlet"));
+ }
+
+ private void registerTestVehicle(TestVehicle tv)
+ {
+ TestVehicleRegistry.getRegistry().setTestVehicleEntry(tv.getType(), tv);
+ log("Registering test vehicle: " + tv);
+ }
+
+ private void echoProcessDynamicProps()
+ {
+ Iterator iter =
+ AntProperties
+ .getStrippedDynamicProcessConfigProps()
+ .entrySet()
+ .iterator();
+ if (iter.hasNext())
+ {
+ log("Dynamic process config properties:");
+ for (; iter.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)iter.next();
+ log(" " + entry.getKey() + "=" + entry.getValue());
+ }
+ }
+
+ }
+
+ private void mapScopedProperties()
+ {
+ for (Iterator iter = getProject().getUserProperties().entrySet().iterator();
+ iter.hasNext();
+ )
+ {
+ Map.Entry me = (Map.Entry)iter.next();
+ String name = (String)me.getKey();
+ if (name.startsWith("."))
+ getProject().setProperty(
+ name.substring(1, name.length()),
+ (String)me.getValue());
+ }
+ //delete the magic file created by the TchVMTask if it was set
+ File f = new File(TchVMTask.TEMP_TCH_PROPERTYFILE_NAME);
+ if (f.exists())
+ f.delete();
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/StartupTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestBlockTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestBlockTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestBlockTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestBlockTask.java Fri Aug 12 08:12:28 2005
@@ -1,275 +1,275 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-import org.apache.beehive.test.tools.tch.util.TestResultBean;
-
-/**
- * A TestBlockTask represents a task which contains other nested test tasks whose results are
- * AND'ed together to arrive at a single test result.
- */
-public class TestBlockTask extends AbstractTestTask implements TestParent
-{
- private int count = 1;
- private boolean firstpass = true;
- private boolean repeated = false;
- private boolean returnval = true;
-
- //These will only be used by top-level ones. Bad design, I know.
- private TestResultBean testResult =
- new TestResultAdapter(TchConstants.SUCCESS_LEVEL_INT, "", "block-test");
-
- /**
- * Ant settor which sets the count attribute for the test-block, which indicates the number of loops
- * through the test-block to execute.
- *
- * @param in String containing the count
- */
- public void setCount(String in)
- {
- String parseThis = handleValue(in);
- try
- {
- count = new Integer(parseThis).intValue();
- }
- catch (NumberFormatException ex)
- {
- //VALIDATION EXCEPTION
- invalidate(
- new NonfatalValidationException(
- ErrorMessageConstants.INTEGER_PARSE_ERROR_CODE,
- ErrorMessageConstants.BROKEN_INT_VAL,
- parseThis));
- }
- }
-
- //other stuff
- /**
- * Get the number of test outcomes.
- *
- * @return will always return 1 since this is a test-block
- */
- public int getNumOutcomes()
- {
- return 1; //Should always be 1, that's why it is a block!
- }
-
- /*
- * @see org.apache.beehive.test.tools.tch.core.LogicalTest#getSubtestNames()
- */
- public Collection getSubtestsConfiguredToRun()
- {
- return null;
- }
-
- public Collection getNonQualifiedSubtestNames()
- {
- return null;
- }
-
- public Collection getFullyQualifiedSubtestNames()
- {
- return null;
- }
-
- /**
- * Returns the logical test name for the test block
- */
- protected String getTestCaseName()
- {
- return getShortName();
- }
-
- public boolean isFirstPass()
- {
- return firstpass;
- }
-
- public boolean isRepeated()
- {
- return repeated;
- }
-
- /**
- * Since this is a Block, there's probably more than one
- * execution task below. Need to get them all.
- *
- * @see org.apache.beehive.test.tools.tch.core.LogicalTest#getExecutionTasks()
- */
- public Collection getExecutionTasks()
- {
- HashSet rtn = new HashSet();
- for (Iterator iter = getChildren().iterator(); iter.hasNext();)
- {
- Object o = iter.next();
- if (LogicalTest.class.isAssignableFrom(o.getClass()))
- rtn.addAll(((LogicalTest)o).getExecutionTasks());
- }
- return rtn;
- }
-
- protected boolean runFirstPass()
- {
- // start from 1. BaseTaskContainer.preAlwaysDo() will always
- // cause an initial execution, so need to count that as well
- for (int i = 1; i < count; ++i)
- {
- if (isSkipped())
- {
- markSkipped();
- break;
- }
- else if (isValidationSkipped())
- {
- markValidationSkipped();
- break;
- }
- else if (isShortCircuited())
- {
- break;
- }
- else
- {
- // set repeated to false on the last iteration. This will
- // cause AbstractTestTask to null out the logical test in
- // the registry entry
- if (i >= (count - 1))
- {
- // IF this is a nested test-block, we need to check whether the parent
- // is repeated as well. If not, we can not set repeated to false here
- // Also, if the parent's count setting is 1, we can set repeat to false
- repeated = false;
- }
- else
- {
- repeated = true;
- }
- // run the test logic
- execute();
- }
- }
- // for simplicity's sake, for the first pass, don't even run the test. Just return
- // the return value
- return returnval;
- }
-
- protected boolean run()
- {
- if (firstpass)
- {
- // on the first pass, don't run execute(). Just call runFirstPass()
- // which will iteratively call execute()
- firstpass = false;
- boolean retval = runFirstPass();
-
- // only need to submit at the end
- if (isSkipped())
- {
- markSkipped();
- }
- else if (isValidationSkipped())
- {
- markValidationSkipped();
- }
- else if (!isShortCircuited() && !isSkipped() && !isValidationSkipped())
- {
- testResult.setType(TchConstants.SUCCESS_LEVEL_INT);
- }
- submitFinalResult();
-
- // reset first pass to true in case we're called again.
- // e.g. a nested test-block will get called again if the parent count > 1
- firstpass = true;
- return retval;
- }
- else
- {
- // for the nested calls only.
- if (!super.run())
- {
- returnval = false;
- }
- // this is the return value from the nested call.. shouldn't really matter
- return returnval;
- }
- }
-
- /**
- * This callback is called whenever a test in the test-block logs a result.
- */
- protected void notifyOnResultHook(TestResultBean tr)
- {
- // isOutcome and isProblem is not quite enough
- // SCRATCH is a problem but not an outcome
- // SKIP is an outcome, but not a problem
- if (tr.isOutcome() || tr.getType() == TchConstants.SCRATCH_LEVEL_INT)
- {
- boolean problem = tr.isOrContainsProblems();
- // setting the type to nested here. This would keep the result from being treated as
- // an outcome
- tr.setType(TchConstants.NESTED_LEVEL_INT);
- tr.setName(getName() + TchConstants.RESULT_NAME_SEP + tr.getName());
-
- // Check for failure to short-circuit here
- // don't bother if we have already "failed" this block -
- // usually we would not try to fail the same block
- // more than once, since we would short-circuit its
- // execution if we encounter a failure
- //
- // but since we cannot short-circuit the execution of subtests,
- // at least we want the block result to contain the right info for
- // the test failure that caused its failure
- if (problem && !isFailed())
- {
- shortCircuit(tr.getName());
- markFailed(tr);
- }
- }
- }
-
- private void markSkipped()
- {
- testResult.setType(TchConstants.SKIP_LEVEL_INT);
- }
-
- private void markValidationSkipped()
- {
- testResult.setOutputMsg(
- "Test-block skipped due to a validation failure in a nested test: "
- + getValidationSkipMessage(false));
- testResult.setType(TchConstants.VALIDATION_SKIP_LEVEL_INT);
- }
-
- private void markFailed(TestResultBean tr)
- {
- testResult.setThrowable(tr.getThrowable());
- testResult.setFilterThrowable(tr.getFilterThrowable());
- testResult.addParameters(tr.getParameters());
- testResult.setOutputMsg(
- "Test-block failed due to a failure of nested test \""
- + tr.getName()
- + "\". OutputMessage: "
- + tr.getOutputMessage()
- + ". Other tests in the test-block will not run.");
- testResult.setDetails(tr.getDetails());
- testResult.setType(TchConstants.FAILURE_LEVEL_INT);
- }
-
- // check if this block is a failure
- private boolean isFailed()
- {
- return (testResult.getType() == TchConstants.FAILURE_LEVEL_INT);
- }
-
- private void submitFinalResult()
- {
- testResult.setTimeStamp(new Date());
- submitResult(testResult);
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+import org.apache.beehive.test.tools.tch.util.TestResultBean;
+
+/**
+ * A TestBlockTask represents a task which contains other nested test tasks whose results are
+ * AND'ed together to arrive at a single test result.
+ */
+public class TestBlockTask extends AbstractTestTask implements TestParent
+{
+ private int count = 1;
+ private boolean firstpass = true;
+ private boolean repeated = false;
+ private boolean returnval = true;
+
+ //These will only be used by top-level ones. Bad design, I know.
+ private TestResultBean testResult =
+ new TestResultAdapter(TchConstants.SUCCESS_LEVEL_INT, "", "block-test");
+
+ /**
+ * Ant settor which sets the count attribute for the test-block, which indicates the number of loops
+ * through the test-block to execute.
+ *
+ * @param in String containing the count
+ */
+ public void setCount(String in)
+ {
+ String parseThis = handleValue(in);
+ try
+ {
+ count = new Integer(parseThis).intValue();
+ }
+ catch (NumberFormatException ex)
+ {
+ //VALIDATION EXCEPTION
+ invalidate(
+ new NonfatalValidationException(
+ ErrorMessageConstants.INTEGER_PARSE_ERROR_CODE,
+ ErrorMessageConstants.BROKEN_INT_VAL,
+ parseThis));
+ }
+ }
+
+ //other stuff
+ /**
+ * Get the number of test outcomes.
+ *
+ * @return will always return 1 since this is a test-block
+ */
+ public int getNumOutcomes()
+ {
+ return 1; //Should always be 1, that's why it is a block!
+ }
+
+ /*
+ * @see org.apache.beehive.test.tools.tch.core.LogicalTest#getSubtestNames()
+ */
+ public Collection getSubtestsConfiguredToRun()
+ {
+ return null;
+ }
+
+ public Collection getNonQualifiedSubtestNames()
+ {
+ return null;
+ }
+
+ public Collection getFullyQualifiedSubtestNames()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the logical test name for the test block
+ */
+ protected String getTestCaseName()
+ {
+ return getShortName();
+ }
+
+ public boolean isFirstPass()
+ {
+ return firstpass;
+ }
+
+ public boolean isRepeated()
+ {
+ return repeated;
+ }
+
+ /**
+ * Since this is a Block, there's probably more than one
+ * execution task below. Need to get them all.
+ *
+ * @see org.apache.beehive.test.tools.tch.core.LogicalTest#getExecutionTasks()
+ */
+ public Collection getExecutionTasks()
+ {
+ HashSet rtn = new HashSet();
+ for (Iterator iter = getChildren().iterator(); iter.hasNext();)
+ {
+ Object o = iter.next();
+ if (LogicalTest.class.isAssignableFrom(o.getClass()))
+ rtn.addAll(((LogicalTest)o).getExecutionTasks());
+ }
+ return rtn;
+ }
+
+ protected boolean runFirstPass()
+ {
+ // start from 1. BaseTaskContainer.preAlwaysDo() will always
+ // cause an initial execution, so need to count that as well
+ for (int i = 1; i < count; ++i)
+ {
+ if (isSkipped())
+ {
+ markSkipped();
+ break;
+ }
+ else if (isValidationSkipped())
+ {
+ markValidationSkipped();
+ break;
+ }
+ else if (isShortCircuited())
+ {
+ break;
+ }
+ else
+ {
+ // set repeated to false on the last iteration. This will
+ // cause AbstractTestTask to null out the logical test in
+ // the registry entry
+ if (i >= (count - 1))
+ {
+ // IF this is a nested test-block, we need to check whether the parent
+ // is repeated as well. If not, we can not set repeated to false here
+ // Also, if the parent's count setting is 1, we can set repeat to false
+ repeated = false;
+ }
+ else
+ {
+ repeated = true;
+ }
+ // run the test logic
+ execute();
+ }
+ }
+ // for simplicity's sake, for the first pass, don't even run the test. Just return
+ // the return value
+ return returnval;
+ }
+
+ protected boolean run()
+ {
+ if (firstpass)
+ {
+ // on the first pass, don't run execute(). Just call runFirstPass()
+ // which will iteratively call execute()
+ firstpass = false;
+ boolean retval = runFirstPass();
+
+ // only need to submit at the end
+ if (isSkipped())
+ {
+ markSkipped();
+ }
+ else if (isValidationSkipped())
+ {
+ markValidationSkipped();
+ }
+ else if (!isShortCircuited() && !isSkipped() && !isValidationSkipped())
+ {
+ testResult.setType(TchConstants.SUCCESS_LEVEL_INT);
+ }
+ submitFinalResult();
+
+ // reset first pass to true in case we're called again.
+ // e.g. a nested test-block will get called again if the parent count > 1
+ firstpass = true;
+ return retval;
+ }
+ else
+ {
+ // for the nested calls only.
+ if (!super.run())
+ {
+ returnval = false;
+ }
+ // this is the return value from the nested call.. shouldn't really matter
+ return returnval;
+ }
+ }
+
+ /**
+ * This callback is called whenever a test in the test-block logs a result.
+ */
+ protected void notifyOnResultHook(TestResultBean tr)
+ {
+ // isOutcome and isProblem is not quite enough
+ // SCRATCH is a problem but not an outcome
+ // SKIP is an outcome, but not a problem
+ if (tr.isOutcome() || tr.getType() == TchConstants.SCRATCH_LEVEL_INT)
+ {
+ boolean problem = tr.isOrContainsProblems();
+ // setting the type to nested here. This would keep the result from being treated as
+ // an outcome
+ tr.setType(TchConstants.NESTED_LEVEL_INT);
+ tr.setName(getName() + TchConstants.RESULT_NAME_SEP + tr.getName());
+
+ // Check for failure to short-circuit here
+ // don't bother if we have already "failed" this block -
+ // usually we would not try to fail the same block
+ // more than once, since we would short-circuit its
+ // execution if we encounter a failure
+ //
+ // but since we cannot short-circuit the execution of subtests,
+ // at least we want the block result to contain the right info for
+ // the test failure that caused its failure
+ if (problem && !isFailed())
+ {
+ shortCircuit(tr.getName());
+ markFailed(tr);
+ }
+ }
+ }
+
+ private void markSkipped()
+ {
+ testResult.setType(TchConstants.SKIP_LEVEL_INT);
+ }
+
+ private void markValidationSkipped()
+ {
+ testResult.setOutputMsg(
+ "Test-block skipped due to a validation failure in a nested test: "
+ + getValidationSkipMessage(false));
+ testResult.setType(TchConstants.VALIDATION_SKIP_LEVEL_INT);
+ }
+
+ private void markFailed(TestResultBean tr)
+ {
+ testResult.setThrowable(tr.getThrowable());
+ testResult.setFilterThrowable(tr.getFilterThrowable());
+ testResult.addParameters(tr.getParameters());
+ testResult.setOutputMsg(
+ "Test-block failed due to a failure of nested test \""
+ + tr.getName()
+ + "\". OutputMessage: "
+ + tr.getOutputMessage()
+ + ". Other tests in the test-block will not run.");
+ testResult.setDetails(tr.getDetails());
+ testResult.setType(TchConstants.FAILURE_LEVEL_INT);
+ }
+
+ // check if this block is a failure
+ private boolean isFailed()
+ {
+ return (testResult.getType() == TchConstants.FAILURE_LEVEL_INT);
+ }
+
+ private void submitFinalResult()
+ {
+ testResult.setTimeStamp(new Date());
+ submitResult(testResult);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestBlockTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestCommandLineBuilder.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestCommandLineBuilder.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestCommandLineBuilder.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestCommandLineBuilder.java Fri Aug 12 08:12:28 2005
@@ -1,102 +1,102 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * This is a helper class for the test to generate the
- * command line to run the single test, with all of the
- * correct properties, etc.
- */
-
-public class TestCommandLineBuilder extends AbstractTestReproducer
-{
- public TestCommandLineBuilder(TestReplicationHelper helper)
- {
- super(helper);
- }
-
- public String getCommandLine()
- {
- StringBuffer sb = new StringBuffer(AntProperties.getReplicationEntryPoint());
- Map specialProperties = new HashMap();
-
- specialProperties.put(CmdlineParams.TEST_SUITE_PARAM, getBuildfile());
- specialProperties.put(CmdlineParams.SUBSET_TEST_PARAM, getTestNamesValue());
-
- String configFileNames = getAllProcessConfigFiles();
- if (configFileNames.length() > 0)
- specialProperties.put(CmdlineParams.CONFIG_FILE_PARAM, configFileNames);
-
- Collection excludedProps = AntProperties.getTchExcludedPropNames();
- if (!AntProperties.isReplicationJavaoptsEnabled())
- {
- excludedProps = new HashSet(excludedProps);
- excludedProps.add(CmdlineParams.TCH_JAVAOPTS_PROPERTY_NAME);
- }
-
- addAllProperties(
- sb,
- specialProperties,
- excludedProps);
-
- return sb.toString();
- }
-
- public String getJavaCommandLine()
- {
- StringBuffer sb = new StringBuffer("java");
-
- if (AntProperties.areJavaoptsSet())
- {
- sb.append(" ").append(AntProperties.getJavaopts());
- }
-
- sb.append(JavaCmdlineHelper.getMainClassAndTargetAsString());
- if (AntProperties.isVerboseOn())
- sb.append(" -verbose");
-
- // setting -emacs tells Ant not to print task names to stdout.
- sb.append(" -emacs");
- sb.append(JavaCmdlineHelper.getOuterAntBuildfileAsString());
-
- Map specialProperties = new HashMap();
-
- specialProperties.put(CmdlineParams.TEST_SUITE_PARAM, getBuildfile());
- specialProperties.put(CmdlineParams.SUBSET_TEST_PARAM, getTestNamesValue());
-
- String configFileNames = getAllProcessConfigFiles();
- if (configFileNames.length() > 0)
- specialProperties.put(CmdlineParams.CONFIG_FILE_PARAM, configFileNames);
-
- specialProperties.put(
- CmdlineParams.TCH_HOME_PROPERTY_NAME,
- AntProperties.getHomeDir());
-
- addAllProperties(
- sb,
- specialProperties,
- AntProperties.getJavaExcludedPropNames());
-
- return sb.toString();
- }
-
- private String getAllProcessConfigFiles()
- {
- StringBuffer sb = new StringBuffer();
- Collection allProcessConfigFiles = AntProperties.getAllProcessConfigFiles();
- if (allProcessConfigFiles != null)
- for (Iterator iter = allProcessConfigFiles.iterator(); iter.hasNext();)
- {
- File f = (File)iter.next();
- sb.append(f.getAbsolutePath());
- if (iter.hasNext())
- sb.append(",");
- }
- return sb.toString();
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This is a helper class for the test to generate the
+ * command line to run the single test, with all of the
+ * correct properties, etc.
+ */
+
+public class TestCommandLineBuilder extends AbstractTestReproducer
+{
+ public TestCommandLineBuilder(TestReplicationHelper helper)
+ {
+ super(helper);
+ }
+
+ public String getCommandLine()
+ {
+ StringBuffer sb = new StringBuffer(AntProperties.getReplicationEntryPoint());
+ Map specialProperties = new HashMap();
+
+ specialProperties.put(CmdlineParams.TEST_SUITE_PARAM, getBuildfile());
+ specialProperties.put(CmdlineParams.SUBSET_TEST_PARAM, getTestNamesValue());
+
+ String configFileNames = getAllProcessConfigFiles();
+ if (configFileNames.length() > 0)
+ specialProperties.put(CmdlineParams.CONFIG_FILE_PARAM, configFileNames);
+
+ Collection excludedProps = AntProperties.getTchExcludedPropNames();
+ if (!AntProperties.isReplicationJavaoptsEnabled())
+ {
+ excludedProps = new HashSet(excludedProps);
+ excludedProps.add(CmdlineParams.TCH_JAVAOPTS_PROPERTY_NAME);
+ }
+
+ addAllProperties(
+ sb,
+ specialProperties,
+ excludedProps);
+
+ return sb.toString();
+ }
+
+ public String getJavaCommandLine()
+ {
+ StringBuffer sb = new StringBuffer("java");
+
+ if (AntProperties.areJavaoptsSet())
+ {
+ sb.append(" ").append(AntProperties.getJavaopts());
+ }
+
+ sb.append(JavaCmdlineHelper.getMainClassAndTargetAsString());
+ if (AntProperties.isVerboseOn())
+ sb.append(" -verbose");
+
+ // setting -emacs tells Ant not to print task names to stdout.
+ sb.append(" -emacs");
+ sb.append(JavaCmdlineHelper.getOuterAntBuildfileAsString());
+
+ Map specialProperties = new HashMap();
+
+ specialProperties.put(CmdlineParams.TEST_SUITE_PARAM, getBuildfile());
+ specialProperties.put(CmdlineParams.SUBSET_TEST_PARAM, getTestNamesValue());
+
+ String configFileNames = getAllProcessConfigFiles();
+ if (configFileNames.length() > 0)
+ specialProperties.put(CmdlineParams.CONFIG_FILE_PARAM, configFileNames);
+
+ specialProperties.put(
+ CmdlineParams.TCH_HOME_PROPERTY_NAME,
+ AntProperties.getHomeDir());
+
+ addAllProperties(
+ sb,
+ specialProperties,
+ AntProperties.getJavaExcludedPropNames());
+
+ return sb.toString();
+ }
+
+ private String getAllProcessConfigFiles()
+ {
+ StringBuffer sb = new StringBuffer();
+ Collection allProcessConfigFiles = AntProperties.getAllProcessConfigFiles();
+ if (allProcessConfigFiles != null)
+ for (Iterator iter = allProcessConfigFiles.iterator(); iter.hasNext();)
+ {
+ File f = (File)iter.next();
+ sb.append(f.getAbsolutePath());
+ if (iter.hasNext())
+ sb.append(",");
+ }
+ return sb.toString();
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestCommandLineBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestEntityModifier.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestEntityModifier.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestEntityModifier.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestEntityModifier.java Fri Aug 12 08:12:28 2005
@@ -1,8 +1,8 @@
-package org.apache.beehive.test.tools.tch.core;
-
-/**
- */
-public interface TestEntityModifier
-{
- public String getValue();
-}
+package org.apache.beehive.test.tools.tch.core;
+
+/**
+ */
+public interface TestEntityModifier
+{
+ public String getValue();
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestEntityModifier.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestListOutputTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestListOutputTask.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestListOutputTask.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestListOutputTask.java Fri Aug 12 08:12:28 2005
@@ -1,67 +1,67 @@
-package org.apache.beehive.test.tools.tch.core;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-import org.apache.beehive.test.tools.tch.core.AntProperties;
-import org.apache.beehive.test.tools.tch.core.EntryPoint;
-import org.apache.beehive.test.tools.tch.core.LogicalTest;
-import org.apache.beehive.test.tools.tch.core.test.TestRegistry;
-import org.apache.beehive.test.tools.tch.logger.LoggerRuntimeException;
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationAggregate;
-
-public class TestListOutputTask extends Task
-{
- public void execute() throws BuildException
- {
- if (!AntProperties.isLogTestNamesEnabled())
- return;
-
- StringBuffer sb = new StringBuffer();
- Collection testEntries =
- TestRegistry.getRegistry().getAllLogicalTestEntriesThatWillRun();
- int resultCounter = 0;
- for (Iterator iter = testEntries.iterator(); iter.hasNext();)
- {
- TestRegistry.Entry testEntry = (TestRegistry.Entry)iter.next();
- LogicalTest logicalTest = testEntry.getLogicalTest();
- resultCounter++;
- sb.append(logicalTest.getName());
- sb.append("\n");
- }
-
- File logBaseDir = AntProperties.getLogBasedir();
- logBaseDir.mkdirs();
- File logfile =
- new File(logBaseDir, AntProperties.getBaseLogfileName() + ".test-names");
- dumpToLog(sb.toString(), logfile);
- }
-
- private static void dumpToLog(String in, File logfile)
- {
- // just write to regular .log, since this is in init-mode-only
- // this is a bit hacky
- try
- {
- PrintWriter pw =
- new PrintWriter(new BufferedWriter(new FileWriter(logfile)));
- pw.println(in);
- pw.close();
- }
- catch (IOException e)
- {
- throw new LoggerRuntimeException(e);
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+import org.apache.beehive.test.tools.tch.core.AntProperties;
+import org.apache.beehive.test.tools.tch.core.EntryPoint;
+import org.apache.beehive.test.tools.tch.core.LogicalTest;
+import org.apache.beehive.test.tools.tch.core.test.TestRegistry;
+import org.apache.beehive.test.tools.tch.logger.LoggerRuntimeException;
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationAggregate;
+
+public class TestListOutputTask extends Task
+{
+ public void execute() throws BuildException
+ {
+ if (!AntProperties.isLogTestNamesEnabled())
+ return;
+
+ StringBuffer sb = new StringBuffer();
+ Collection testEntries =
+ TestRegistry.getRegistry().getAllLogicalTestEntriesThatWillRun();
+ int resultCounter = 0;
+ for (Iterator iter = testEntries.iterator(); iter.hasNext();)
+ {
+ TestRegistry.Entry testEntry = (TestRegistry.Entry)iter.next();
+ LogicalTest logicalTest = testEntry.getLogicalTest();
+ resultCounter++;
+ sb.append(logicalTest.getName());
+ sb.append("\n");
+ }
+
+ File logBaseDir = AntProperties.getLogBasedir();
+ logBaseDir.mkdirs();
+ File logfile =
+ new File(logBaseDir, AntProperties.getBaseLogfileName() + ".test-names");
+ dumpToLog(sb.toString(), logfile);
+ }
+
+ private static void dumpToLog(String in, File logfile)
+ {
+ // just write to regular .log, since this is in init-mode-only
+ // this is a bit hacky
+ try
+ {
+ PrintWriter pw =
+ new PrintWriter(new BufferedWriter(new FileWriter(logfile)));
+ pw.println(in);
+ pw.close();
+ }
+ catch (IOException e)
+ {
+ throw new LoggerRuntimeException(e);
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/TestListOutputTask.java
------------------------------------------------------------------------------
svn:eol-style = native