public class TestSlot
extends java.lang.Object
The listener (TestSessionListener
attached to the test session of this test slot is
thread safe. If 2 threads are trying to execute the before / after session, only 1 will be
executed.The other one will be discarded.
This class sees multiple threads but is currently sort-of protected by the lock in Registry.
Unfortunately the CleanUpThread also messes around in here, so it should be thread safe on its
own.
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
beingReleased |
private java.util.Map<java.lang.String,java.lang.Object> |
capabilities |
private TestSession |
currentSession |
private long |
lastSessionStart |
private java.util.concurrent.locks.Lock |
lock |
private static java.util.logging.Logger |
log |
private CapabilityMatcher |
matcher |
private java.lang.String |
path |
private SeleniumProtocol |
protocol |
private RemoteProxy |
proxy |
private boolean |
showWarning |
Constructor and Description |
---|
TestSlot(RemoteProxy proxy,
SeleniumProtocol protocol,
java.lang.String path,
java.util.Map<java.lang.String,java.lang.Object> capabilities) |
Modifier and Type | Method and Description |
---|---|
void |
doFinishRelease() |
(package private) void |
finishReleaseProcess()
releasing all the resources.
|
java.util.Map<java.lang.String,java.lang.Object> |
getCapabilities() |
(package private) java.lang.String |
getInternalKey() |
long |
getLastSessionStart() |
TestSession |
getNewSession(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
Try to get a new session for the test slot for the desired capability.
|
java.lang.String |
getPath()
the path the server is using to handle the request.
|
SeleniumProtocol |
getProtocol()
the type of protocol for the TestSlot.Ideally should always be webdriver, but can also be
selenium1 protocol for backward compatibility purposes.
|
RemoteProxy |
getProxy() |
java.net.URL |
getRemoteURL()
get the full URL the underlying server is listening on for selenium / webdriver commands.
|
TestSession |
getSession()
get the test session currently executed on this test slot.
|
(package private) boolean |
matches(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities) |
(package private) boolean |
performAfterSessionEvent() |
(package private) boolean |
startReleaseProcess()
Starts the release process for the TestSlot.
|
java.lang.String |
toString() |
private static final java.util.logging.Logger log
private final java.util.Map<java.lang.String,java.lang.Object> capabilities
private final RemoteProxy proxy
private final SeleniumProtocol protocol
private final java.lang.String path
private final CapabilityMatcher matcher
private final java.util.concurrent.locks.Lock lock
private volatile TestSession currentSession
volatile boolean beingReleased
private boolean showWarning
private long lastSessionStart
public TestSlot(RemoteProxy proxy, SeleniumProtocol protocol, java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> capabilities)
public java.util.Map<java.lang.String,java.lang.Object> getCapabilities()
public RemoteProxy getProxy()
public TestSession getNewSession(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
CapabilityMatcher.matches(Map, Map)
is
invoked.
Use GridHubConfiguration#setCapabilityMatcher(CapabilityMatcher)
on the proxy hosting the test slot to modify the definition of match
desiredCapabilities
- capabilities for the new sessionpublic SeleniumProtocol getProtocol()
public java.lang.String getPath()
boolean matches(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
desiredCapabilities
- capabilities for the new sessionRemoteProxy.getCapabilityHelper()
public TestSession getSession()
boolean startReleaseProcess()
That gives time to run exactly once the cleanup operation needed using @see
TestSessionListener.afterSession(TestSession)
finishReleaseProcess()
void finishReleaseProcess()
public void doFinishRelease()
java.lang.String getInternalKey()
boolean performAfterSessionEvent()
public java.lang.String toString()
toString
in class java.lang.Object
public java.net.URL getRemoteURL()
public long getLastSessionStart()