edu.sdsc.inca
Class ConsumerTest.MockAgent

java.lang.Object
  extended by java.lang.Thread
      extended by edu.sdsc.inca.ConsumerTest.MockAgent
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
ConsumerTest

public static class ConsumerTest.MockAgent
extends java.lang.Thread

Use to emulate a real agent. Can be customized to serve a specific resources file from the GETCONFIG command with a certain amount of delay.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 boolean isReady
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ConsumerTest.MockAgent(int numConnections, int port)
          Create a new mock agent.
 
Method Summary
 java.lang.String getUri()
          Return the uri of the mock agent
 void run()
          Functionality of mock server.
 void setDelay(int delay)
          Set an artifical delay in the return of the GETCONFIG request.
 void setResourceConfig(edu.sdsc.inca.dataModel.resourceConfig.ResourceConfig resourceConfig)
          Set the resources that should be returned in the Inca configuration XML in response to GETCONFIG command.
 void setSuites(java.lang.String[] suites)
          Set the suites that should be returned in the Inca configuration XML in response to GETCONFIG command.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isReady

public boolean isReady
Constructor Detail

ConsumerTest.MockAgent

public ConsumerTest.MockAgent(int numConnections,
                              int port)
Create a new mock agent.

Parameters:
numConnections - The number of connections we expect to receive.
port - The port to start the mock depot on.
Method Detail

getUri

public java.lang.String getUri()
Return the uri of the mock agent

Returns:
A string containing the uri of the mock agent.

run

public void run()
Functionality of mock server. Recognizes GETCONFIG and PING.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setDelay

public void setDelay(int delay)
Set an artifical delay in the return of the GETCONFIG request.

Parameters:
delay - The number of milliseconds to wait before returning the Inca configuration document.

setResourceConfig

public void setResourceConfig(edu.sdsc.inca.dataModel.resourceConfig.ResourceConfig resourceConfig)
Set the resources that should be returned in the Inca configuration XML in response to GETCONFIG command.

Parameters:
resourceConfig - The resources to return to the agent client.

setSuites

public void setSuites(java.lang.String[] suites)
Set the suites that should be returned in the Inca configuration XML in response to GETCONFIG command.

Parameters:
suites - The suites to return to the agent client.