Browse Source

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
master
Jaikiran Pai 6 years ago
parent
commit
03a718d88d
2 changed files with 10 additions and 3 deletions
  1. +5
    -0
      WHATSNEW
  2. +5
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java

+ 5
- 0
WHATSNEW View File

@@ -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
=====================================


+ 5
- 3
src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/TestClasses.java View File

@@ -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 {


Loading…
Cancel
Save