org.openqa.grid.selenium.proxy
Class WebRemoteProxy

java.lang.Object
  extended by org.openqa.grid.internal.RemoteProxy
      extended by org.openqa.grid.selenium.proxy.WebRemoteProxy
All Implemented Interfaces:
java.lang.Comparable<RemoteProxy>, CommandListener, SelfHealingProxy, TimeoutListener
Direct Known Subclasses:
SeleniumRemoteProxy, WebDriverRemoteProxy

public abstract class WebRemoteProxy
extends RemoteProxy
implements TimeoutListener, SelfHealingProxy, CommandListener


Field Summary
 
Fields inherited from class org.openqa.grid.internal.RemoteProxy
remoteURL
 
Constructor Summary
WebRemoteProxy(RegistrationRequest request, Registry registry)
           
 
Method Summary
 void addNewEvent(RemoteException event)
          Allow to record when something important about the remote state is detected.
 void afterCommand(TestSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Executed just before the forwards returns.
 void beforeCommand(TestSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Executed before the hub forwards the request.
abstract  void beforeRelease(TestSession session)
          Gives a chance to clean the resources on the remote when the session has timed out.
 HtmlRenderer getHtmlRender()
           
 TestSession getNewSession(java.util.Map<java.lang.String,java.lang.Object> requestedCapability)
          overwrites the session allocation to discard the proxy that are down.
 boolean isAlive()
           
 boolean isDown()
           
 void onEvent(java.util.List<RemoteException> events, RemoteException lastInserted)
          Allow to process the list of all the events that were detected on this Remote so far.
 void startPolling()
          start/restart the polling for the remote proxy.
 void stopPolling()
          put the polling on hold.
 
Methods inherited from class org.openqa.grid.internal.RemoteProxy
compareTo, equals, getCapabilityHelper, getConfig, getId, getMaxNumberOfConcurrentTestSessions, getNewInstance, getOriginalRegistrationRequest, getRegistry, getRemoteURL, getTestSlots, getTimeOut, getTotalUsed, hashCode, isBusy, setCapabilityHelper, setId, teardown, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebRemoteProxy

public WebRemoteProxy(RegistrationRequest request,
                      Registry registry)
Method Detail

beforeRelease

public abstract void beforeRelease(TestSession session)
Description copied from interface: TimeoutListener
Gives a chance to clean the resources on the remote when the session has timed out.

Is executed before the session is released to the hub. If an exception is thrown, the slot that was associated with the session is considered corrupted and won't be released for future use.

You can check session.getInternalKey before timing out. internalkey==null usually means the initial POST /session hasn't been completed yet.For instance if you use web driver, that means the browser is in the process of being started. During that state, you can't really clean the resources properly.

Specified by:
beforeRelease in interface TimeoutListener

afterCommand

public void afterCommand(TestSession session,
                         javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
Description copied from interface: CommandListener
Executed just before the forwards returns.

Throwing an exception will result in an error for the client.

Specified by:
afterCommand in interface CommandListener

beforeCommand

public void beforeCommand(TestSession session,
                          javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
Description copied from interface: CommandListener
Executed before the hub forwards the request. reading the content of the request stream will prevent the content from being forwarded.

Throwing an exception will prevent the forward to the remote.

Specified by:
beforeCommand in interface CommandListener

getHtmlRender

public HtmlRenderer getHtmlRender()
Overrides:
getHtmlRender in class RemoteProxy

isAlive

public boolean isAlive()

startPolling

public void startPolling()
Description copied from interface: SelfHealingProxy
start/restart the polling for the remote proxy. A typical poll will try to contact the remote proxy to see if it's still accessible, but it can have more logic in it, like checking the resource usage ( RAM etc) on the remote.

Specified by:
startPolling in interface SelfHealingProxy

stopPolling

public void stopPolling()
Description copied from interface: SelfHealingProxy
put the polling on hold.

Specified by:
stopPolling in interface SelfHealingProxy

addNewEvent

public void addNewEvent(RemoteException event)
Description copied from interface: SelfHealingProxy
Allow to record when something important about the remote state is detected.

Specified by:
addNewEvent in interface SelfHealingProxy

onEvent

public void onEvent(java.util.List<RemoteException> events,
                    RemoteException lastInserted)
Description copied from interface: SelfHealingProxy
Allow to process the list of all the events that were detected on this Remote so far. A typical implementation of this method will be to put the proxy on hold if the network connection is bad, or to restart the remote if the resources used are too important

Specified by:
onEvent in interface SelfHealingProxy

getNewSession

public TestSession getNewSession(java.util.Map<java.lang.String,java.lang.Object> requestedCapability)
overwrites the session allocation to discard the proxy that are down.

Overrides:
getNewSession in class RemoteProxy
Returns:
a new TestSession if possible, null otherwise

isDown

public boolean isDown()


Copyright © 2011. All Rights Reserved.