diff options
author | Greg Wilkins | 2012-06-06 14:40:19 +0000 |
---|---|---|
committer | Greg Wilkins | 2012-06-06 14:40:19 +0000 |
commit | 903e4cd0f2d3144f2ccbfb79df500b2749cf13a0 (patch) | |
tree | 54d4868361f987912ec261c35bb1706bbe219e73 /test-continuation | |
parent | 792509d45970209805840b90772eeafb429e56db (diff) | |
download | org.eclipse.jetty.project-903e4cd0f2d3144f2ccbfb79df500b2749cf13a0.tar.gz org.eclipse.jetty.project-903e4cd0f2d3144f2ccbfb79df500b2749cf13a0.tar.xz org.eclipse.jetty.project-903e4cd0f2d3144f2ccbfb79df500b2749cf13a0.zip |
jetty-9 many name and javadoc cleanups
Diffstat (limited to 'test-continuation')
3 files changed, 44 insertions, 29 deletions
diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 913fc2cdce..f3424f488b 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -23,15 +23,16 @@ </build> <dependencies> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>provided</scope> - </dependency> - <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> <version>${project.version}</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.eclipse.jetty.toolchain</groupId> + <artifactId>jetty-test-helper</artifactId> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java b/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java index f7b516ef76..16366ea364 100644 --- a/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java +++ b/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java @@ -13,6 +13,12 @@ package org.eclipse.jetty.continuation.test; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + import java.io.IOException; import java.io.InputStream; import java.net.Socket; @@ -24,15 +30,12 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import junit.framework.TestCase; - import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.continuation.ContinuationSupport; - -public abstract class ContinuationBase extends TestCase +public abstract class ContinuationBase { protected SuspendServlet _servlet=new SuspendServlet(); protected int _port; @@ -206,22 +209,14 @@ public abstract class ContinuationBase extends TestCase protected void assertContains(String content,String response) { - assertEquals("HTTP/1.1 200 OK",response.substring(0,15)); - if (response.indexOf(content,15)<0) - { - System.err.println("'"+content+"' NOT IN:\n"+response+"\n--"); - assertTrue(false); - } + assertThat(response,startsWith("HTTP/1.1 200 OK")); + assertThat(response,containsString(content)); } protected void assertNotContains(String content,String response) { - assertEquals("HTTP/1.1 200 OK",response.substring(0,15)); - if (response.indexOf(content,15)>=0) - { - System.err.println("'"+content+"' IS IN:\n"+response+"'\n--"); - assertTrue(false); - } + assertThat(response,startsWith("HTTP/1.1 200 OK")); + assertThat(response,not(containsString(content))); } public synchronized String process(String query,String content) throws Exception diff --git a/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java b/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java index 7452584182..c33b97ed57 100644 --- a/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java +++ b/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java @@ -26,6 +26,9 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.IO; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; @@ -36,8 +39,8 @@ public class ContinuationTest extends ContinuationBase protected SelectChannelConnector _connector; FilterHolder _filter; - @Override - protected void setUp() throws Exception + @Before + public void setUp() throws Exception { _connector = new SelectChannelConnector(); _server.setConnectors(new Connector[]{ _connector }); @@ -50,101 +53,117 @@ public class ContinuationTest extends ContinuationBase _server.start(); _port=_connector.getLocalPort(); - } - @Override - protected void tearDown() throws Exception + @After + public void tearDown() throws Exception { _server.stop(); } + @Test public void testContinuation() throws Exception { doNormal("AsyncContinuation"); } - + + @Test public void testSleep() throws Exception { doSleep(); } + @Test public void testSuspend() throws Exception { doSuspend(); } + @Test public void testSuspendWaitResume() throws Exception { doSuspendWaitResume(); } + @Test public void testSuspendResume() throws Exception { doSuspendResume(); } + @Test public void testSuspendWaitComplete() throws Exception { doSuspendWaitComplete(); } + @Test public void testSuspendComplete() throws Exception { doSuspendComplete(); } + @Test public void testSuspendWaitResumeSuspendWaitResume() throws Exception { doSuspendWaitResumeSuspendWaitResume(); } - + + @Test public void testSuspendWaitResumeSuspendComplete() throws Exception { doSuspendWaitResumeSuspendComplete(); } + @Test public void testSuspendWaitResumeSuspend() throws Exception { doSuspendWaitResumeSuspend(); } + @Test public void testSuspendTimeoutSuspendResume() throws Exception { doSuspendTimeoutSuspendResume(); } + @Test public void testSuspendTimeoutSuspendComplete() throws Exception { doSuspendTimeoutSuspendComplete(); } + @Test public void testSuspendTimeoutSuspend() throws Exception { doSuspendTimeoutSuspend(); } + @Test public void testSuspendThrowResume() throws Exception { doSuspendThrowResume(); } + @Test public void testSuspendResumeThrow() throws Exception { doSuspendResumeThrow(); } + @Test public void testSuspendThrowComplete() throws Exception { doSuspendThrowComplete(); } + @Test public void testSuspendCompleteThrow() throws Exception { doSuspendCompleteThrow(); } - + @Override protected String toString(InputStream in) throws IOException { return IO.toString(in); |