Skip to content

Commit

Permalink
Add some scaffolding so the test doesn't need to catch an Exception t…
Browse files Browse the repository at this point in the history
…o work correctly.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1723684 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Jan 8, 2016
1 parent aa6c640 commit 4b15fa3
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions test/org/apache/catalina/session/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@

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
Expand Down Expand Up @@ -152,8 +155,8 @@ public void run() {
* 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);
Expand All @@ -164,16 +167,18 @@ public void testManagerBaseCreateSession() {


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) {
Expand Down

0 comments on commit 4b15fa3

Please sign in to comment.