You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by "zkybartas@gmail.com" <zk...@gmail.com> on 2010/12/18 17:15:04 UTC

Tester loses all submit parameters after ajax call

Hello,

I'm experiencing strange behavior with WicketTester in 1.5 when using
FormTester with ajax events.  It works as follows:

   1. Set some value via the FormTester to input field.
   2. Invoke ajax event. In my case behaviour is
   AjaxFormComponentUpdatingBehavior.
   3. After the ajax event was executed input fields getInput method returns
   null. And it should, since there are no submit parameters available anymore.

Is that bug? It was working in 1.4, so my guess that its bug.

Greetings,

Zilvinas.

Re: Tester loses all submit parameters after ajax call

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Dec 21, 2010 at 5:04 PM, Pedro Santos <pe...@gmail.com> wrote:

> In the 1.4 the executeAjaxEvent method do not create an request to be
> processed as in the 1.5.
> I prefer how it works in the 1.5, because when we don't use an AJAX request
> to trigger the default request cycle we need some hack in the tester, like:
> checkUsability. Perhaps we can even remove this method in the 1.5.
>

checkUsability() is there to stop requests to invisible/disabled
components/behaviors
I think WicketTester call trace doesn't reach to RequestListenerInterface
where we recently added checks for that in the real environment

>
> On Tue, Dec 21, 2010 at 1:40 PM, Pedro Santos <pe...@gmail.com> wrote:
>
> > IMO it is not a bug, rather an improvement: "set the form components
> value
> > as parameter in form submit request."
> > the scenario is:
> >
> > - a new form is created
> > - a form components receive a new value in the first submit
> > - in the second submit the new value at the form component didn't get add
> > as an request parameter, like if the user manually removed the text in an
> > text field for instance, or like if the form component get invisible.
> >
> > I don't know if FormTester was designed to simulate a second submit.
> >
> >
> >
> >
> >
> > On Tue, Dec 21, 2010 at 1:15 PM, zkybartas@gmail.com <
> zkybartas@gmail.com>wrote:
> >
> >> Hi Pedro,
> >>
> >> Yeah those are different issues. I understand that in 1.5 its different
> >> how
> >> tester works. I know how can i access those parameters through request.
> >> The issue i have, is that if you do ajax call in the middle between
> >> setting
> >> value to input and submiting from, FormTester loses that value (unless
> of
> >> course you reset parameters from previous request to current).  So, my
> >> question is, what should I do with the issue I have, do you want me to
> >> create jira task? Is it bug at all?
> >>
> >> On Tue, Dec 21, 2010 at 4:31 PM, Pedro Santos <pe...@gmail.com>
> >> wrote:
> >>
> >> > Hi Zilvinas, thank u for the test!
> >> >
> >> > We actually have different issues. I described mine at
> >> > https://issues.apache.org/jira/browse/WICKET-3272
> >> >
> >> > The tester setup the next request cycle just after process the request
> >> > triggered by the mocked AJAX event.
> >> > It differs from 1.4 where the request setup was made just before the
> >> next
> >> > processRequestCycle.
> >> > So in the 1.5 you don't need methods like setParametersForNextRequest,
> >> > because the current request set on tester is the one that will be
> >> > dispatched. So if you want to access it after process the request, you
> >> need
> >> > to use methods like getLastRequest.
> >> >
> >> > I'm sending your test case back with mentioned changes.
> >> >
> >> >
> >> >
> >> > On Sat, Dec 18, 2010 at 4:14 PM, zkybartas@gmail.com <
> >> zkybartas@gmail.com>wrote:
> >> >
> >> >> Pedro,
> >> >>
> >> >> One more thing, i have updated WicketTesterTest, which fails with
> issue
> >> i
> >> >> have described. I'm attaching patch file, maybe it will be of any
> help
> >> for
> >> >> you.
> >> >>
> >> >>
> >> >> On Sat, Dec 18, 2010 at 8:07 PM, zkybartas@gmail.com <
> >> zkybartas@gmail.com
> >> >> > wrote:
> >> >>
> >> >>> Pedro,
> >> >>>
> >> >>> Thanks for reply. Yeah i have workaround for this - i just reset
> >> submit
> >> >>> parameters from last request to current request.
> >> >>>
> >> >>>
> >> >>> On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pedrosans@gmail.com
> >> >wrote:
> >> >>>
> >> >>>> Hi Zilvinas, I'm taking a look at your described issue, for now try
> >> to
> >> >>>> set
> >> >>>> the parameter as a POST one.
> >> >>>>
> >> >>>> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <
> >> >>>> zkybartas@gmail.com>wrote:
> >> >>>>
> >> >>>> > Hello,
> >> >>>> >
> >> >>>> > I'm experiencing strange behavior with WicketTester in 1.5 when
> >> using
> >> >>>> > FormTester with ajax events.  It works as follows:
> >> >>>> >
> >> >>>> >   1. Set some value via the FormTester to input field.
> >> >>>> >   2. Invoke ajax event. In my case behaviour is
> >> >>>> >   AjaxFormComponentUpdatingBehavior.
> >> >>>> >   3. After the ajax event was executed input fields getInput
> method
> >> >>>> returns
> >> >>>> >   null. And it should, since there are no submit parameters
> >> available
> >> >>>> > anymore.
> >> >>>> >
> >> >>>> > Is that bug? It was working in 1.4, so my guess that its bug.
> >> >>>> >
> >> >>>> > Greetings,
> >> >>>> >
> >> >>>> > Zilvinas.
> >> >>>> >
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> --
> >> >>>> Pedro Henrique Oliveira dos Santos
> >> >>>>
> >> >>>
> >> >>>
> >> >>
> >> >
> >> >
> >> > --
> >> > Pedro Henrique Oliveira dos Santos
> >> >
> >>
> >
> >
> >
> > --
> > Pedro Henrique Oliveira dos Santos
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Re: Tester loses all submit parameters after ajax call

