summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaikiran Pai <jaikiran@apache.org>2019-05-21 14:47:29 +0530
committerJaikiran Pai <jaikiran@apache.org>2019-05-21 14:50:49 +0530
commit03a718d88dbc5c15e2085eaa292b160c8608b998 (patch)
tree20f20bba33a9018fbc1dd9e64aa6d6b3a465d545
parent0259c0b981e997a67a926c5303e8906250b30bb6 (diff)
downloadant-03a718d88dbc5c15e2085eaa292b160c8608b998.tar.gz
bz-63446 [junitlauncher] Create the right number of listeners in the test definition representing the fork mode of "testclasses"
Patch contributed by mseele@guh-software.de as an attachment to the linked bugzilla
-rw-r--r--WHATSNEW5
-rw-r--r--src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java8
2 files changed, 10 insertions, 3 deletions
diff --git a/WHATSNEW b/WHATSNEW
index 86f2e4c26..7b5d45fe9 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -7,6 +7,11 @@ Fixed bugs:
* FTP task no longer duplicates a check for a file being a symlink.
Bugzilla Report 63259
+ * junitlauncher task, when used in fork mode with "<testclasses>",
+ used to create the wrong number of listeners per test class. This
+ has now been fixed.
+ Bugzilla Report 63446
+
Changes from Ant 1.10.5 TO Ant 1.10.6
=====================================
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java
index f119a348b..96eddcdc8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java
@@ -110,12 +110,13 @@ public class TestClasses extends TestDefinition {
public static List<TestDefinition> fromForkedRepresentation(final XMLStreamReader reader) throws XMLStreamException {
reader.require(XMLStreamConstants.START_ELEMENT, null, LD_XML_ELM_TEST_CLASSES);
- final TestClasses testDefinition = new TestClasses();
+ final List<TestDefinition> testDefinitions = new ArrayList<>();
// read out as multiple SingleTestClass representations
while (reader.nextTag() != XMLStreamConstants.END_ELEMENT) {
+ final SingleTestClass testDefinition = new SingleTestClass();
reader.require(XMLStreamConstants.START_ELEMENT, null, Constants.LD_XML_ELM_TEST);
final String testClassName = requireAttributeValue(reader, LD_XML_ATTR_CLASS_NAME);
- testDefinition.add(new StringResource(testClassName + ".class"));
+ testDefinition.setName(testClassName);
final String halt = reader.getAttributeValue(null, LD_XML_ATTR_HALT_ON_FAILURE);
if (halt != null) {
testDefinition.setHaltOnFailure(Boolean.parseBoolean(halt));
@@ -137,9 +138,10 @@ public class TestClasses extends TestDefinition {
testDefinition.addConfiguredListener(ListenerDefinition.fromForkedRepresentation(reader));
}
reader.require(XMLStreamConstants.END_ELEMENT, null, Constants.LD_XML_ELM_TEST);
+ testDefinitions.add(testDefinition);
}
reader.require(XMLStreamConstants.END_ELEMENT, null, LD_XML_ELM_TEST_CLASSES);
- return Collections.singletonList(testDefinition);
+ return Collections.unmodifiableList(testDefinitions);
}
private static String requireAttributeValue(final XMLStreamReader reader, final String attrName) throws XMLStreamException {