org.jboss.portal.test.framework.driver.remote
Class TestContext

java.lang.Object
  extended by org.jboss.portal.test.framework.driver.remote.TestContext
All Implemented Interfaces:
java.io.Serializable

public class TestContext
extends java.lang.Object
implements java.io.Serializable

Version:
$Revision: 1.1 $
Author:
Julien Viet
See Also:
Serialized Form

Field Summary
protected  java.lang.String archivePath
          The path where archive we want to deploy are.
protected  TestParametrization parametrization
          The test parametrization.
protected  int requestCount
          The test count.
protected  DriverResponse response
          The test response.
 TestAgent testAgent
          The test agent, normally only valid in the server side for now.
 
Constructor Summary
TestContext(int requestCount, java.lang.String archivePath, TestParametrization parametrization, java.util.Map attributes)
          Normally used on the client side.
TestContext(TestContext that)
          Copy constructor.
 
Method Summary
 void deploy(java.lang.String archiveId)
           
 java.lang.String getArchivePath()
           
 java.lang.Object getAttribute(java.lang.String name)
           
 TestParametrization getParametrization()
           
 int getRequestCount()
          Return the test count.
 DriverResponse getResponse()
          Return the response.
 boolean isRequestCount(int count)
          Return true if the request count is equals to the specified value.
 void removeAttribute(java.lang.String name)
           
 java.lang.String rewriteURLForNode(java.lang.String url, NodeId nodeId)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setResponse(DriverResponse response)
           
 java.lang.String toString()
           
 void undeploy(java.lang.String archiveId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

requestCount

protected int requestCount
The test count.


response

protected DriverResponse response
The test response.


archivePath

protected java.lang.String archivePath
The path where archive we want to deploy are.


parametrization

protected TestParametrization parametrization
The test parametrization.


testAgent

public transient TestAgent testAgent
The test agent, normally only valid in the server side for now. It is transient so it is not marshalled when the context is popped on the client by TestDriverServer.popContext() It is package protected so it can be set by the TestDriverServer.pushContext(...) method.

Constructor Detail

TestContext

public TestContext(TestContext that)
Copy constructor.


TestContext

public TestContext(int requestCount,
                   java.lang.String archivePath,
                   TestParametrization parametrization,
                   java.util.Map attributes)
Normally used on the client side.

Method Detail

getParametrization

public TestParametrization getParametrization()

getArchivePath

public java.lang.String getArchivePath()

getRequestCount

public int getRequestCount()
Return the test count.

Returns:
the test count

isRequestCount

public boolean isRequestCount(int count)
Return true if the request count is equals to the specified value.

Parameters:
count - the expected count
Returns:
true if the expected count is equals to the actual count
Throws:
java.lang.IllegalStateException

getAttribute

public java.lang.Object getAttribute(java.lang.String name)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)

removeAttribute

public void removeAttribute(java.lang.String name)

getResponse

public DriverResponse getResponse()
Return the response.

Returns:
the response of the test

setResponse

public void setResponse(DriverResponse response)

rewriteURLForNode

public java.lang.String rewriteURLForNode(java.lang.String url,
                                          NodeId nodeId)
                                   throws java.net.MalformedURLException
Parameters:
url - the url to rewrite
nodeId - the node id
Returns:
the rewritten url
Throws:
java.net.MalformedURLException
java.lang.IllegalArgumentException - if the url is null or the node id not recognized

deploy

public void deploy(java.lang.String archiveId)
            throws java.net.MalformedURLException,
                   java.lang.IllegalStateException,
                   java.lang.Exception
Throws:
java.net.MalformedURLException
java.lang.IllegalStateException
java.lang.Exception

undeploy

public void undeploy(java.lang.String archiveId)
              throws java.net.MalformedURLException,
                     java.lang.IllegalStateException,
                     java.lang.Exception
Throws:
java.net.MalformedURLException
java.lang.IllegalStateException
java.lang.Exception

toString

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