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

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 14, 2009, 12:05:32 PM1/14/09
to sci-fl...@googlegroups.com
Author: harsha.halgaswatta
Date: Wed Jan 14 06:31:31 2009
New Revision: 404

Added:

plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/axiom/AxiomMediatorPerformanceTest.java
Modified:

plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/axiom/AxiomMediatorTest.java

Log:
Added AxiomMediatorPerformanceTest.java


Added:
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/axiom/AxiomMediatorPerformanceTest.java
==============================================================================
--- (empty file)
+++
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/axiom/AxiomMediatorPerformanceTest.java
Wed Jan 14 06:31:31 2009
@@ -0,0 +1,76 @@
+package org.sciflex.plugins.synapse.esper.mediators.axiom;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import com.clarkware.junitperf.TimedTest;
+import com.clarkware.junitperf.LoadTest;
+
+
+public class AxiomMediatorPerformanceTest {
+
+ 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
AxiomMediatorTest.testAxiomMediator()
+ * method and then fails if the elapsed time exceeded 1 second
+ * @return
+ */
+ public static Test timedTest() {
+ long maxElapsedTime = 1000;
+
+ Test testCase = new AxiomMediatorTest("testAxiomMediator");
+ 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 AxiomMediatorTest("testAxiomMediator");
+ Test loadTest = new LoadTest(testCase, maxUsers);
+ Test timedTest = new TimedTest(testCase, maxElapsedTime,false);
+
+ return timedTest;
+ }
+
+ /**
+ * LoadTest then decorates the TimedTest to simulate a 10-user load
on the testAxiomMediator 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 AxiomMediatorTest("testAxiomMediator");
+ 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/axiom/AxiomMediatorTest.java
==============================================================================
---
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/axiom/AxiomMediatorTest.java
(original)
+++
plugins/synapse/esper/trunk/java/mediators/src/test/java/org/sciflex/plugins/synapse/esper/mediators/axiom/AxiomMediatorTest.java
Wed Jan 14 06:31:31 2009
@@ -26,6 +26,7 @@
import org.apache.synapse.MessageContext;

import org.sciflex.plugins.synapse.esper.mediators.*;
+import
org.sciflex.plugins.synapse.esper.mediators.xml.XMLMediatorPerformanceTest;
import
org.sciflex.plugins.synapse.esper.mediators.helpers.EPLStatementHelper;
import
org.sciflex.plugins.synapse.esper.mediators.listener.SuccessAwareSynapseListener;

@@ -44,6 +45,10 @@
AxiomMediator axiommediator = null;
Configuration config = null;

+
+ public AxiomMediatorTest(String name) {
+ super(name);
+ }
/**
* Trace State.
*/
@@ -148,6 +153,11 @@
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(AxiomMediatorPerformanceTest.suite());
+ }

}

Reply all
Reply to author
Forward
0 new messages