org.openqa.grid.internal
Class RemoteProxy

java.lang.Object
  extended by org.openqa.grid.internal.RemoteProxy
All Implemented Interfaces:
Comparable<RemoteProxy>
Direct Known Subclasses:
WebRemoteProxy

public class RemoteProxy
extends Object
implements Comparable<RemoteProxy>

Proxy to a remote server executing the tests. The proxy keeps a state of what is happening on the remote server and knows if a new test can be run on the remote server. There are several reasons why a test could not be run on the specified remote server, for instance: if the RemoteProxy decides the remote server has reached the maximum number of concurrent sessions, or if the client has requested DesiredCapabilities we don't support e.g. asking for Chrome when we only support Firefox.


Field Summary
protected  URL remoteURL
           
 
Constructor Summary
RemoteProxy(RegistrationRequest request, Registry registry)
          Create the proxy from the info sent by the remote.
 
Method Summary
 int compareTo(RemoteProxy o)
           
 boolean equals(Object obj)
           
 CapabilityMatcher getCapabilityHelper()
           
 Map<String,Object> getConfig()
           
 HtmlRenderer getHtmlRender()
           
 String getId()
          get the unique id for the node.
 int getMaxNumberOfConcurrentTestSessions()
          return the max number of tests that can run on this remote at a given time.
static
<T extends RemoteProxy>
T
getNewInstance(RegistrationRequest request, Registry registry)
          Takes a registration request and return the RemoteProxy associated to it.
 TestSession getNewSession(Map<String,Object> requestedCapability)
          return a new test session if the current proxy has the resources and is ready to run the test.
 RegistrationRequest getOriginalRegistrationRequest()
          return the registration request that created the proxy in the first place.
 Registry getRegistry()
           
 URL getRemoteURL()
           
 List<TestSlot> getTestSlots()
           
 int getTimeOut()
          im millis
 int getTotalUsed()
          returns the total number of test slots used on this proxy
 int hashCode()
           
protected  boolean isBusy()
           
 void setCapabilityHelper(CapabilityMatcher capabilityHelper)
           
protected  void setId(String id)
           
 void teardown()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

remoteURL

protected URL remoteURL
Constructor Detail

RemoteProxy

public RemoteProxy(RegistrationRequest request,
                   Registry registry)
Create the proxy from the info sent by the remote. If maxSession is not specified, default to 1 = max number of tests running at a given time will be 1. For each capability, maxInstances is defaulted to 1 if not specified = max number of test of each capability running at a time will be 1. maxInstances for firefox can be > 1. IE won't support it.

Parameters:
request -
Method Detail

getTestSlots

public List<TestSlot> getTestSlots()

getRegistry

public Registry getRegistry()

getCapabilityHelper

public CapabilityMatcher getCapabilityHelper()

setCapabilityHelper

public void setCapabilityHelper(CapabilityMatcher capabilityHelper)

getId

public String getId()
get the unique id for the node. Usually the url it listen on is a good id. If the network keeps changing and the IP of the node is updated, you need to define nodes with a different id.

Returns:

setId

protected void setId(String id)

teardown

public void teardown()

getConfig

public Map<String,Object> getConfig()

getOriginalRegistrationRequest

public RegistrationRequest getOriginalRegistrationRequest()
return the registration request that created the proxy in the first place.

Returns:

getMaxNumberOfConcurrentTestSessions

public int getMaxNumberOfConcurrentTestSessions()
return the max number of tests that can run on this remote at a given time.


getRemoteURL

public URL getRemoteURL()
Returns:
the URL the remote listens on.

getNewSession

public TestSession getNewSession(Map<String,Object> requestedCapability)
return a new test session if the current proxy has the resources and is ready to run the test.

Parameters:
requestedCapability -
Returns:
a new TestSession if possible, null otherwise

getTotalUsed

public int getTotalUsed()
returns the total number of test slots used on this proxy

Returns:

isBusy

protected boolean isBusy()
Returns:
true if the remote does something. busy = true doesn't prevent the remote from accepting more tasks.

getNewInstance

public static final <T extends RemoteProxy> T getNewInstance(RegistrationRequest request,
                                                             Registry registry)
Takes a registration request and return the RemoteProxy associated to it. It can be any class extending RemoteProxy.

Type Parameters:
T -
Parameters:
request -
Returns:
a new instance built from the request.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(RemoteProxy o)
Specified by:
compareTo in interface Comparable<RemoteProxy>

toString

public String toString()
Overrides:
toString in class Object

getHtmlRender

public HtmlRenderer getHtmlRender()

getTimeOut

public int getTimeOut()
im millis

Returns:


Copyright © 2011. All Rights Reserved.