ostore.apps.test
Class ReadWriteTest

java.lang.Object
  |
  +--ostore.apps.test.ReadWriteTest
All Implemented Interfaces:
EventHandlerIF, SingleThreadedEventHandlerIF

public class ReadWriteTest
extends Object
implements EventHandlerIF, SingleThreadedEventHandlerIF

The ReadWriteTest is a simple OceanStore application that alternately writes data into a data object and then read data from the data object. After registering itself as an application with the ClientStage, it creates a data object with initial data. Then, based on a random number generator, it chooses to create another data object or perform an operation on an existing data object. If it selects to operate on an existing data object, it randomly selects an existing data object. If that data object was last updated (or created), it is read; if that data object was last read, it is updated. Updates are ramdomly chosen to be append or replace operations. The range of data requested by a read overlaps completely the region modified by the last update.

All requests are treated as synchronous; that is, no further requests are made until the response for the outstanding request is received.

The local file system mirrors all data objects so that the application can verify the results of the reads.

Initialization Parameters: The behavior of the ReadWriteTest is controlled by the following initialization parameters.

TestLength
The number of events to execute. If TestLength is zero, the test will continue indefinately.
MaxObjects
An int used as the maximum number of data objects to create.
RandomSeed
An int used as the random seed for the random number generator.
RP_Pkeyfile
The full path to a file storing a representation of the responsible party's public key.
Principal_Pkeyfile
The full path to a file storing a representation of the principal's public key.
Principal_Skeyfile
The full path to a file storing a representation of the principal's private (secret) key.

Version:
$Id: ReadWriteTest.java,v 1.18 2004/05/13 19:42:42 hweather Exp $
Author:
Patrick R. Eaton

Constructor Summary
ReadWriteTest()
           
 
Method Summary
 void destroy()
           
 void handleEvent(QueueElementIF element)
           
 void handleEvents(QueueElementIF[] element_array)
           
 void init(ConfigDataIF config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadWriteTest

public ReadWriteTest()
Method Detail

handleEvent

public void handleEvent(QueueElementIF element)
                 throws EventHandlerException
Specified by:
handleEvent in interface EventHandlerIF
EventHandlerException

handleEvents

public void handleEvents(QueueElementIF[] element_array)
                  throws EventHandlerException
Specified by:
handleEvents in interface EventHandlerIF
EventHandlerException

init

public void init(ConfigDataIF config)
          throws Exception
Specified by:
init in interface EventHandlerIF
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface EventHandlerIF
Exception