wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernesto Reinaldo Barreiro <reier...@gmail.com>
Subject Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
Date Wed, 16 Mar 2016 09:00:20 GMT
Ok. I will do... I'm also trying to solve it locally (rolling my own
version AbstractWicketTester)

On Wed, Mar 16, 2016 at 9:49 AM, Sven Meier <sven@meiers.net> wrote:

> Hi Ernesto,
>
> many thanks, I'll take a look.
>
> If you have time, please open a Jira issue.
>
> Regards
> Sven
>
>
> On 16.03.2016 09:24, Ernesto Reinaldo Barreiro wrote:
>
>> @Martin, @Sven,
>>
>> I think it is a consequence of
>>
>>
>> https://fisheye6.atlassian.com/changelog/wicket-git?cs=ac3dddd842e365c724a996c863a1c40d09f71c49
>>
>> because on
>>
>>
>> https://github.com/apache/wicket/blob/wicket-7.x/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java#L725
>>
>> lastRequest is set to request. So, getRedirectLocation will return null.
>>
>> Maybe add on condition on the finally that is only called if
>> getRedirectLocation
>> ==  null?
>>
>>
>> On Wed, Mar 16, 2016 at 8:40 AM, Ernesto Reinaldo Barreiro <
>> reiern70@gmail.com> wrote:
>>
>> Thanks!
>>>
>>> On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorov <mgrigorov@apache.org>
>>> wrote:
>>>
>>> Hi Ernesto,
>>>>
>>>>
>>>> On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro <
>>>> reiern70@gmail.com> wrote:
>>>>
>>>> Hi,
>>>>>
>>>>> We have a simple test like....
>>>>>
>>>>> ==================================
>>>>>
>>>>> WicketTester tester = tester();
>>>>> tester.startPage(AgencyInquiryPage.class);
>>>>>
>>>>> FormTester formTester = tester.newFormTester("form");
>>>>> formTester.setValue("businessDetails:firstName:field", "John");
>>>>> formTester.setValue("businessDetails:lastName:field", "Smith");
>>>>> formTester.setValue("businessDetails:companyName:field", "Comp");
>>>>> formTester.setValue("businessDetails:streetAndNumber:field", "str.
>>>>> 13");
>>>>> formTester.setValue("businessDetails:zipcode:field", "66666");
>>>>> formTester.setValue("businessDetails:city:field", "Munich");
>>>>> formTester.select("businessDetails:country:select", 0);
>>>>> formTester.setValue("phoneNumber:field", "666333");
>>>>> formTester.setValue("email:field", "test@test.com");
>>>>> formTester.submit("submit");
>>>>>
>>>>> String actualRedirectUrl =
>>>>>
>>>> tester.getLastResponse().getRedirectLocation();
>>>>
>>>>> Assert.assertTrue(actualRedirectUrl.endsWith("expected/url"));
>>>>>
>>>>> ==================================
>>>>>
>>>>> and inside on submit we throw a
>>>>>
>>>>> ================================
>>>>>
>>>>> public class RedirectToAbsoluteUrlException extends
>>>>>
>>>> RedirectToUrlException
>>>>
>>>>> {
>>>>>
>>>>>      private static final long serialVersionUID = 1L;
>>>>>
>>>>>      public RedirectToAbsoluteUrlException(String redirectUrl) {
>>>>>          this(redirectUrl, HttpServletResponse.SC_MOVED_TEMPORARILY);
>>>>>      }
>>>>>
>>>>>      public RedirectToAbsoluteUrlException(String redirectUrl, int
>>>>> statusCode) {
>>>>>          super(UrlUtils.toAbsoluteUrl(redirectUrl), statusCode);
>>>>>      }
>>>>> }
>>>>>
>>>>> ================================
>>>>>
>>>>> Test was passing on 6.22.0 but fails on 7.2.0 because actualRedirectUrl
>>>>>
>>>> is
>>>>
>>>>> NULL. Looking at the migration guide I see.
>>>>>
>>>>>
>>>>>
>>>>>
>>>> https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+7.0#MigrationtoWicket7.0-(Base)WicketTestercanbereusedafterthrownexception
>>>>
>>>>> Before I dive into the code...
>>>>>
>>>>> Questions:
>>>>>
>>>>> 1- Is this a known issue?
>>>>>
>>>>> No.
>>>>
>>>>
>>>> 2- Are we doing something wrong?
>>>>>
>>>>> Please create a quickstart if you don't find the solution yourself.
>>>>
>>>>
>>>> --
>>>>> Regards - Ernesto Reinaldo Barreiro
>>>>>
>>>>>
>>>
>>> --
>>> Regards - Ernesto Reinaldo Barreiro
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message