|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.commonapi.testing.CommonAPITest
Provides regression testing setup for applications written on top of the commonapi. Currently is written to use Pastry nodes, but this will be abstracted away.
Field Summary | |
java.net.InetSocketAddress |
BOOTSTRAP
DESCRIBE THE FIELD |
static int |
BOOTSTRAP_PORT
DESCRIBE THE FIELD |
protected Environment |
environment
DESCRIBE THE FIELD |
protected PastryNodeFactory |
factory
DESCRIBE THE FIELD |
IdFactory |
FACTORY
DESCRIBE THE FIELD |
static java.lang.String |
FAILURE
DESCRIBE THE FIELD |
protected NodeIdFactory |
idFactory
DESCRIBE THE FIELD |
static java.lang.String |
INSTANCE_NAME
DESCRIBE THE FIELD |
protected Logger |
logger
DESCRIBE THE FIELD |
protected Node[] |
nodes
DESCRIBE THE FIELD |
int |
NUM_NODES
DESCRIBE THE FIELD |
protected static int |
PAD_SIZE
DESCRIBE THE FIELD |
protected Parameters |
params
DESCRIBE THE FIELD |
int |
PORT
DESCRIBE THE FIELD |
java.lang.String |
PROTOCOL
DESCRIBE THE FIELD |
static java.lang.String |
PROTOCOL_DIRECT
DESCRIBE THE FIELD |
protected NetworkSimulator |
simulator
DESCRIBE THE FIELD |
java.lang.String |
SIMULATOR
DESCRIBE THE FIELD |
static java.lang.String |
SIMULATOR_EUCLIDEAN
DESCRIBE THE FIELD |
static java.lang.String |
SIMULATOR_GT_ITM
DESCRIBE THE FIELD |
static java.lang.String |
SIMULATOR_SPHERE
DESCRIBE THE FIELD |
static java.lang.String |
SUCCESS
DESCRIBE THE FIELD |
Constructor Summary | |
CommonAPITest(Environment env)
Constructor, which takes no arguments and sets up the factories in preparation for node creation. |
Method Summary | |
protected void |
assertEquals(java.lang.String description,
java.lang.Object expected,
java.lang.Object actual)
Thows an exception if expected is not equal to actual. |
protected void |
assertTrue(java.lang.String intention,
boolean test)
Throws an exception if the test condition is not met. |
protected Node |
createNode(int num)
Method which creates a single node, given it's node number |
void |
createNodes()
Method which creates the nodes |
protected NodeHandle |
getBootstrap()
Gets a handle to a bootstrap node. |
protected void |
kill(int n)
Method which kills the specified node |
protected static Environment |
parseArgs(java.lang.String[] args)
process command line args |
protected void |
pause(int ms)
Method which pauses for the provided number of milliseconds |
protected abstract void |
processNode(int num,
Node node)
Method which should process the given newly-created node |
protected abstract void |
runTest()
Method which should run the test - this is called once all of the nodes have been created and are ready. |
protected void |
sectionDone()
Method which prints the end of a test section. |
protected void |
sectionStart(java.lang.String name)
Method which prints the beginning of a test section. |
protected void |
simulate()
In case we're using the direct simulator, this method simulates the message passing. |
void |
start()
Method which starts the creation of nodes |
protected void |
stepDone()
Method which prints the end of a test section step, with an assumed success. |
protected void |
stepDone(java.lang.String status)
Method which prints the end of a test section step. |
protected void |
stepDone(java.lang.String status,
java.lang.String message)
Method which prints the end of a test section step, as well as a message. |
protected void |
stepException(java.lang.Exception e)
Method which prints an exception which occured during testing. |
protected void |
stepStart(java.lang.String name)
Method which prints the beginning of a test section step. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Node[] nodes
protected PastryNodeFactory factory
protected NodeIdFactory idFactory
protected NetworkSimulator simulator
protected Environment environment
protected Parameters params
public int NUM_NODES
public final IdFactory FACTORY
public int PORT
public java.net.InetSocketAddress BOOTSTRAP
public java.lang.String PROTOCOL
public java.lang.String SIMULATOR
protected Logger logger
public static final java.lang.String SUCCESS
public static final java.lang.String FAILURE
protected static final int PAD_SIZE
public static final java.lang.String PROTOCOL_DIRECT
public static final java.lang.String SIMULATOR_SPHERE
public static final java.lang.String SIMULATOR_EUCLIDEAN
public static final java.lang.String SIMULATOR_GT_ITM
public static int BOOTSTRAP_PORT
public static java.lang.String INSTANCE_NAME
Constructor Detail |
public CommonAPITest(Environment env) throws java.io.IOException
env
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONMethod Detail |
protected NodeHandle getBootstrap()
public void createNodes()
public void start()
protected void simulate()
protected Node createNode(int num)
num
- The number of creation order
protected void pause(int ms)
ms
- The number of milliseconds to pauseprotected void kill(int n)
n
- The node to killprotected abstract void processNode(int num, Node node)
num
- The number o the nodenode
- The newly created nodeprotected abstract void runTest()
protected final void sectionStart(java.lang.String name)
name
- The name of sectionprotected final void sectionDone()
protected final void stepStart(java.lang.String name)
name
- The name of stepprotected final void stepDone()
protected final void stepDone(java.lang.String status)
status
- The status of stepprotected final void stepDone(java.lang.String status, java.lang.String message)
status
- The status of sectionmessage
- The messageprotected final void stepException(java.lang.Exception e)
e
- The exception which was thrownprotected final void assertTrue(java.lang.String intention, boolean test)
intention
- DESCRIBE THE PARAMETERtest
- DESCRIBE THE PARAMETERprotected final void assertEquals(java.lang.String description, java.lang.Object expected, java.lang.Object actual)
description
- DESCRIBE THE PARAMETERexpected
- DESCRIBE THE PARAMETERactual
- DESCRIBE THE PARAMETERprotected static Environment parseArgs(java.lang.String[] args) throws java.io.IOException
args
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTION
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |