Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2010-09-02 01:40:52 +0000
committerGreg Wilkins2010-09-02 01:40:52 +0000
commitc0759a44f178aadf1f356e9a676f878930e61827 (patch)
treed097ab26606a9a4802b73995a15de66c8934c709 /test-continuation
parentbc1fcba91da928e71e811aad70d8b2224f9295d2 (diff)
downloadorg.eclipse.jetty.project-c0759a44f178aadf1f356e9a676f878930e61827.tar.gz
org.eclipse.jetty.project-c0759a44f178aadf1f356e9a676f878930e61827.tar.xz
org.eclipse.jetty.project-c0759a44f178aadf1f356e9a676f878930e61827.zip
324260 jetty-6 continuations support complete calls
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2236 7e9141cc-0065-0410-87d8-b60c137991c4
Diffstat (limited to 'test-continuation')
-rw-r--r--test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java129
1 files changed, 69 insertions, 60 deletions
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 0d715bd607..8508433ad5 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
@@ -80,18 +80,22 @@ public abstract class ContinuationBase extends TestCase
protected void doSuspendWaitComplete() throws Exception
{
- String response=process("suspend=200&complete=10",null);
+ String response=process("suspend=200&complete=50",null);
assertContains("COMPLETED",response);
+ assertContains("history: initial",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
+ assertNotContains("history: !initial",response);
}
protected void doSuspendComplete() throws Exception
{
String response=process("suspend=200&complete=0",null);
assertContains("COMPLETED",response);
+ assertContains("history: initial",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
+ assertNotContains("history: !initial",response);
}
protected void doSuspendWaitResumeSuspendWaitResume() throws Exception
@@ -289,6 +293,7 @@ public abstract class ContinuationBase extends TestCase
if (continuation.isInitial())
{
+ ((HttpServletResponse)response).addHeader("history","initial");
if (read_before>0)
{
byte[] buf=new byte[read_before];
@@ -384,85 +389,89 @@ public abstract class ContinuationBase extends TestCase
response.getOutputStream().println("NORMAL\n");
}
}
- else if (suspend2_for>=0 && request.getAttribute("2nd")==null)
+ else
{
- request.setAttribute("2nd","cycle");
+ ((HttpServletResponse)response).addHeader("history","!initial");
+ if (suspend2_for>=0 && request.getAttribute("2nd")==null)
+ {
+ request.setAttribute("2nd","cycle");
- if (suspend2_for>0)
- continuation.setTimeout(suspend2_for);
- // continuation.addContinuationListener(__listener);
- ((HttpServletResponse)response).addHeader("history","suspend");
- continuation.suspend(response);
+ if (suspend2_for>0)
+ continuation.setTimeout(suspend2_for);
+ // continuation.addContinuationListener(__listener);
+ ((HttpServletResponse)response).addHeader("history","suspend");
+ continuation.suspend(response);
- if (complete2_after>0)
- {
- TimerTask complete = new TimerTask()
+ if (complete2_after>0)
{
- @Override
- public void run()
+ TimerTask complete = new TimerTask()
{
- try
+ @Override
+ public void run()
{
- response.setStatus(200);
- response.getOutputStream().println("COMPLETED\n");
- continuation.complete();
+ try
+ {
+ response.setStatus(200);
+ response.getOutputStream().println("COMPLETED\n");
+ continuation.complete();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
}
- catch(Exception e)
+ };
+ synchronized (_timer)
+ {
+ _timer.schedule(complete,complete2_after);
+ }
+ }
+ else if (complete2_after==0)
+ {
+ response.setStatus(200);
+ response.getOutputStream().println("COMPLETED\n");
+ continuation.complete();
+ }
+ else if (resume2_after>0)
+ {
+ TimerTask resume = new TimerTask()
+ {
+ @Override
+ public void run()
{
- e.printStackTrace();
+ ((HttpServletResponse)response).addHeader("history","resume");
+ continuation.resume();
}
+ };
+ synchronized (_timer)
+ {
+ _timer.schedule(resume,resume2_after);
}
- };
- synchronized (_timer)
+ }
+ else if (resume2_after==0)
{
- _timer.schedule(complete,complete2_after);
+ ((HttpServletResponse)response).addHeader("history","resume");
+ continuation.resume();
}
+ if (undispatch)
+ continuation.undispatch();
+ return;
}
- else if (complete2_after==0)
+ else if (continuation.isExpired())
{
response.setStatus(200);
- response.getOutputStream().println("COMPLETED\n");
- continuation.complete();
+ response.getOutputStream().println("TIMEOUT\n");
}
- else if (resume2_after>0)
+ else if (continuation.isResumed())
{
- TimerTask resume = new TimerTask()
- {
- @Override
- public void run()
- {
- ((HttpServletResponse)response).addHeader("history","resume");
- continuation.resume();
- }
- };
- synchronized (_timer)
- {
- _timer.schedule(resume,resume2_after);
- }
+ response.setStatus(200);
+ response.getOutputStream().println("RESUMED\n");
}
- else if (resume2_after==0)
+ else
{
- ((HttpServletResponse)response).addHeader("history","resume");
- continuation.resume();
+ response.setStatus(200);
+ response.getOutputStream().println("unknown???\n");
}
- if (undispatch)
- continuation.undispatch();
- return;
- }
- else if (continuation.isExpired())
- {
- response.setStatus(200);
- response.getOutputStream().println("TIMEOUT\n");
- }
- else if (continuation.isResumed())
- {
- response.setStatus(200);
- response.getOutputStream().println("RESUMED\n");
- }
- else
- {
- response.setStatus(200);
- response.getOutputStream().println("unknown???\n");
}
}
}

Back to the top