org.openqa.grid.internal
Class TestSlot

java.lang.Object
  extended by org.openqa.grid.internal.TestSlot

public class TestSlot
extends java.lang.Object

The entity on a proxy that can host a test session. A test slot has only 1 desired capabilities ( firefox or chrome for instance, but if a remoteproxy needs to support both, the remoteproxy will need 2 TestSlots ) A TestSlot can host 1 TestSession max at a time.

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.


Constructor Summary
TestSlot(RemoteProxy proxy, SeleniumProtocol protocol, java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> capabilities)
           
 
Method Summary
 void doFinishRelease()
           
 java.util.Map<java.lang.String,java.lang.Object> getCapabilities()
           
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestSlot

public TestSlot(RemoteProxy proxy,
                SeleniumProtocol protocol,
                java.lang.String path,
                java.util.Map<java.lang.String,java.lang.Object> capabilities)
Method Detail

getCapabilities

public java.util.Map<java.lang.String,java.lang.Object> getCapabilities()

getProxy

public RemoteProxy getProxy()
Returns:
the RemoteProxy that hosts this slot.

getNewSession

public 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. To define if the testslot can host the desired capabilites, CapabilityMatcher.matches(Map, Map) is invoked.

Use RemoteProxy.setCapabilityHelper(CapabilityMatcher) on the proxy histing the test slot to modify the definition of match

Parameters:
desiredCapabilities - capabilities for the new session
Returns:
a new session linked to that testSlot if possible, null otherwise.

getProtocol

public SeleniumProtocol getProtocol()
the type of protocol for the TestSlot.Ideally should always be webdriver, but can also be selenium1 protocol for backward compatibility purposes.

Returns:
the protocol for this TestSlot

getPath

public java.lang.String getPath()
the path the server is using to handle the request. Typically /wd/hub for a webdriver based protocol and /selenium-server/driver/ for a selenium1 based protocol

Returns:
the path the server is using for the requests of this slot.

getSession

public TestSession getSession()
get the test session currently executed on this test slot.

Returns:
the session. Null if the slot is not used at the moment.

doFinishRelease

public void doFinishRelease()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRemoteURL

public java.net.URL getRemoteURL()
get the full URL the underlying server is listening on for selenium / webdriver commands.

Returns:
the url


Copyright © 2011. All Rights Reserved.