Posted by Pedro Santos <pe...@gmail.com>.
In the 1.4 the executeAjaxEvent method do not create an request to be
processed as in the 1.5.
I prefer how it works in the 1.5, because when we don't use an AJAX request
to trigger the default request cycle we need some hack in the tester, like:
checkUsability. Perhaps we can even remove this method in the 1.5.

On Tue, Dec 21, 2010 at 1:40 PM, Pedro Santos <pe...@gmail.com> wrote:

> IMO it is not a bug, rather an improvement: "set the form components value
> as parameter in form submit request."
> the scenario is:
>
> - a new form is created
> - a form components receive a new value in the first submit
> - in the second submit the new value at the form component didn't get add
> as an request parameter, like if the user manually removed the text in an
> text field for instance, or like if the form component get invisible.
>
> I don't know if FormTester was designed to simulate a second submit.
>
>
>
>
>
> On Tue, Dec 21, 2010 at 1:15 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:
>
>> Hi Pedro,
>>
>> Yeah those are different issues. I understand that in 1.5 its different
>> how
>> tester works. I know how can i access those parameters through request.
>> The issue i have, is that if you do ajax call in the middle between
>> setting
>> value to input and submiting from, FormTester loses that value (unless of
>> course you reset parameters from previous request to current).  So, my
>> question is, what should I do with the issue I have, do you want me to
>> create jira task? Is it bug at all?
>>
>> On Tue, Dec 21, 2010 at 4:31 PM, Pedro Santos <pe...@gmail.com>
>> wrote:
>>
>> > Hi Zilvinas, thank u for the test!
>> >
>> > We actually have different issues. I described mine at
>> > https://issues.apache.org/jira/browse/WICKET-3272
>> >
>> > The tester setup the next request cycle just after process the request
>> > triggered by the mocked AJAX event.
>> > It differs from 1.4 where the request setup was made just before the
>> next
>> > processRequestCycle.
>> > So in the 1.5 you don't need methods like setParametersForNextRequest,
>> > because the current request set on tester is the one that will be
>> > dispatched. So if you want to access it after process the request, you
>> need
>> > to use methods like getLastRequest.
>> >
>> > I'm sending your test case back with mentioned changes.
>> >
>> >
>> >
>> > On Sat, Dec 18, 2010 at 4:14 PM, zkybartas@gmail.com <
>> zkybartas@gmail.com>wrote:
>> >
>> >> Pedro,
>> >>
>> >> One more thing, i have updated WicketTesterTest, which fails with issue
>> i
>> >> have described. I'm attaching patch file, maybe it will be of any help
>> for
>> >> you.
>> >>
>> >>
>> >> On Sat, Dec 18, 2010 at 8:07 PM, zkybartas@gmail.com <
>> zkybartas@gmail.com
>> >> > wrote:
>> >>
>> >>> Pedro,
>> >>>
>> >>> Thanks for reply. Yeah i have workaround for this - i just reset
>> submit
>> >>> parameters from last request to current request.
>> >>>
>> >>>
>> >>> On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pedrosans@gmail.com
>> >wrote:
>> >>>
>> >>>> Hi Zilvinas, I'm taking a look at your described issue, for now try
>> to
>> >>>> set
>> >>>> the parameter as a POST one.
>> >>>>
>> >>>> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <
>> >>>> zkybartas@gmail.com>wrote:
>> >>>>
>> >>>> > Hello,
>> >>>> >
>> >>>> > I'm experiencing strange behavior with WicketTester in 1.5 when
>> using
>> >>>> > FormTester with ajax events.  It works as follows:
>> >>>> >
>> >>>> >   1. Set some value via the FormTester to input field.
>> >>>> >   2. Invoke ajax event. In my case behaviour is
>> >>>> >   AjaxFormComponentUpdatingBehavior.
>> >>>> >   3. After the ajax event was executed input fields getInput method
>> >>>> returns
>> >>>> >   null. And it should, since there are no submit parameters
>> available
>> >>>> > anymore.
>> >>>> >
>> >>>> > Is that bug? It was working in 1.4, so my guess that its bug.
>> >>>> >
>> >>>> > Greetings,
>> >>>> >
>> >>>> > Zilvinas.
>> >>>> >
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> Pedro Henrique Oliveira dos Santos
>> >>>>
>> >>>
>> >>>
>> >>
>> >
>> >
>> > --
>> > Pedro Henrique Oliveira dos Santos
>> >
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>



