Tapestry 4.0 unit tests not passing, PATCH

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tapestry 4.0 unit tests not passing, PATCH

richard.hensley
 This is a repeat message because I don't think I was subscribed when I sent
this message.

I'm working with the CVS version of Tapestry 4.0, and could not get the
tests to pass. I've started patching the tests that are failing. I don't
know if this patch is right, but the test now passes. This patch should be
able to be applied using Eclipse, or any other patch capability.


Index: TestRestartService.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tapestry/framework/src/test/org/apache/tapestry/engi
ne/TestRestartService.java,v
retrieving revision 1.5
diff -u -r1.5 TestRestartService.java
--- TestRestartService.java 18 Apr 2005 17:07:51 -0000  1.5
+++ TestRestartService.java 12 May 2005 16:52:01 -0000
@@ -19,6 +19,7 @@
 import javax.servlet.http.HttpSession;
 
 import org.apache.commons.logging.Log;
+import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.engine.RestartService;
 import org.apache.tapestry.junit.TapestryTestCase;
 import org.apache.tapestry.services.AbsoluteURLBuilder;
@@ -41,16 +42,22 @@
 
         MockControl builderControl = newControl(AbsoluteURLBuilder.class);
         AbsoluteURLBuilder builder = (AbsoluteURLBuilder)
builderControl.getMock();
+        
+        MockControl cycleControl = newControl(IRequestCycle.class);
+        IRequestCycle cycle = (IRequestCycle) cycleControl.getMock();

 
         // Training
 
         request.getSession();
         requestControl.setReturnValue(null);
 
-        builder.constructURL("/app");
+        builder.constructURL("http://myserver/app");
         builderControl.setReturnValue("http://myserver/app");
 
         response.sendRedirect("http://myserver/app");
+        
+        cycle.getAbsoluteURL("/app");
+        cycleControl.setReturnValue("http://myserver/app");
 
         replayControls();
 
@@ -60,7 +67,7 @@
         s.setResponse(response);
         s.setServletPath("/app");
 
-        s.service(null);
+        s.service(cycle);
 
         verifyControls();
     }
@@ -77,6 +84,9 @@
 
         HttpSession session = (HttpSession) newMock(HttpSession.class);
 
+        MockControl cycleControl = newControl(IRequestCycle.class);
+        IRequestCycle cycle = (IRequestCycle) cycleControl.getMock();

+
         // Training
 
         request.getSession();
@@ -84,11 +94,14 @@
 
         session.invalidate();
 
-        builder.constructURL("/tap");
+        builder.constructURL("http://myserver/tap");
         builderControl.setReturnValue("http://myserver/tap");
 
         response.sendRedirect("http://myserver/tap");
 
+        cycle.getAbsoluteURL("/tap");
+        cycleControl.setReturnValue("http://myserver/tap");
+
         replayControls();
 
         RestartService s = new RestartService();
@@ -97,7 +110,7 @@
         s.setResponse(response);
         s.setServletPath("/tap");
 
-        s.service(null);
+        s.service(cycle);
 
         verifyControls();
     }
@@ -118,6 +131,9 @@
         Log log = (Log) newMock(Log.class);
 
         IllegalStateException ex = new IllegalStateException();
+        
+        MockControl cycleControl = newControl(IRequestCycle.class);
+        IRequestCycle cycle = (IRequestCycle) cycleControl.getMock();

 
         // Training
 
@@ -129,11 +145,14 @@
 
         log.warn("Exception thrown invalidating HttpSession.", ex);
 
-        builder.constructURL("/app");
+        builder.constructURL("http://myserver/app");
         builderControl.setReturnValue("http://myserver/app");
 
         response.sendRedirect("http://myserver/app");
 
+        cycle.getAbsoluteURL("/app");
+        cycleControl.setReturnValue("http://myserver/app");
+
         replayControls();
 
         RestartService s = new RestartService();
@@ -143,7 +162,7 @@
         s.setLog(log);
         s.setServletPath("/app");
 
-        s.service(null);
+        s.service(cycle);
 
         verifyControls();
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 4.0 unit tests not passing, PATCH

Howard Lewis Ship
Thanks, I'm checking in the patch right now.

On 5/12/05, Hensley, Richard <[hidden email]> wrote:

