ParkNPark.tests
Class RunOne

java.lang.Object
  extended by ParkNPark.tests.RunOne
All Implemented Interfaces:
Runnable

public class RunOne
extends Object
implements Runnable

Class that runs one test configuration


Field Summary
protected  Set<ProcessInfo> clients
          Our clients
protected  int interRequestTime
          Time between requests
protected  int numClients
          Number of clients
protected static ProcessInfoComparator<ProcessInfo> processInfoComparator
          Singleton instance of the ProcessInfoComparator
protected  String projectRoot
          The project root folder
protected  int replySize
          Size of reply
protected  ProcessInfo sacredServer
          Our name and replication server
protected  Set<ProcessInfo> servers
          Our servers
protected  BufferedWriter stdErrWriter
          A writer for stderr
 
Constructor Summary
RunOne(String projectRoot, int numClients, int interRequestTime, int replySize)
          Creates a new test case runner
 
Method Summary
protected  void ensureOutputFoldersExist()
          Ensures that the output folders exist, which the programs write stdout or stderr to, depending on the program
static void main(String[] args)
          Run the tests as specified on the command line
protected  void populateSet(Set<String> set, Reader input)
          Populates a Set from individual lines of a reader
 void run()
          Runs this test's configuration by cleaning out any old server instances, starting the name service from scratch, starting the replication manager, starting the servers, starting the clients, waiting for the clients to exit, telling the servers to exit, and waiting for the servers to exit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numClients

protected int numClients
Number of clients


interRequestTime

protected int interRequestTime
Time between requests


replySize

protected int replySize
Size of reply


processInfoComparator

protected static final ProcessInfoComparator<ProcessInfo> processInfoComparator
Singleton instance of the ProcessInfoComparator


servers

protected Set<ProcessInfo> servers
Our servers


clients

protected Set<ProcessInfo> clients
Our clients


sacredServer

protected ProcessInfo sacredServer
Our name and replication server


projectRoot

protected String projectRoot
The project root folder


stdErrWriter

protected BufferedWriter stdErrWriter
A writer for stderr

Constructor Detail

RunOne

public RunOne(String projectRoot,
              int numClients,
              int interRequestTime,
              int replySize)
       throws IOException
Creates a new test case runner

Parameters:
projectRoot - The project's root folder to use for this test case run
numClients - The number of clients to use in this test case run
interRequestTime - The amount of time in milliseconds to wait between client invocations
replySize - The size of the replies from the server in bytes
Throws:
IOException - Thrown if an IOException is thrown during the processing
Method Detail

main

public static void main(String[] args)
Run the tests as specified on the command line

Parameters:
args - The command line arguments

populateSet

protected void populateSet(Set<String> set,
                           Reader input)
                    throws IOException
Populates a Set from individual lines of a reader

Parameters:
set - The Set to populate
input - The Reader to read lines from
Throws:
IOException - Thrown if an IOException arises during processing

ensureOutputFoldersExist

protected void ensureOutputFoldersExist()
Ensures that the output folders exist, which the programs write stdout or stderr to, depending on the program


run

public void run()
Runs this test's configuration by cleaning out any old server instances, starting the name service from scratch, starting the replication manager, starting the servers, starting the clients, waiting for the clients to exit, telling the servers to exit, and waiting for the servers to exit

Specified by:
run in interface Runnable