Skip to content

Commit

Permalink
bz-63446 [junitlauncher] Create the right number of listeners in the …
Browse files Browse the repository at this point in the history
…test definition representing the fork mode of "testclasses"

Patch contributed by [email protected] as an attachment to
the linked bugzilla
  • Loading branch information
jaikiran committed May 21, 2019
1 parent 0259c0b commit 03a718d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions WHATSNEW
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@ protected void toForkedRepresentation(final JUnitLauncherTask task, final XMLStr

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));
Expand All @@ -137,9 +138,10 @@ public static List<TestDefinition> fromForkedRepresentation(final XMLStreamReade
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 {
Expand Down

0 comments on commit 03a718d

Please sign in to comment.