>  This is a repeat message because I don't think I was subscribed when I sent
> this message.
>
> I'm working with the CVS version of Tapestry 4.0, and could not get the
> tests to pass. I've started patching the tests that are failing. I don't
> know if this patch is right, but the test now passes. This patch should be
> able to be applied using Eclipse, or any other patch capability.
>
> Index: TestRestartService.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-tapestry/framework/src/test/org/apache/tapestry/engi
> ne/TestRestartService.java,v
> retrieving revision 1.5
> diff -u -r1.5 TestRestartService.java
> --- TestRestartService.java 18 Apr 2005 17:07:51 -0000  1.5
> +++ TestRestartService.java 12 May 2005 16:52:01 -0000
> @@ -19,6 +19,7 @@
>  import javax.servlet.http.HttpSession;
>
>  import org.apache.commons.logging.Log;
> +import org.apache.tapestry.IRequestCycle;
>  import org.apache.tapestry.engine.RestartService;
>  import org.apache.tapestry.junit.TapestryTestCase;
>  import org.apache.tapestry.services.AbsoluteURLBuilder;
> @@ -41,16 +42,22 @@
>
>          MockControl builderControl = newControl(AbsoluteURLBuilder.class);
>          AbsoluteURLBuilder builder = (AbsoluteURLBuilder)
> builderControl.getMock();
> +
> +        MockControl cycleControl = newControl(IRequestCycle.class);
> +        IRequestCycle cycle = (IRequestCycle) cycleControl.getMock();
>
>          // Training
>
>          request.getSession();
>          requestControl.setReturnValue(null);
>
> -        builder.constructURL("/app");
> +        builder.constructURL("http://myserver/app");
>          builderControl.setReturnValue("http://myserver/app");
>
>          response.sendRedirect("http://myserver/app");
> +
> +        cycle.getAbsoluteURL("/app");
> +        cycleControl.setReturnValue("http://myserver/app");
>
>          replayControls();
>
> @@ -60,7 +67,7 @@
>          s.setResponse(response);
>          s.setServletPath("/app");
>
> -        s.service(null);
> +        s.service(cycle);
>
>          verifyControls();
>      }
> @@ -77,6 +84,9 @@
>
>          HttpSession session = (HttpSession) newMock(HttpSession.class);
>
> +        MockControl cycleControl = newControl(IRequestCycle.class);
> +        IRequestCycle cycle = (IRequestCycle) cycleControl.getMock();
>
> +
>          // Training
>
>          request.getSession();
> @@ -84,11 +94,14 @@
>
>          session.invalidate();
>
> -        builder.constructURL("/tap");
> +        builder.constructURL("http://myserver/tap");
>          builderControl.setReturnValue("http://myserver/tap");
>
>          response.sendRedirect("http://myserver/tap");
>
> +        cycle.getAbsoluteURL("/tap");
> +        cycleControl.setReturnValue("http://myserver/tap");
> +
>          replayControls();
>
>          RestartService s = new RestartService();
> @@ -97,7 +110,7 @@
>          s.setResponse(response);
>          s.setServletPath("/tap");
>
> -        s.service(null);
> +        s.service(cycle);
>
>          verifyControls();
>      }
> @@ -118,6 +131,9 @@
>          Log log = (Log) newMock(Log.class);
>
>          IllegalStateException ex = new IllegalStateException();
> +
> +        MockControl cycleControl = newControl(IRequestCycle.class);
> +        IRequestCycle cycle = (IRequestCycle) cycleControl.getMock();
>
>          // Training
>
> @@ -129,11 +145,14 @@
>
>          log.warn("Exception thrown invalidating HttpSession.", ex);
>
> -        builder.constructURL("/app");
> +        builder.constructURL("http://myserver/app");
>          builderControl.setReturnValue("http://myserver/app");
>
>          response.sendRedirect("http://myserver/app");
>
> +        cycle.getAbsoluteURL("/app");
> +        cycleControl.setReturnValue("http://myserver/app");
> +
>          replayControls();
>
>          RestartService s = new RestartService();
> @@ -143,7 +162,7 @@
>          s.setLog(log);
>          s.setServletPath("/app");
>
> -        s.service(null);
> +        s.service(cycle);
>
>          verifyControls();
>      }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]