-- 
Pedro Henrique Oliveira dos Santos

Re: Tester loses all submit parameters after ajax call

Posted by Pedro Santos <pe...@gmail.com>.
IMO it is not a bug, rather an improvement: "set the form components value
as parameter in form submit request."
the scenario is:

- a new form is created
- a form components receive a new value in the first submit
- in the second submit the new value at the form component didn't get add as
an request parameter, like if the user manually removed the text in an text
field for instance, or like if the form component get invisible.

I don't know if FormTester was designed to simulate a second submit.




On Tue, Dec 21, 2010 at 1:15 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:

> Hi Pedro,
>
> Yeah those are different issues. I understand that in 1.5 its different how
> tester works. I know how can i access those parameters through request.
> The issue i have, is that if you do ajax call in the middle between setting
> value to input and submiting from, FormTester loses that value (unless of
> course you reset parameters from previous request to current).  So, my
> question is, what should I do with the issue I have, do you want me to
> create jira task? Is it bug at all?
>
> On Tue, Dec 21, 2010 at 4:31 PM, Pedro Santos <pe...@gmail.com> wrote:
>
> > Hi Zilvinas, thank u for the test!
> >
> > We actually have different issues. I described mine at
> > https://issues.apache.org/jira/browse/WICKET-3272
> >
> > The tester setup the next request cycle just after process the request
> > triggered by the mocked AJAX event.
> > It differs from 1.4 where the request setup was made just before the next
> > processRequestCycle.
> > So in the 1.5 you don't need methods like setParametersForNextRequest,
> > because the current request set on tester is the one that will be
> > dispatched. So if you want to access it after process the request, you
> need
> > to use methods like getLastRequest.
> >
> > I'm sending your test case back with mentioned changes.
> >
> >
> >
> > On Sat, Dec 18, 2010 at 4:14 PM, zkybartas@gmail.com <
> zkybartas@gmail.com>wrote:
> >
> >> Pedro,
> >>
> >> One more thing, i have updated WicketTesterTest, which fails with issue
> i
> >> have described. I'm attaching patch file, maybe it will be of any help
> for
> >> you.
> >>
> >>
> >> On Sat, Dec 18, 2010 at 8:07 PM, zkybartas@gmail.com <
> zkybartas@gmail.com
> >> > wrote:
> >>
> >>> Pedro,
> >>>
> >>> Thanks for reply. Yeah i have workaround for this - i just reset submit
> >>> parameters from last request to current request.
> >>>
> >>>
> >>> On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pedrosans@gmail.com
> >wrote:
> >>>
> >>>> Hi Zilvinas, I'm taking a look at your described issue, for now try to
> >>>> set
> >>>> the parameter as a POST one.
> >>>>
> >>>> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <
> >>>> zkybartas@gmail.com>wrote:
> >>>>
> >>>> > Hello,
> >>>> >
> >>>> > I'm experiencing strange behavior with WicketTester in 1.5 when
> using
> >>>> > FormTester with ajax events.  It works as follows:
> >>>> >
> >>>> >   1. Set some value via the FormTester to input field.
> >>>> >   2. Invoke ajax event. In my case behaviour is
> >>>> >   AjaxFormComponentUpdatingBehavior.
> >>>> >   3. After the ajax event was executed input fields getInput method
> >>>> returns
> >>>> >   null. And it should, since there are no submit parameters
> available
> >>>> > anymore.
> >>>> >
> >>>> > Is that bug? It was working in 1.4, so my guess that its bug.
> >>>> >
> >>>> > Greetings,
> >>>> >
> >>>> > Zilvinas.
> >>>> >
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Pedro Henrique Oliveira dos Santos
> >>>>
> >>>
> >>>
> >>
> >
> >
> > --
> > Pedro Henrique Oliveira dos Santos
> >
>



