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 GridRegistry.
Unfortunately the CleanUpThread also messes around in here, so it should be thread safe on its
own.
Constructor and Description |
---|
TestSlot(RemoteProxy proxy,
SeleniumProtocol protocol,
java.util.Map<java.lang.String,java.lang.Object> capabilities)
Create a new test slot
|
TestSlot(RemoteProxy proxy,
SeleniumProtocol protocol,
java.lang.String path,
java.util.Map<java.lang.String,java.lang.Object> capabilities)
Create a new test slot specifying a custom protocol path
|
Modifier and Type | Method and Description |
---|---|
void |
doFinishRelease()
Finish releasing all resources so the slot can be reused.
|
void |
finishReleaseProcess()
releasing all the resources.
|
java.util.Map<java.lang.String,java.lang.Object> |
getCapabilities() |
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.
|
boolean |
matches(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities) |
boolean |
performAfterSessionEvent() |
boolean |
startReleaseProcess()
Starts the release process for the TestSlot.
|
java.lang.String |
toString() |
public TestSlot(RemoteProxy proxy, SeleniumProtocol protocol, java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> capabilities)
proxy
- the RemoteProxy
which includes this test slotprotocol
- the SeleniumProtocol
this test slot conforms topath
- the protocol path this test slot usescapabilities
- capabilities of this test slotpublic TestSlot(RemoteProxy proxy, SeleniumProtocol protocol, java.util.Map<java.lang.String,java.lang.Object> capabilities)
proxy
- the RemoteProxy
which includes this test slotprotocol
- the SeleniumProtocol
this test slot conforms tocapabilities
- capabilities of this test slotpublic java.util.Map<java.lang.String,java.lang.Object> getCapabilities()
public RemoteProxy getProxy()
RemoteProxy
that hosts this slot.public TestSession getNewSession(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
CapabilityMatcher.matches(Map, Map)
is
invoked.
Use GridHubConfiguration.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()
public boolean matches(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
desiredCapabilities
- capabilities for the new sessionRemoteProxy.getCapabilityHelper()
public TestSession getSession()
public boolean startReleaseProcess()
That gives time to run exactly once the cleanup operation needed using @see
TestSessionListener.afterSession(TestSession)
finishReleaseProcess()
public void finishReleaseProcess()
public void doFinishRelease()
public java.lang.String getInternalKey()
public boolean performAfterSessionEvent()
TestSessionListener
events on this test slotpublic java.lang.String toString()
toString
in class java.lang.Object
public java.net.URL getRemoteURL()
public long getLastSessionStart()