summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorThomas Becker2012-02-28 04:46:36 (EST)
committer Thomas Becker2012-03-01 09:15:04 (EST)
commit54262c4ba5d668e858a75b773b3552e8005acd4a (patch)
tree2282e3fa947c5f7f4d1ecb39dd0edb035359e237
parent3a94e4505050457a01431f9b4e77bd7a3e0e4a81 (diff)
downloadorg.eclipse.jetty.project-54262c4ba5d668e858a75b773b3552e8005acd4a.zip
org.eclipse.jetty.project-54262c4ba5d668e858a75b773b3552e8005acd4a.tar.gz
org.eclipse.jetty.project-54262c4ba5d668e858a75b773b3552e8005acd4a.tar.bz2
372115: codeformat of AsyncContextTest.javarefs/changes/03/5203/1
-rw-r--r--jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java122
1 files changed, 61 insertions, 61 deletions
diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java
index 9311d67..f985c0f 100644
--- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java
+++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java
@@ -9,7 +9,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static org.junit.Assert.*;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.*;
import junit.framework.Assert;
import org.eclipse.jetty.continuation.ContinuationSupport;
@@ -62,74 +62,74 @@ public class AsyncContextTest
@Test
public void testSimpleAsyncContext() throws Exception
- {
+ {
String request = "GET /servletPath HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Connection: close\r\n" + "\r\n";
String responseString = _connector.getResponses(request);
BufferedReader br = parseHeader(responseString);
-
- Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath", br.readLine());
- Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath", br.readLine());
- Assert.assertEquals("async context gets right path in async","async:run:attr:servletPath:/servletPath", br.readLine());
+
+ Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath",br.readLine());
+ Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath",br.readLine());
+ Assert.assertEquals("async context gets right path in async","async:run:attr:servletPath:/servletPath",br.readLine());
}
-
+
@Test
public void testDispatchAsyncContext() throws Exception
- {
+ {
String request = "GET /servletPath?dispatch=true HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Connection: close\r\n" + "\r\n";
String responseString = _connector.getResponses(request);
-
+
BufferedReader br = parseHeader(responseString);
-
- Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath2", br.readLine());
- Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath2", br.readLine());
- Assert.assertEquals("servlet path attr is original","async:run:attr:servletPath:/servletPath", br.readLine());
- Assert.assertEquals("path info attr is correct","async:run:attr:pathInfo:null", br.readLine());
- Assert.assertEquals("query string attr is correct","async:run:attr:queryString:dispatch=true", br.readLine());
- Assert.assertEquals("context path attr is correct","async:run:attr:contextPath:", br.readLine());
- Assert.assertEquals("request uri attr is correct","async:run:attr:requestURI:/servletPath", br.readLine());
- }
+
+ Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath2",br.readLine());
+ Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath2",br.readLine());
+ Assert.assertEquals("servlet path attr is original","async:run:attr:servletPath:/servletPath",br.readLine());
+ Assert.assertEquals("path info attr is correct","async:run:attr:pathInfo:null",br.readLine());
+ Assert.assertEquals("query string attr is correct","async:run:attr:queryString:dispatch=true",br.readLine());
+ Assert.assertEquals("context path attr is correct","async:run:attr:contextPath:",br.readLine());
+ Assert.assertEquals("request uri attr is correct","async:run:attr:requestURI:/servletPath",br.readLine());
+ }
@Test
public void testSimpleWithContextAsyncContext() throws Exception
- {
+ {
_contextHandler.setContextPath("/foo");
-
+
String request = "GET /foo/servletPath HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Connection: close\r\n" + "\r\n";
String responseString = _connector.getResponses(request);
-
+
BufferedReader br = parseHeader(responseString);
-
- Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath", br.readLine());
- Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath", br.readLine());
- Assert.assertEquals("async context gets right path in async","async:run:attr:servletPath:/servletPath", br.readLine());
+
+ Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath",br.readLine());
+ Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath",br.readLine());
+ Assert.assertEquals("async context gets right path in async","async:run:attr:servletPath:/servletPath",br.readLine());
}
-
+
@Test
public void testDispatchWithContextAsyncContext() throws Exception
- {
+ {
_contextHandler.setContextPath("/foo");
-
+
String request = "GET /foo/servletPath?dispatch=true HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Connection: close\r\n" + "\r\n";
-
+
String responseString = _connector.getResponses(request);
-
+
BufferedReader br = parseHeader(responseString);
-
- Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath2", br.readLine());
- Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath2", br.readLine());
- Assert.assertEquals("servlet path attr is original","async:run:attr:servletPath:/servletPath", br.readLine());
- Assert.assertEquals("path info attr is correct","async:run:attr:pathInfo:null", br.readLine());
- Assert.assertEquals("query string attr is correct","async:run:attr:queryString:dispatch=true", br.readLine());
- Assert.assertEquals("context path attr is correct","async:run:attr:contextPath:/foo", br.readLine());
- Assert.assertEquals("request uri attr is correct","async:run:attr:requestURI:/foo/servletPath", br.readLine());
- }
+
+ Assert.assertEquals("servlet gets right path","doGet:getServletPath:/servletPath2",br.readLine());
+ Assert.assertEquals("async context gets right path in get","doGet:async:getServletPath:/servletPath2",br.readLine());
+ Assert.assertEquals("servlet path attr is original","async:run:attr:servletPath:/servletPath",br.readLine());
+ Assert.assertEquals("path info attr is correct","async:run:attr:pathInfo:null",br.readLine());
+ Assert.assertEquals("query string attr is correct","async:run:attr:queryString:dispatch=true",br.readLine());
+ Assert.assertEquals("context path attr is correct","async:run:attr:contextPath:/foo",br.readLine());
+ Assert.assertEquals("request uri attr is correct","async:run:attr:requestURI:/foo/servletPath",br.readLine());
+ }
@Test
public void testDispatch() throws Exception
@@ -187,28 +187,28 @@ public class AsyncContextTest
}
}
- private class AsyncDispatchingServlet extends HttpServlet
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(HttpServletRequest req, final HttpServletResponse response) throws ServletException, IOException
- {
- Request request = (Request)req;
- if (request.getDispatcherType() == DispatcherType.ASYNC)
- {
- response.getOutputStream().print("Dispatched back to AsyncDispatchingServlet");
- }
- else
- {
- final AsyncContext asyncContext;
- if (request.getParameter("dispatchRequestResponse") != null)
- asyncContext = request.startAsync(request,response);
- else
- asyncContext = request.startAsync();
-
- new Thread(new DispatchingRunnable(asyncContext)).start();
- }
+ private class AsyncDispatchingServlet extends HttpServlet
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, final HttpServletResponse response) throws ServletException, IOException
+ {
+ Request request = (Request)req;
+ if (request.getDispatcherType() == DispatcherType.ASYNC)
+ {
+ response.getOutputStream().print("Dispatched back to AsyncDispatchingServlet");
+ }
+ else
+ {
+ final AsyncContext asyncContext;
+ if (request.getParameter("dispatchRequestResponse") != null)
+ asyncContext = request.startAsync(request,response);
+ else
+ asyncContext = request.startAsync();
+
+ new Thread(new DispatchingRunnable(asyncContext)).start();
+ }
}
}