Re: [Stripes-users] CleanUrl bug from 1.5.1+ when using MockRoundtrip
Hi Nathan, Just had a quick look to your test. Refactored to : http://pastebin.com/02nY8aWF The two test methods that use a string url for the binding work fine. The one using the beanclass doesn't work... As a workaround for now, you can use stringified urls in your tests. I'll try to understand what's going on as soon as I have a moment. Cheers Remi 2010/10/20 Nathan Maves nathan.ma...@gmail.com Sure thing Remi. The following example fails because the id is null. Nathan ACTION package com.foo.stripes; import net.sourceforge.stripes.action.ActionBean; import net.sourceforge.stripes.action.ActionBeanContext; import net.sourceforge.stripes.action.DefaultHandler; import net.sourceforge.stripes.action.Resolution; import net.sourceforge.stripes.action.UrlBinding; @UrlBinding(/foo/{$event}/{id}) public class TestAction implements ActionBean { ActionBeanContext context; Integer id; @DefaultHandler public Resolution bar() { return null; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Override public void setContext(ActionBeanContext context) { this.context = context; } @Override public ActionBeanContext getContext() { return this.context; } } TEST package com.foo.stripes; import java.util.HashMap; import java.util.Map; import net.sourceforge.stripes.controller.DispatcherServlet; import net.sourceforge.stripes.controller.StripesFilter; import net.sourceforge.stripes.mock.MockRoundtrip; import net.sourceforge.stripes.mock.MockServletContext; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class ParameterTestAction { MockServletContext context; @Before public void setup() { context = new MockServletContext(test); // Add the Stripes Filter MapString,String filterParams = new HashMapString,String(); filterParams.put(ActionResolver.Packages, com.foo.stripes); context.addFilter(StripesFilter.class, StripesFilter, filterParams); // Add the Stripes Dispatcher context.setServlet(DispatcherServlet.class, StripesDispatcher, null); } @Test public void testParameter() throws Exception { final Integer id = 2; MockRoundtrip trip = new MockRoundtrip(context, TestAction.class); trip.setParameter(id, id.toString()); trip.execute(); TestAction action = trip.getActionBean(TestAction.class); assertEquals(id, action.getId()); } } On Wed, Oct 20, 2010 at 2:56 AM, VANKEISBELCK Remi r...@rvkb.com wrote: Haven't looked yet, but the log might be normal. Could you post a test case that reproduces your bug ? This way I'll have a closer look if you want. Cheers Remi 2010/10/20 Nathan Maves nathan.ma...@gmail.com Just tested this with logging on 1.5.3. It looks like there is an issue with the {$event} binding but I am not sure that is really an issue or not. Let me know if there is anything else I can do on my end to help out. Here is the log for 1.5.3 INFO 2010-10-19 21:46:10,991 net.sourceforge.stripes.util.Log.info(): Stripes Initialization Complete. Version: 1.5.3, Build: 1.5.3 DEBUG 2010-10-19 21:46:11,844 net.sourceforge.stripes.util.Log.debug(): LocalePicker selected locale: en_US DEBUG 2010-10-19 21:46:11,844 net.sourceforge.stripes.util.Log.debug(): LocalePicker did not pick a character encoding, using default: UTF-8 DEBUG 2010-10-19 21:46:11,848 net.sourceforge.stripes.util.Log.debug(): Matched /admin/product/{$event}/{product.id} to /admin/product/{$event}/{product.id} INFO 2010-10-19 21:46:11,858 net.sourceforge.stripes.util.Log.info(): Expression validation will be performed using: net.sourceforge.stripes.validation.expression.Jsp20ExpressionExecutor DEBUG 2010-10-19 21:46:11,859 net.sourceforge.stripes.util.Log.debug(): Transitioning to lifecycle stage RequestInit DEBUG 2010-10-19 21:46:11,862 net.sourceforge.stripes.util.Log.debug(): Transitioning to lifecycle stage ActionBeanResolution DEBUG 2010-10-19 21:46:11,863 net.sourceforge.stripes.util.Log.debug(): Matched /admin/product/{$event}/{product.id} to /admin/product/{$event}/{product.id} DEBUG 2010-10-19 21:46:11,866 net.sourceforge.stripes.util.Log.debug(): Matched /admin/product/{$event}/{product.id} to /admin/product/{$event}/{product.id} DEBUG 2010-10-19 21:46:11,871 net.sourceforge.stripes.util.Log.debug(): Transitioning to lifecycle stage HandlerResolution DEBUG 2010-10-19 21:46:11,874 net.sourceforge.stripes.util.Log.debug(): Resolved event: edit; will invoke:
Re: [Stripes-users] CleanUrl bug from 1.5.1+ when using MockRoundtrip
So I am not crazy! Good to hear and thanks for the help. N On Wed, Oct 20, 2010 at 10:15 AM, VANKEISBELCK Remi r...@rvkb.com wrote: Hi Nathan, Just had a quick look to your test. Refactored to : http://pastebin.com/02nY8aWF The two test methods that use a string url for the binding work fine. The one using the beanclass doesn't work... As a workaround for now, you can use stringified urls in your tests. I'll try to understand what's going on as soon as I have a moment. Cheers Remi 2010/10/20 Nathan Maves nathan.ma...@gmail.com Sure thing Remi. The following example fails because the id is null. Nathan ACTION package com.foo.stripes; import net.sourceforge.stripes.action.ActionBean; import net.sourceforge.stripes.action.ActionBeanContext; import net.sourceforge.stripes.action.DefaultHandler; import net.sourceforge.stripes.action.Resolution; import net.sourceforge.stripes.action.UrlBinding; @UrlBinding(/foo/{$event}/{id}) public class TestAction implements ActionBean { ActionBeanContext context; Integer id; �...@defaulthandler public Resolution bar() { return null; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } �...@override public void setContext(ActionBeanContext context) { this.context = context; } �...@override public ActionBeanContext getContext() { return this.context; } } TEST package com.foo.stripes; import java.util.HashMap; import java.util.Map; import net.sourceforge.stripes.controller.DispatcherServlet; import net.sourceforge.stripes.controller.StripesFilter; import net.sourceforge.stripes.mock.MockRoundtrip; import net.sourceforge.stripes.mock.MockServletContext; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class ParameterTestAction { MockServletContext context; �...@before public void setup() { context = new MockServletContext(test); // Add the Stripes Filter MapString,String filterParams = new HashMapString,String(); filterParams.put(ActionResolver.Packages, com.foo.stripes); context.addFilter(StripesFilter.class, StripesFilter, filterParams); // Add the Stripes Dispatcher context.setServlet(DispatcherServlet.class, StripesDispatcher, null); } �...@test public void testParameter() throws Exception { final Integer id = 2; MockRoundtrip trip = new MockRoundtrip(context, TestAction.class); trip.setParameter(id, id.toString()); trip.execute(); TestAction action = trip.getActionBean(TestAction.class); assertEquals(id, action.getId()); } } On Wed, Oct 20, 2010 at 2:56 AM, VANKEISBELCK Remi r...@rvkb.com wrote: Haven't looked yet, but the log might be normal. Could you post a test case that reproduces your bug ? This way I'll have a closer look if you want. Cheers Remi 2010/10/20 Nathan Maves nathan.ma...@gmail.com Just tested this with logging on 1.5.3. It looks like there is an issue with the {$event} binding but I am not sure that is really an issue or not. Let me know if there is anything else I can do on my end to help out. Here is the log for 1.5.3 INFO 2010-10-19 21:46:10,991 net.sourceforge.stripes.util.Log.info(): Stripes Initialization Complete. Version: 1.5.3, Build: 1.5.3 DEBUG 2010-10-19 21:46:11,844 net.sourceforge.stripes.util.Log.debug(): LocalePicker selected locale: en_US DEBUG 2010-10-19 21:46:11,844 net.sourceforge.stripes.util.Log.debug(): LocalePicker did not pick a character encoding, using default: UTF-8 DEBUG 2010-10-19 21:46:11,848 net.sourceforge.stripes.util.Log.debug(): Matched /admin/product/{$event}/{product.id} to /admin/product/{$event}/{product.id} INFO 2010-10-19 21:46:11,858 net.sourceforge.stripes.util.Log.info(): Expression validation will be performed using: net.sourceforge.stripes.validation.expression.Jsp20ExpressionExecutor DEBUG 2010-10-19 21:46:11,859 net.sourceforge.stripes.util.Log.debug(): Transitioning to lifecycle stage RequestInit DEBUG 2010-10-19 21:46:11,862 net.sourceforge.stripes.util.Log.debug(): Transitioning to lifecycle stage ActionBeanResolution DEBUG 2010-10-19 21:46:11,863 net.sourceforge.stripes.util.Log.debug(): Matched /admin/product/{$event}/{product.id} to /admin/product/{$event}/{product.id} DEBUG 2010-10-19 21:46:11,866 net.sourceforge.stripes.util.Log.debug(): Matched /admin/product/{$event}/{product.id} to /admin/product/{$event}/{product.id} DEBUG 2010-10-19 21:46:11,871 net.sourceforge.stripes.util.Log.debug():