Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Minor code clean-ups #2919

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions testng-core-api/src/main/java/org/testng/Reporter.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package org.testng;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.testng.collections.Lists;
import org.testng.collections.Maps;
import org.testng.internal.Utils;
Expand Down Expand Up @@ -32,9 +31,9 @@ public class Reporter {
new InheritableThreadLocal<>();

/** All output logged in a sequential order. */
private static final List<String> m_output = new Vector<>();
private static final List<String> m_output = new LinkedList<>();

private static final Map<String, List<Integer>> m_methodOutputMap = Maps.newHashMap();
private static final Map<String, List<Integer>> m_methodOutputMap = Maps.newConcurrentMap();

private static boolean m_escapeHtml = false;
// This variable is responsible for persisting all output that is yet to be associated with any
Expand Down Expand Up @@ -77,7 +76,7 @@ private static synchronized void log(String s, ITestResult m) {
if (m == null) {
// Persist the output temporarily into a ThreadLocal String list.
if (m_orphanedOutput.get() == null) {
m_orphanedOutput.set(new ArrayList<>());
m_orphanedOutput.set(new LinkedList<>());
}
m_orphanedOutput.get().add(s);
return;
Expand All @@ -86,7 +85,7 @@ private static synchronized void log(String s, ITestResult m) {
// Synchronization needed to ensure the line number and m_output are updated atomically.
int n = getOutput().size();

List<Integer> lines = m_methodOutputMap.computeIfAbsent(m.id(), k -> Lists.newArrayList());
List<Integer> lines = m_methodOutputMap.computeIfAbsent(m.id(), k -> Lists.newLinkedList());

// Check if there was already some orphaned output for the current thread.
if (m_orphanedOutput.get() != null) {
Expand Down
2 changes: 0 additions & 2 deletions testng-core/src/main/java/org/testng/TestNG.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.testng.reporters.FailedReporter;
import org.testng.reporters.JUnitReportReporter;
import org.testng.reporters.PerSuiteXMLReporter;
import org.testng.reporters.SuiteHTMLReporter;
import org.testng.reporters.VerboseReporter;
import org.testng.reporters.XMLReporter;
import org.testng.reporters.jq.Main;
Expand Down Expand Up @@ -937,7 +936,6 @@ private void initializeDefaultListeners() {
this.exitCodeListener.failIfAllTestsSkipped();
}
if (m_useDefaultListeners) {
addReporter(SuiteHTMLReporter.class);
addReporter(Main.class);
addReporter(FailedReporter.class);
if (m_generateResultsPerSuite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
/**
* Reported designed to render self-contained HTML top down view of a testing suite.
*
* @deprecated - This reporter is being deprecated in favour of the newer {@link EmailableReporter2}
* @since 5.2
*/
@Deprecated
public class EmailableReporter implements IReporter {
private static final Logger L = Logger.getLogger(EmailableReporter.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@
/**
* This class implements an HTML reporter for suites.
*
* @deprecated - This reporter is deprecated as of TestNG <code>7.9.0</code> in favour of {@link
* org.testng.reporters.jq.Main}
* @author cbeust
* @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a>
*/
@Deprecated
public class SuiteHTMLReporter implements IReporter {
public static final String METHODS_CHRONOLOGICAL = "methods.html";
public static final String METHODS_ALPHABETICAL = "methods-alphabetical.html";
Expand Down