[sci-flex commit] r403 - plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jan 14, 2009, 10:16:20 AM1/14/09
to sci-fl...@googlegroups.com
Author: harsha.halgaswatta
Date: Wed Jan 14 06:06:11 2009
New Revision: 403

Modified:

plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorPerformanceTest.java

plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorTest.java

Log:
Added loadTests on performanceTestSuite to test throughput and response
time


Modified:
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorPerformanceTest.java
==============================================================================
---
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorPerformanceTest.java
(original)
+++
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorPerformanceTest.java
Wed Jan 14 06:06:11 2009
@@ -2,21 +2,73 @@

import com.clarkware.junitperf.*;
import junit.framework.Test;
+import junit.framework.TestSuite;

public class XMLMediatorPerformanceTest {

+
public static Test suite() {

+ TestSuite suite = new TestSuite();
+ suite.addTest(timedTest());
+ suite.addTest(throughPutUnderLoadTest());
+ suite.addTest(responseTimeUnderLoadTest());
+ return suite;
+ }
+
+
+
+
+ /**
+ * timed test that waits for the completion of the
XMLMediatorTest.testXMLMediator()
+ * method and then fails if the elapsed time exceeded 1 second
+ * @return
+ */
+ public static Test timedTest() {
long maxElapsedTime = 1000;

Test testCase = new XMLMediatorTest("testXMLMediator");
- Test timedTest = new TimedTest(testCase, maxElapsedTime);
+ Test timedTest = new TimedTest(testCase, maxElapsedTime,false);
+
+ return timedTest;
+ }
+
+
+
+ /**
+ * The LoadTest adds 10 concurrent users without delay.,
+ * with each user running the test method once
+ * The LoadTest itself is decorated with a TimedTest to test the
throughput
+ * The test will fail if the total elapsed time of the entire load
test exceeds 1.5 seconds
+ * @return
+ */
+ public static Test throughPutUnderLoadTest() {
+
+ int maxUsers = 10;
+ long maxElapsedTime = 1500;
+
+ Test testCase = new XMLMediatorTest("testXMLMediator");
+ Test loadTest = new LoadTest(testCase, maxUsers);
+ Test timedTest = new TimedTest(testCase, maxElapsedTime,false);

return timedTest;
}

- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
+ /**
+ * LoadTest then decorates the TimedTest to simulate a 10-user load on
the testXMLMediator method.
+ * The test will fail if any user's response time exceeds 1 second
+ * @return
+ */
+ public static Test responseTimeUnderLoadTest(){
+ int maxUsers = 10;
+ long maxElapsedTime = 1000;
+
+ Test testCase = new XMLMediatorTest("testXMLMediator");
+ Test timedTest = new TimedTest(testCase, maxElapsedTime);
+ Test loadTest = new LoadTest(timedTest, maxUsers);
+ return loadTest;
+
}
+
}


Modified:
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorTest.java
==============================================================================
---
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorTest.java
(original)
+++
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/xml/XMLMediatorTest.java
Wed Jan 14 06:06:11 2009
@@ -146,5 +146,12 @@
assertTrue("EPServiceProvider does not provide the service",
epServiceProvider!=null);
}

+ /**
+ * testSuite to test elapsed time and load under simultanious users.
+ */
+ public void testPerformance(){
+ junit.textui.TestRunner.run(XMLMediatorPerformanceTest.suite());
+ }
+

}

Reply all
Reply to author
Forward
0 new messages