-- 
Pedro Henrique Oliveira dos Santos

Re: Tester loses all submit parameters after ajax call

Posted by "zkybartas@gmail.com" <zk...@gmail.com>.
Hi Pedro,

Yeah those are different issues. I understand that in 1.5 its different how
tester works. I know how can i access those parameters through request.
The issue i have, is that if you do ajax call in the middle between setting
value to input and submiting from, FormTester loses that value (unless of
course you reset parameters from previous request to current).  So, my
question is, what should I do with the issue I have, do you want me to
create jira task? Is it bug at all?

On Tue, Dec 21, 2010 at 4:31 PM, Pedro Santos <pe...@gmail.com> wrote:

> Hi Zilvinas, thank u for the test!
>
> We actually have different issues. I described mine at
> https://issues.apache.org/jira/browse/WICKET-3272
>
> The tester setup the next request cycle just after process the request
> triggered by the mocked AJAX event.
> It differs from 1.4 where the request setup was made just before the next
> processRequestCycle.
> So in the 1.5 you don't need methods like setParametersForNextRequest,
> because the current request set on tester is the one that will be
> dispatched. So if you want to access it after process the request, you need
> to use methods like getLastRequest.
>
> I'm sending your test case back with mentioned changes.
>
>
>
> On Sat, Dec 18, 2010 at 4:14 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:
>
>> Pedro,
>>
>> One more thing, i have updated WicketTesterTest, which fails with issue i
>> have described. I'm attaching patch file, maybe it will be of any help for
>> you.
>>
>>
>> On Sat, Dec 18, 2010 at 8:07 PM, zkybartas@gmail.com <zkybartas@gmail.com
>> > wrote:
>>
>>> Pedro,
>>>
>>> Thanks for reply. Yeah i have workaround for this - i just reset submit
>>> parameters from last request to current request.
>>>
>>>
>>> On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pe...@gmail.com>wrote:
>>>
>>>> Hi Zilvinas, I'm taking a look at your described issue, for now try to
>>>> set
>>>> the parameter as a POST one.
>>>>
>>>> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <
>>>> zkybartas@gmail.com>wrote:
>>>>
>>>> > Hello,
>>>> >
>>>> > I'm experiencing strange behavior with WicketTester in 1.5 when using
>>>> > FormTester with ajax events.  It works as follows:
>>>> >
>>>> >   1. Set some value via the FormTester to input field.
>>>> >   2. Invoke ajax event. In my case behaviour is
>>>> >   AjaxFormComponentUpdatingBehavior.
>>>> >   3. After the ajax event was executed input fields getInput method
>>>> returns
>>>> >   null. And it should, since there are no submit parameters available
>>>> > anymore.
>>>> >
>>>> > Is that bug? It was working in 1.4, so my guess that its bug.
>>>> >
>>>> > Greetings,
>>>> >
>>>> > Zilvinas.
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Pedro Henrique Oliveira dos Santos
>>>>
>>>
>>>
>>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Re: Tester loses all submit parameters after ajax call

Posted by Pedro Santos <pe...@gmail.com>.
Hi Zilvinas, thank u for the test!

We actually have different issues. I described mine at
https://issues.apache.org/jira/browse/WICKET-3272

The tester setup the next request cycle just after process the request
triggered by the mocked AJAX event.
It differs from 1.4 where the request setup was made just before the next
processRequestCycle.
So in the 1.5 you don't need methods like setParametersForNextRequest,
because the current request set on tester is the one that will be
dispatched. So if you want to access it after process the request, you need
to use methods like getLastRequest.

I'm sending your test case back with mentioned changes.


On Sat, Dec 18, 2010 at 4:14 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:

