Worked like a charm, thanks!

https://github.com/apache/syncope/commit/f5f0bf05cd88e8d5ab6e682f7e1bb6f3c3249c82#diff-1b179dcf722c88b5094875ab9d08d6e3R65

Regards.

On 2020/01/10 13:02:20, Martin Grigorov <mgrigo...@apache.org> wrote: 
> On Fri, Jan 10, 2020 at 2:55 PM Francesco Chicchiriccò <ilgro...@apache.org>
> wrote:
> 
> > On 2020/01/10 12:24:49, Martin Grigorov <mgrigo...@apache.org> wrote:
> > > Hi Francesco,
> > >
> > > This was a bug in Wicket, a security related one.
> > > You will need to fix your code.
> > >
> > > The change should look something like this:
> > >
> > >
> > > -               tester.getRequest().setParameter("select",
> > > page.option1.getValue());
> > > -               tester.getRequest().setParameter("text", "text is
> > required");
> > > -               tester.submitForm(page.form);
> > > +               final FormTester formTester2 =
> > tester.newFormTester("form");
> > > +               formTester2.setValue("select", "option1");
> > > +               formTester2.setValue("text", "text is required");
> > > +               formTester2.submit();
> > >
> > > from
> > >
> > https://gitbox.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=0c19cf8;hp=3d8f8b306a92cee71020a633be1d347177d7b7fc
> >
> > Thanks Martin.
> >
> > As I can see from above, you have a Form instance, which we don't have in
> > [2].
> >
> > Moreover, the problem only occurs with MockWebRequest, not with regular
> > operations (e.g. HttpServletRequest), hence I'd need to introduce a Form
> > only to let tests pass...
> >
> > Is there any way to let WicketTester use a different implementation then
> > MockWebRequest?
> >
> 
> This is how we resolve the method:
> 
> +       protected List<StringValue> getParameterValues(String inputName)
> +       {
> +               String method = Form.METHOD_POST;
> +               final Form form = findParent(Form.class);
> +               final Request request = getRequest();
> +               if (getRequest().getContainerRequest() instanceof
> HttpServletRequest)
> +               {
> +                       method = ((HttpServletRequest)
> getRequest().getContainerRequest()).getMethod();
> +               }
> +               else if (form != null)
> +               {
> +                       method = form.getMethod();
> +               }
> 
> Try with:
> tester.getRequest().setMethod("get");
> tester.getRequest().setParameter("select", page.option1.getValue());
> ...
> 
> 
> > Regards.
> >
> > > On Fri, Jan 10, 2020 at 9:31 AM Francesco Chicchiriccò <
> > ilgro...@apache.org>
> > > wrote:
> > >
> > > > Hi there,
> > > > it seems we have some issues with Wicket Tester, after upgrading to
> > 8.7.0
> > > > from 8.6.1.
> > > >
> > > > In particular, due to the change [1] for WICKET-6708, we have found
> > that
> > > > MockWebRequest is not behaving as expected; no troubles occur instead
> > > > during normal operations with HttpServletRequest.
> > > >
> > > > The test failures occur because MockWebRequest's method is (correctly)
> > set
> > > > to POST but parameters are submitted with URL, when using
> > DropDownChoice
> > > > with onChange behavior [2].
> > > >
> > > > Of course, such situation was fine with code prior to [1] but not
> > working
> > > > anymore: I have verified that expected submit parameters are part of
> > URL,
> > > > hence are available as getQueryParameters() but getPostParameters() is
> > > > invoked instead.
> > > >
> > > > FYI, one of failing test cases in [3].
> > > >
> > > > Please let me know if this is a bug with MockWebRequest or whether we
> > have
> > > > to update our test code, thanks.
> > > >
> > > > Regards.
> > > >
> > > > [1]
> > https://github.com/apache/wicket/commit/9c3129517a15c37cc90fb27a697868a825940aa0#diff-51cf2faf6078497df77cc6d995dd1b98R763
> > > > [2]
> > https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java#L71
> > > > [3]
> > https://github.com/apache/syncope/blob/2_1_X/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java#L57
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to