This is an automated email from the ASF dual-hosted git repository.
jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 03a718d bz-63446 [junitlauncher] Create the right number of listeners
in the test definition representing the fork mode of "testclasses"
03a718d is described below
commit 03a718d88dbc5c15e2085eaa292b160c8608b998
Author: Jaikiran Pai <[email protected]>
AuthorDate: Tue May 21 14:47:29 2019 +0530
bz-63446 [junitlauncher] Create the right number of listeners in the test
definition representing the fork mode of "testclasses"
Patch contributed by [email protected] as an attachment to
the linked bugzilla
---
WHATSNEW | 5 +++++
.../ant/taskdefs/optional/junitlauncher/confined/TestClasses.java | 8 +++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/WHATSNEW b/WHATSNEW
index 86f2e4c..7b5d45f 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 f119a34..96eddcd 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 {