server.testmodules
Class PingTest

java.lang.Object
  extended by server.framework.network.ServerSocketCommunicator
      extended by server.testmodules.TestModule
          extended by server.testmodules.PingTest
All Implemented Interfaces:
Communicator

public class PingTest
extends TestModule

This test module tests the response time of the networks by sending very small packets (4 bytes) with increasing intervals between each packet. When a set of packets has been sent, the interval is increased with the amount specfied in the INTERVAL_INC variable. The test results from this test are calculated by finding the minimum, maximum and average response times for each interval set.

Author:
Martin Jarrett, Eivind Sorteberg

Nested Class Summary
 
Nested classes/interfaces inherited from class server.testmodules.TestModule
TestModule.Sender, TestModule.TestType, TestModule.Timer
 
Nested classes/interfaces inherited from class server.framework.network.ServerSocketCommunicator
ServerSocketCommunicator.ReceiverThread, ServerSocketCommunicator.SenderThread
 
Field Summary
static int INTERVAL_INC
           
static int LATENCY_START
           
 
Fields inherited from class server.testmodules.TestModule
allTests, currentRun, interval, message, NETWORK, NOF_INTERVALS, NOF_PACKETS, NOF_RUNS, PROVIDER, random
 
Fields inherited from class server.framework.network.ServerSocketCommunicator
receiverThread, senderThread, server, socket
 
Constructor Summary
PingTest(SocketWrapper socket, AbstractServer server)
          Creates a ping test instance by calling the super constructor.
 
Method Summary
protected  java.lang.Number[] calculateValues(TestModule.Timer[] timers, int interval_no)
          Method that calculates the minimum, maximum and average response time for the specified interval number.
protected  java.lang.String findIdString(java.lang.String message)
          Since the messages in this test only consist of the id and the end character, the id string is simply the message.
protected  java.lang.String[] getHeaders()
          Gets the headers for the coloumns in the report.
protected  long getInitialInterval()
          Gets the initial interval to use between sends.
protected  java.lang.String getInitialMessage()
          The first message to send.
protected  java.lang.String getStringToSend(int id)
          Creates the string to send.
protected  java.lang.String getTitle()
          Gets the title for the report.
protected  void notifyAboutIntervalComplete()
          Called when one interval has been completed.
 
Methods inherited from class server.testmodules.TestModule
close, connect, disconnect, getAllValues, getId, getLastId, getReport, getThreeDigitString, getTimeInSeconds, notifyAboutMessageReceived, notifyAboutRunComplete, runTest, searchForNodes, sendMessage
 
Methods inherited from class server.framework.network.ServerSocketCommunicator
getSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERVAL_INC

public static final int INTERVAL_INC
See Also:
Constant Field Values

LATENCY_START

public static final int LATENCY_START
See Also:
Constant Field Values
Constructor Detail

PingTest

public PingTest(SocketWrapper socket,
                AbstractServer server)
Creates a ping test instance by calling the super constructor.

Parameters:
socket - The socket to use for the transmission.
server - The server model.
Method Detail

getHeaders

protected java.lang.String[] getHeaders()
Description copied from class: TestModule
Gets the headers for the coloumns in the report.

Specified by:
getHeaders in class TestModule
Returns:
The headers used for the HTML table generated by the test.

calculateValues

protected java.lang.Number[] calculateValues(TestModule.Timer[] timers,
                                             int interval_no)
Method that calculates the minimum, maximum and average response time for the specified interval number.

Specified by:
calculateValues in class TestModule
Parameters:
timers - The set of measured response times for each packet.
interval_no - The interval for which to calculate the values.
Returns:
The minimum, maximum and average response time.

getTitle

protected java.lang.String getTitle()
Description copied from class: TestModule
Gets the title for the report.

Specified by:
getTitle in class TestModule
Returns:
The title for the HTML file generated by the test.

getStringToSend

protected java.lang.String getStringToSend(int id)
Creates the string to send.

Specified by:
getStringToSend in class TestModule
Parameters:
id - The id of the packet.
Returns:
A three digit string followed by a '|' character

notifyAboutIntervalComplete

protected void notifyAboutIntervalComplete()
Called when one interval has been completed. The interval between the transmissions is then increased with the value specified in INTERVAL_INC.

Specified by:
notifyAboutIntervalComplete in class TestModule

getInitialInterval

protected long getInitialInterval()
Description copied from class: TestModule
Gets the initial interval to use between sends.

Specified by:
getInitialInterval in class TestModule
Returns:
The interval to use for the first set of transmissions.

getInitialMessage

protected java.lang.String getInitialMessage()
The first message to send.

Specified by:
getInitialMessage in class TestModule
Returns:
An empty string.

findIdString

protected java.lang.String findIdString(java.lang.String message)
Since the messages in this test only consist of the id and the end character, the id string is simply the message.

Specified by:
findIdString in class TestModule
Parameters:
message - The message that was received.
Returns:
The message.