-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1580 from krmahadevan/krmahadevan-remove-synchron…
…ized-locks Removed sync locks as and where possible.
- Loading branch information
Showing
13 changed files
with
238 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package org.testng; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
/** | ||
* A state object that records the status of the suite run. Mainly used to | ||
* figure out if there are any @BeforeSuite failures. | ||
*/ | ||
public class SuiteRunState { | ||
|
||
private boolean m_hasFailures; | ||
private final AtomicBoolean m_hasFailures = new AtomicBoolean(); | ||
|
||
public synchronized void failed() { | ||
m_hasFailures= true; | ||
public void failed() { | ||
m_hasFailures.set(true); | ||
} | ||
|
||
public synchronized boolean isFailed() { | ||
return m_hasFailures; | ||
public boolean isFailed() { | ||
return m_hasFailures.get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.testng; | ||
|
||
import org.testng.collections.Lists; | ||
import org.testng.collections.Objects; | ||
import org.testng.internal.IResultListener2; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.concurrent.ConcurrentLinkedQueue; | ||
|
||
|
||
/** | ||
|
@@ -25,16 +25,15 @@ | |
* @author <a href='mailto:[email protected]'>Alexandru Popescu</a> | ||
*/ | ||
public class TestListenerAdapter implements IResultListener2 { | ||
private List<ITestNGMethod> m_allTestMethods = | ||
Collections.synchronizedList(Lists.<ITestNGMethod>newArrayList()); | ||
private List<ITestResult> m_passedTests = Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private List<ITestResult> m_failedTests = Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private List<ITestResult> m_skippedTests = Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private List<ITestResult> m_failedButWSPerTests = Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private List<ITestContext> m_testContexts= Collections.synchronizedList(new ArrayList<ITestContext>()); | ||
private List<ITestResult> m_failedConfs= Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private List<ITestResult> m_skippedConfs= Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private List<ITestResult> m_passedConfs= Collections.synchronizedList(Lists.<ITestResult>newArrayList()); | ||
private Collection<ITestNGMethod> m_allTestMethods = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_passedTests = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_failedTests = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_skippedTests = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_failedButWSPerTests = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestContext> m_testContexts = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_failedConfs = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_skippedConfs = new ConcurrentLinkedQueue<>(); | ||
private Collection<ITestResult> m_passedConfs = new ConcurrentLinkedQueue<>(); | ||
|
||
@Override | ||
public void onTestSuccess(ITestResult tr) { | ||
|
@@ -138,11 +137,11 @@ public void onTestStart(ITestResult result) { | |
} | ||
|
||
public List<ITestContext> getTestContexts() { | ||
return m_testContexts; | ||
return new ArrayList<>(m_testContexts); | ||
} | ||
|
||
public List<ITestResult> getConfigurationFailures() { | ||
return m_failedConfs; | ||
return new ArrayList<>(m_failedConfs); | ||
} | ||
|
||
/** | ||
|
@@ -154,7 +153,7 @@ public void onConfigurationFailure(ITestResult itr) { | |
} | ||
|
||
public List<ITestResult> getConfigurationSkips() { | ||
return m_skippedConfs; | ||
return new ArrayList<>(m_skippedConfs); | ||
} | ||
|
||
@Override | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.