> Pedro,
>
> One more thing, i have updated WicketTesterTest, which fails with issue i
> have described. I'm attaching patch file, maybe it will be of any help for
> you.
>
>
> On Sat, Dec 18, 2010 at 8:07 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:
>
>> Pedro,
>>
>> Thanks for reply. Yeah i have workaround for this - i just reset submit
>> parameters from last request to current request.
>>
>>
>> On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pe...@gmail.com>wrote:
>>
>>> Hi Zilvinas, I'm taking a look at your described issue, for now try to
>>> set
>>> the parameter as a POST one.
>>>
>>> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <
>>> zkybartas@gmail.com>wrote:
>>>
>>> > Hello,
>>> >
>>> > I'm experiencing strange behavior with WicketTester in 1.5 when using
>>> > FormTester with ajax events.  It works as follows:
>>> >
>>> >   1. Set some value via the FormTester to input field.
>>> >   2. Invoke ajax event. In my case behaviour is
>>> >   AjaxFormComponentUpdatingBehavior.
>>> >   3. After the ajax event was executed input fields getInput method
>>> returns
>>> >   null. And it should, since there are no submit parameters available
>>> > anymore.
>>> >
>>> > Is that bug? It was working in 1.4, so my guess that its bug.
>>> >
>>> > Greetings,
>>> >
>>> > Zilvinas.
>>> >
>>>
>>>
>>>
>>> --
>>> Pedro Henrique Oliveira dos Santos
>>>
>>
>>
>


-- 
Pedro Henrique Oliveira dos Santos

Re: Tester loses all submit parameters after ajax call

Posted by "zkybartas@gmail.com" <zk...@gmail.com>.
Pedro,

One more thing, i have updated WicketTesterTest, which fails with issue i
have described. I'm attaching patch file, maybe it will be of any help for
you.

On Sat, Dec 18, 2010 at 8:07 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:

> Pedro,
>
> Thanks for reply. Yeah i have workaround for this - i just reset submit
> parameters from last request to current request.
>
>
> On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pe...@gmail.com> wrote:
>
>> Hi Zilvinas, I'm taking a look at your described issue, for now try to set
>> the parameter as a POST one.
>>
>> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <zkybartas@gmail.com
>> >wrote:
>>
>> > Hello,
>> >
>> > I'm experiencing strange behavior with WicketTester in 1.5 when using
>> > FormTester with ajax events.  It works as follows:
>> >
>> >   1. Set some value via the FormTester to input field.
>> >   2. Invoke ajax event. In my case behaviour is
>> >   AjaxFormComponentUpdatingBehavior.
>> >   3. After the ajax event was executed input fields getInput method
>> returns
>> >   null. And it should, since there are no submit parameters available
>> > anymore.
>> >
>> > Is that bug? It was working in 1.4, so my guess that its bug.
>> >
>> > Greetings,
>> >
>> > Zilvinas.
>> >
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>
>

Re: Tester loses all submit parameters after ajax call

Posted by "zkybartas@gmail.com" <zk...@gmail.com>.
Pedro,

Thanks for reply. Yeah i have workaround for this - i just reset submit
parameters from last request to current request.

On Sat, Dec 18, 2010 at 6:30 PM, Pedro Santos <pe...@gmail.com> wrote:

> Hi Zilvinas, I'm taking a look at your described issue, for now try to set
> the parameter as a POST one.
>
> On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <zkybartas@gmail.com
> >wrote:
>
> > Hello,
> >
> > I'm experiencing strange behavior with WicketTester in 1.5 when using
> > FormTester with ajax events.  It works as follows:
> >
> >   1. Set some value via the FormTester to input field.
> >   2. Invoke ajax event. In my case behaviour is
> >   AjaxFormComponentUpdatingBehavior.
> >   3. After the ajax event was executed input fields getInput method
> returns
> >   null. And it should, since there are no submit parameters available
> > anymore.
> >
> > Is that bug? It was working in 1.4, so my guess that its bug.
> >
> > Greetings,
> >
> > Zilvinas.
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Re: Tester loses all submit parameters after ajax call

Posted by Pedro Santos <pe...@gmail.com>.
Hi Zilvinas, I'm taking a look at your described issue, for now try to set
the parameter as a POST one.

On Sat, Dec 18, 2010 at 2:15 PM, zkybartas@gmail.com <zk...@gmail.com>wrote:

> Hello,
>
> I'm experiencing strange behavior with WicketTester in 1.5 when using
> FormTester with ajax events.  It works as follows:
>
>   1. Set some value via the FormTester to input field.
>   2. Invoke ajax event. In my case behaviour is
>   AjaxFormComponentUpdatingBehavior.
>   3. After the ajax event was executed input fields getInput method returns
>   null. And it should, since there are no submit parameters available
> anymore.
>
> Is that bug? It was working in 1.4, so my guess that its bug.
>
> Greetings,
>
> Zilvinas.
>



-- 
Pedro Henrique Oliveira dos Santos