org.jboss.test.selenium.guard.request
Class RequestTypeGuard

java.lang.Object
  extended by org.jboss.test.selenium.guard.request.RequestTypeGuard
All Implemented Interfaces:
CommandInterceptor

public class RequestTypeGuard
extends Object
implements CommandInterceptor

The Guard which guards that request what was expected to be done will be actually done.

Version:
$Revision$
Author:
Lukas Fryc

Constructor Summary
RequestTypeGuard(RequestType requestExpected, boolean interlayed)
          Constructs the guard with predefined expected RequestType
 
Method Summary
 void doAfterCommand()
           Waits for changing the requestDone flag (or for timeout, when flag stay to be NONE).
 void doBeforeCommand()
          Install the PageExtensions (which is used to figure out, what requestType was actually done) and clear the request type to NONE state.
 void intercept(CommandContext ctx)
          Enfolds the command with guarding code to detect request type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestTypeGuard

public RequestTypeGuard(RequestType requestExpected,
                        boolean interlayed)
Constructs the guard with predefined expected RequestType

Parameters:
requestExpected - the RequestType which is expected to be done
interlayed - indicates whenever the request can be interlayed by another request
Method Detail

intercept

public void intercept(CommandContext ctx)
               throws CommandInterceptionException
Enfolds the command with guarding code to detect request type

Specified by:
intercept in interface CommandInterceptor
Parameters:
ctx - the current command context
Throws:
CommandInterceptionException - if the subsequent interceptor doesn't call CommandContext.invoke() in it's CommandInterceptor.intercept(CommandContext) method body.

doBeforeCommand

public void doBeforeCommand()
Install the PageExtensions (which is used to figure out, what requestType was actually done) and clear the request type to NONE state.


doAfterCommand

public void doAfterCommand()

Waits for changing the requestDone flag (or for timeout, when flag stay to be NONE).

Then figure out what requestType was actually done and compare to expected one.

Throws:
RequestTypeGuardException - when done requestType doesn't equal to expected one


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.