Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.p2p.commonapi.testing
Class CommonAPITest

    java.lang.Object
      rice.p2p.commonapi.testing.CommonAPITest

Direct Known Subclasses:
  PastRegrTest, RawPastRegrTest, ReplicationManagerRegrTest, ReplicationRegrTest, ScribeRegrTest, SplitStreamRegrTest

    public abstract class CommonAPITest

extends java.lang.Object

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.

Version:
  $Id: CommonAPITest.java 3832 2007-08-27 12:25:35Z jeffh $
Author:
  Alan Mislove

Field Summary
`java.net.InetSocketAddress` | `BOOTSTRAP`
`static int` | `BOOTSTRAP_PORT`
`protected Environment` | `environment`
`protected PastryNodeFactory` | `factory`
`IdFactory` | `FACTORY`
`static java.lang.String` | `FAILURE`
`protected NodeIdFactory` | `idFactory`
`static java.lang.String` | `INSTANCE_NAME`
`static int` | `LEASE_PERIOD`
`protected Logger` | `logger`
`protected Node[]` | `nodes`
`int` | `NUM_NODES`
`protected static int` | `PAD_SIZE`
`protected Parameters` | `params`
`int` | `PORT`
`java.lang.String` | `PROTOCOL`
`static java.lang.String` | `PROTOCOL_DIRECT`
`protected NetworkSimulator` | `simulator`
`java.lang.String` | `SIMULATOR`
`static java.lang.String` | `SIMULATOR_EUCLIDEAN`
`static java.lang.String` | `SIMULATOR_GT_ITM`
`static java.lang.String` | `SIMULATOR_SPHERE`
`static java.lang.String` | `SUCCESS`
`static int` | `TIME_TO_FIND_FAULTY`

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.
`void` | `setupParams(Environment env)`
`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.
`void` | `waitOnClock(int time)`
`void` | `waitToRecoverFromKilling(int additionalTime)` Nodes will be non-ready for a while after killing.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### nodes

    protected Node[] nodes

### factory

    protected PastryNodeFactory factory

### idFactory

    protected NodeIdFactory idFactory

### simulator

    protected NetworkSimulator simulator

### environment

    protected Environment environment

### params

    protected Parameters params

### NUM_NODES

    public int NUM_NODES

### FACTORY

    public final IdFactory FACTORY

### SUCCESS

    public static final java.lang.String SUCCESS

See Also:
  Constant Field Values

### FAILURE

    public static final java.lang.String FAILURE

See Also:
  Constant Field Values

### PAD_SIZE

    protected static final int PAD_SIZE

See Also:
  Constant Field Values

### PROTOCOL_DIRECT

    public static final java.lang.String PROTOCOL_DIRECT

See Also:
  Constant Field Values

### SIMULATOR_SPHERE

    public static final java.lang.String SIMULATOR_SPHERE

See Also:
  Constant Field Values

### SIMULATOR_EUCLIDEAN

    public static final java.lang.String SIMULATOR_EUCLIDEAN

See Also:
  Constant Field Values

### SIMULATOR_GT_ITM

    public static final java.lang.String SIMULATOR_GT_ITM

See Also:
  Constant Field Values

### PORT

    public int PORT

### BOOTSTRAP

    public java.net.InetSocketAddress BOOTSTRAP

### BOOTSTRAP_PORT

    public static int BOOTSTRAP_PORT

### PROTOCOL

    public java.lang.String PROTOCOL

### SIMULATOR

    public java.lang.String SIMULATOR

### INSTANCE_NAME

    public static java.lang.String INSTANCE_NAME

### logger

    protected Logger logger

### LEASE_PERIOD

    public static final int LEASE_PERIOD

See Also:
  Constant Field Values

### TIME_TO_FIND_FAULTY

    public static final int TIME_TO_FIND_FAULTY

See Also:
  Constant Field Values

Constructor Detail

### CommonAPITest

    public CommonAPITest(Environment env)
                  throws java.io.IOException

  Constructor, which takes no arguments and sets up the factories in preparation for node creation.

  Throws:
    `java.io.IOException`

Method Detail

### waitToRecoverFromKilling

    public void waitToRecoverFromKilling(int additionalTime)

  Nodes will be non-ready for a while after killing. Need to account for this in the test. wait for LEASE+TimeToFindFaulty+periodic protocol

### waitOnClock

    public void waitOnClock(int time)

### setupParams

    public void setupParams(Environment env)

### createNodes

    public void createNodes()

  Method which creates the nodes

### start

    public void start()

  Method which starts the creation of nodes

### simulate

    protected void simulate()

  In case we're using the direct simulator, this method simulates the message passing.

### createNode

    protected Node createNode(int num)

  Method which creates a single node, given it's node number

  Parameters:
    `num` - The number of creation order
  Returns:
    The created node

### getBootstrap

    protected NodeHandle getBootstrap()

  Gets a handle to a bootstrap node.

  Returns:
    handle to bootstrap node, or null.

### pause

    protected void pause(int ms)

  Method which pauses for the provided number of milliseconds

  Parameters:
    `ms` - The number of milliseconds to pause

### kill

    protected void kill(int n)

  Method which kills the specified node

  Parameters:
    `n` - The node to kill

### processNode

    protected abstract void processNode(int num,
                                        Node node)

  Method which should process the given newly-created node

  Parameters:
    `num` - The number o the node
    `node` - The newly created node

### runTest

    protected abstract void runTest()

  Method which should run the test - this is called once all of the nodes have been created and are ready.

### sectionStart

    protected final void sectionStart(java.lang.String name)

  Method which prints the beginning of a test section.

  Parameters:
    `name` - The name of section

### sectionDone

    protected final void sectionDone()

  Method which prints the end of a test section.

### stepStart

    protected final void stepStart(java.lang.String name)

  Method which prints the beginning of a test section step.

  Parameters:
    `name` - The name of step

### stepDone

    protected final void stepDone()

  Method which prints the end of a test section step, with an assumed success.

### stepDone

    protected final void stepDone(java.lang.String status)

  Method which prints the end of a test section step.

  Parameters:
    `status` - The status of step

### stepDone

    protected final 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.

  Parameters:
    `status` - The status of section
    `message` - The message

### stepException

    protected final void stepException(java.lang.Exception e)

  Method which prints an exception which occured during testing.

  Parameters:
    `e` - The exception which was thrown

### assertTrue

    protected final void assertTrue(java.lang.String intention,
                                    boolean test)

  Throws an exception if the test condition is not met.

### assertEquals

    protected final void assertEquals(java.lang.String description,
                                      java.lang.Object expected,
                                      java.lang.Object actual)

  Thows an exception if expected is not equal to actual.

### parseArgs

    protected static Environment parseArgs(java.lang.String[] args)
                                    throws java.io.IOException

  process command line args

  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.