Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

performance
Class SpeedTest  view SpeedTest download SpeedTest.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byperformance.SpeedTest
All Implemented Interfaces:
junit.framework.Test

public class SpeedTest
extends junit.framework.TestCase

Junit test to measure some simple performance statistics. It times a number of iterations of getPort, createOperation, and executeRequestResponseOperation for each provider. The results are stored in a properties file to allow each run to test if the performance has changed since the last run. The number of iterations to do is determined by the time each test takes and the TIME_PER_TEST constant. You need to run it atleast 3 times to get the iterations calculation to settle on a good value; The MARGIN_OF_ERROR constant defines how mush variation between run times is ignored when determining if the performance has changed. You may need to change the TIME_PER_TEST and MARGIN_OF_ERROR constants for your machine speed. For testing you can add futher timing points to the internal WSIF classes which this test will then monitor and report on. For example, to time the axis provider invoke method, at the start of the invoke method add: Monitor.start( "axisInvoke" ); followed by a stop call at the end of the invoke method: Monitor.stop( "axisInvoke" ); Monitor points can be paused around unwanted code. For example with the above monitors in the invoke method, you could exclude the SOAP call time with: Monitor.pause( "axisInvoke" ); resp = call.invoke(locationUri, getSoapActionURI()); Monitor.resume( "axisInvoke" );


Field Summary
(package private) static int DEFAULT_ITERATIONS
           
(package private) static float MARGIN_OF_ERROR
           
(package private) static java.util.Properties newStats
           
(package private) static java.io.File propFile
           
(package private) static java.util.Properties stats
           
(package private) static boolean TEST_CREATEOP
           
(package private) static boolean TEST_EXECOP
           
(package private) static boolean TEST_GETPORT
           
(package private) static float TIME_PER_TEST
           
(package private) static boolean UPDATE_STATS
           
(package private) static java.lang.String wsdlLocation
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
SpeedTest(java.lang.String name)
           
 
Method Summary
private  void doit(java.lang.String portName, java.lang.String protocol)
           
private  float getfloatStat(java.lang.String name)
           
private  int getintStat(java.lang.String name)
           
private  int getIterations(java.lang.String testName)
           
private static java.util.Properties getStats()
           
private static void loadStatsFromFile()
           
static void main(java.lang.String[] args)
           
private static void mergeNewStats()
           
private static void saveStatsToFile()
           
private  void setIterations(java.lang.String prefix)
           
 void setUp()
          Sets up the fixture, for example, open a network connection.
static junit.framework.Test suite()
           
 void testJava()
           
private  boolean testResults()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TIME_PER_TEST

static final float TIME_PER_TEST
See Also:
Constant Field Values

MARGIN_OF_ERROR

static final float MARGIN_OF_ERROR
See Also:
Constant Field Values

UPDATE_STATS

static final boolean UPDATE_STATS
See Also:
Constant Field Values

propFile

static final java.io.File propFile

DEFAULT_ITERATIONS

static final int DEFAULT_ITERATIONS
See Also:
Constant Field Values

TEST_GETPORT

static final boolean TEST_GETPORT
See Also:
Constant Field Values

TEST_CREATEOP

static final boolean TEST_CREATEOP
See Also:
Constant Field Values

TEST_EXECOP

static final boolean TEST_EXECOP
See Also:
Constant Field Values

stats

static java.util.Properties stats

newStats

static java.util.Properties newStats

wsdlLocation

static final java.lang.String wsdlLocation
Constructor Detail

SpeedTest

public SpeedTest(java.lang.String name)
Method Detail

main

public static void main(java.lang.String[] args)

suite

public static junit.framework.Test suite()

setUp

public void setUp()
Description copied from class: junit.framework.TestCase
Sets up the fixture, for example, open a network connection. This method is called before a test is executed.


testJava

public void testJava()

doit

private void doit(java.lang.String portName,
                  java.lang.String protocol)

testResults

private boolean testResults()

getIterations

private int getIterations(java.lang.String testName)

setIterations

private void setIterations(java.lang.String prefix)

getintStat

private int getintStat(java.lang.String name)

getfloatStat

private float getfloatStat(java.lang.String name)

getStats

private static java.util.Properties getStats()

mergeNewStats

private static void mergeNewStats()

loadStatsFromFile

private static void loadStatsFromFile()

saveStatsToFile

private static void saveStatsToFile()