Bumping up jetty-test-helper to v1.2 to use Stress helper.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2766 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Joakim Erdfelt 2011-02-09 22:45:08 +00:00
parent d26ccd1830
commit c7d2d27945
9 changed files with 41 additions and 39 deletions

View File

@ -39,6 +39,7 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.toolchain.test.Stress;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
@ -47,7 +48,6 @@ import org.eclipse.jetty.util.log.Log;
*/
public class HttpExchangeTest extends TestCase
{
private boolean _stress=Boolean.getBoolean("STRESS");
protected int _maxConnectionsPerAddress = 2;
protected String _scheme = "http://";
protected Server _server;
@ -85,7 +85,7 @@ public class HttpExchangeTest extends TestCase
public void testPerf() throws Exception
{
if (_stress)
if (Stress.isEnabled())
{
sender(1,false);
sender(1,true);

View File

@ -13,12 +13,13 @@
package org.eclipse.jetty.client;
import java.io.File;
import static org.hamcrest.Matchers.*;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.Assume;
/**
* Functional testing for HttpExchange.
@ -50,8 +51,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest
//SslSelectChannelConnector connector = new SslSelectChannelConnector();
SslSocketConnector connector = new SslSocketConnector();
String keystore = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator
+ "keystore";
String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath();
connector.setPort(0);
connector.setKeystore(keystore);
@ -63,6 +63,12 @@ public class SslHttpExchangeTest extends HttpExchangeTest
{ connector });
_connector=connector;
}
private void IgnoreTestOnBuggyIBM() {
// Use Junit 4.x to flag test as ignored if encountering IBM JVM
// Will show up in various junit reports as an ignored test as well.
Assume.assumeThat(System.getProperty("java.vendor").toLowerCase(),not(containsString("ibm")));
}
/* ------------------------------------------------------------ */
/**
@ -72,10 +78,8 @@ public class SslHttpExchangeTest extends HttpExchangeTest
public void testGetWithContentExchange() throws Exception
{
// TODO Resolve problems on IBM JVM https://bugs.eclipse.org/bugs/show_bug.cgi?id=304532
if (System.getProperty("java.vendor").toLowerCase().indexOf("ibm")<0)
super.testGetWithContentExchange();
else
Log.warn("Skipped SSL testGetWithContentExchange on IBM JVM");
IgnoreTestOnBuggyIBM();
super.testGetWithContentExchange();
}
/* ------------------------------------------------------------ */
@ -86,10 +90,8 @@ public class SslHttpExchangeTest extends HttpExchangeTest
public void testPerf() throws Exception
{
// TODO Resolve problems on IBM JVM https://bugs.eclipse.org/bugs/show_bug.cgi?id=304532
if (System.getProperty("java.vendor").toLowerCase().indexOf("ibm")<0)
super.testPerf();
else
Log.warn("Skipped SSL testPerf on IBM JVM");
IgnoreTestOnBuggyIBM();
super.testPerf();
}
/* ------------------------------------------------------------ */
@ -100,10 +102,8 @@ public class SslHttpExchangeTest extends HttpExchangeTest
public void testPostWithContentExchange() throws Exception
{
// TODO Resolve problems on IBM JVM https://bugs.eclipse.org/bugs/show_bug.cgi?id=304532
if (System.getProperty("java.vendor").toLowerCase().indexOf("ibm")<0)
super.testPostWithContentExchange();
else
Log.warn("Skipped SSL testPostWithContentExchange on IBM JVM");
IgnoreTestOnBuggyIBM();
super.testPostWithContentExchange();
}
/* ------------------------------------------------------------ */
@ -114,9 +114,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest
public void testReserveConnections() throws Exception
{
// TODO Resolve problems on IBM JVM https://bugs.eclipse.org/bugs/show_bug.cgi?id=304532
if (System.getProperty("java.vendor").toLowerCase().indexOf("ibm")<0)
super.testReserveConnections();
else
Log.warn("Skipped SSL testReserveConnections on IBM JVM");
IgnoreTestOnBuggyIBM();
super.testReserveConnections();
}
}

View File

@ -17,6 +17,11 @@
<artifactId>jetty-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -17,17 +17,17 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.toolchain.test.Stress;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class ThreadLocalBuffersTest
{
public boolean _stress = Boolean.getBoolean("STRESS");
private InnerBuffers httpBuffers;
private List<Thread> threadList = new ArrayList<Thread>();
private int numThreads = _stress?100:10;
private int runTestLength = _stress?5000:1000;
private int numThreads = Stress.isEnabled()?100:10;
private int runTestLength = Stress.isEnabled()?5000:1000;
private boolean runTest = false;
private AtomicLong buffersRetrieved;

View File

@ -84,6 +84,11 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationListener;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.toolchain.test.Stress;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
@ -46,7 +47,6 @@ public class AsyncStressTest
protected int _port;
protected Random _random = new Random();
protected QueuedThreadPool _threads=new QueuedThreadPool();
protected boolean _stress;
private final static String[][] __paths =
{
{"/path","NORMAL"},
@ -60,7 +60,6 @@ public class AsyncStressTest
@Before
public void init() throws Exception
{
_stress= Boolean.getBoolean("STRESS");
_threads.setMaxThreads(50);
_server.setThreadPool(_threads);
_connector = new SelectChannelConnector();
@ -82,9 +81,8 @@ public class AsyncStressTest
@Test
public void testAsync() throws Throwable
{
if (_stress)
if (Stress.isEnabled())
{
System.err.println("STRESS!");
doConnections(1600,240);
}
else

View File

@ -14,15 +14,15 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.toolchain.test.Stress;
import org.eclipse.jetty.util.IO;
import org.junit.AfterClass;
public class HttpServerTestFixture
{ // Useful constants
protected static final boolean stress = Boolean.getBoolean("STRESS");
protected static final long PAUSE=10L;
protected static final int LOOPS=stress?250:25;
protected static final int LOOPS=Stress.isEnabled()?250:25;
protected static final String HOST="localhost";
protected static Server _server;

View File

@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.toolchain.test.Stress;
import org.eclipse.jetty.util.BlockingArrayQueue;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
@ -39,7 +40,6 @@ import static org.junit.Assert.assertTrue;
public class StressTest
{
private static boolean _stress;
private static QueuedThreadPool _threads;
private static Server _server;
private static SelectChannelConnector _connector;
@ -78,8 +78,6 @@ public class StressTest
@BeforeClass
public static void init() throws Exception
{
_stress= Boolean.getBoolean("STRESS");
_threads = new QueuedThreadPool(new BlockingArrayQueue<Runnable>(4,4));
_threads.setMaxThreads(200);
@ -117,9 +115,8 @@ public class StressTest
public void testNonPersistent() throws Throwable
{
doThreads(10,100,false);
if (_stress)
if (Stress.isEnabled())
{
System.err.println("STRESS!");
Thread.sleep(1000);
doThreads(200,10,false);
Thread.sleep(1000);
@ -131,9 +128,8 @@ public class StressTest
public void testPersistent() throws Throwable
{
doThreads(20,100,true);
if (_stress)
if (Stress.isEnabled())
{
System.err.println("STRESS!");
Thread.sleep(1000);
doThreads(200,10,true);
Thread.sleep(1000);

View File

@ -320,7 +320,7 @@
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<version>1.0</version>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>