Author: markt
Date: Fri Jan 8 10:54:57 2016
New Revision: 1723684
URL: http://svn.apache.org/viewvc?rev=1723684&view=rev
Log:
Add some scaffolding so the test doesn't need to catch an Exception to work
correctly.
Modified:
tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java
Modified: tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java?rev=1723684&r1=1723683&r2=1723684&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java (original)
+++ tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java Fri Jan 8
10:54:57 2016
@@ -26,9 +26,12 @@ import static org.junit.Assert.fail;
import org.junit.Test;
+import org.apache.catalina.Context;
+import org.apache.catalina.Host;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Session;
import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardHost;
/**
* Named Benchmarks so it is not automatically executed as part of the unit
@@ -152,8 +155,8 @@ public class Benchmarks {
* 16 threads - ~45,600ms
*/
@Test
- public void testManagerBaseCreateSession() {
- doTestManagerBaseCreateSession(1, 1000000);
+ public void testManagerBaseCreateSession() throws LifecycleException {
+ doTestManagerBaseCreateSession(1, 100000);
doTestManagerBaseCreateSession(2, 1000000);
doTestManagerBaseCreateSession(4, 1000000);
doTestManagerBaseCreateSession(16, 1000000);
@@ -164,16 +167,18 @@ public class Benchmarks {
private void doTestManagerBaseCreateSession(int threadCount,
- int iterCount) {
+ int iterCount) throws LifecycleException {
// Create a default session manager
StandardManager mgr = new StandardManager();
- try {
- mgr.startInternal();
- } catch (LifecycleException e) {
- // Ignore - this is expected
- }
- mgr.setContext(new StandardContext());
+ mgr.setPathname(null);
+ Host host = new StandardHost();
+ host.setName("unittest");
+ Context context = new StandardContext();
+ context.setPath("");
+ context.setParent(host);
+ mgr.setContext(context);
+ mgr.start();
mgr.generateSessionId();
while (mgr.sessionCreationTiming.size() <
ManagerBase.TIMING_STATS_CACHE_SIZE) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]