Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
Voila! https://issues.apache.org/jira/browse/WICKET-6124 Und vielen Danke! On Wed, Mar 16, 2016 at 10:00 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > 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 Meierwrote: > >> 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=ac3842e365c724a996c863a1c40d09f71c49 >>> >>> 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 < >>> reier...@gmail.com> wrote: >>> >>> Thanks! On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorov wrote: Hi Ernesto, > > > On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < > reier...@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", "6"); >> formTester.setValue("businessDetails:city:field", "Munich"); >> formTester.select("businessDetails:country:select", 0); >> formTester.setValue("phoneNumber:field", "666333"); >> formTester.setValue("email:field", "t...@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-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > -- > Regards - Ernesto Reinaldo Barreiro > -- Regards - Ernesto Reinaldo Barreiro
Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
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 Meierwrote: > 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=ac3842e365c724a996c863a1c40d09f71c49 >> >> 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 < >> reier...@gmail.com> wrote: >> >> Thanks! >>> >>> On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorov >>> wrote: >>> >>> Hi Ernesto, On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < reier...@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", "6"); > formTester.setValue("businessDetails:city:field", "Munich"); > formTester.select("businessDetails:country:select", 0); > formTester.setValue("phoneNumber:field", "666333"); > formTester.setValue("email:field", "t...@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-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro
Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
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=ac3842e365c724a996c863a1c40d09f71c49 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 < reier...@gmail.com> wrote: Thanks! On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorovwrote: Hi Ernesto, On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < reier...@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", "6"); formTester.setValue("businessDetails:city:field", "Munich"); formTester.select("businessDetails:country:select", 0); formTester.setValue("phoneNumber:field", "666333"); formTester.setValue("email:field", "t...@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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
@Martin, @Sven, I think it is a consequence of https://fisheye6.atlassian.com/changelog/wicket-git?cs=ac3842e365c724a996c863a1c40d09f71c49 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 < reier...@gmail.com> wrote: > Thanks! > > On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorov> wrote: > >> Hi Ernesto, >> >> >> On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < >> reier...@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", "6"); >> > formTester.setValue("businessDetails:city:field", "Munich"); >> > formTester.select("businessDetails:country:select", 0); >> > formTester.setValue("phoneNumber:field", "666333"); >> > formTester.setValue("email:field", "t...@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 > -- Regards - Ernesto Reinaldo Barreiro
Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
Thanks! On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorovwrote: > Hi Ernesto, > > > On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < > reier...@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", "6"); > > formTester.setValue("businessDetails:city:field", "Munich"); > > formTester.select("businessDetails:country:select", 0); > > formTester.setValue("phoneNumber:field", "666333"); > > formTester.setValue("email:field", "t...@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
Re: wicket 7.2.0 and getLastResponse().getRedirectLocation();
Hi Ernesto, On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < reier...@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", "6"); > formTester.setValue("businessDetails:city:field", "Munich"); > formTester.select("businessDetails:country:select", 0); > formTester.setValue("phoneNumber:field", "666333"); > formTester.setValue("email:field", "t...@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 >