Re: [Wicket-user] WicketTester and mocking up next page rendered.
On Fri, 20 Jul 2007, Craig Lenzen wrote: > And how are you overriding the "goToPageB" method in the test? Using > WicketTester you never actually create an instance of PageB, that is you as > the developer. Like this, in 1.3 wicket.startPage(new ITestPageSource(){ public Page getTestPage() { return new PageA()... } though I'm not sure if it's in 1.2. There's also TestPanelSource that you can use similarly with startPanel. - Timo -- Timo Rantalaiho Reaktor Innovations Oyhttp://www.ri.fi/ > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
Tim, And how are you overriding the "goToPageB" method in the test? Using WicketTester you never actually create an instance of PageB, that is you as the developer. -Craig Timo Rantalaiho wrote: > > On Tue, 17 Jul 2007, Ingram Chen wrote: > >> We also suffer the same issues here. But due to unmanaged nature of >> Wicket, >> there is no chance to intercept construction of page B unless you build >> your >> own factory for page. >> >> class Page A { >> MyFactory myFactory ; >> public Page A { >>add(new Link("toBPage") { >> setResponsePage(myFactory.newBPage()); >>}); >> } >> } > > I might do > > class PageA extends Page { > public PageA() { > add(new Link("toBPage") { > @Override > public void onLinkClicked() { > goToPageB(); > } > ); > } > > protected goToPageB() { > ... > > and overriding goToPageB() in the test. > > This technique has even a fancy name in the excellent > _Working Effectively with Legacy Code_ by Michael Feathers, > so maybe it's a kludge to use it in non-legacy code. But > it's simple and it works. > > - Timo > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11715824 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
I've come up with a possible solution to this issue or at least a start that can be discussed a bit more. My solution is to implement my own implementation of wicket's IPageFactory. This implementation is really just a wrapper around the default one since the default one is final. I then created a simple singleton class that allows developers to call mockPage(MyPage.class) within their unit tests. The singleton just keeps a map of page classes that should be mocked up. One thing you need to remember is to provide a way to clear the map after a test runs. I then created a Page object called MockPage that takes the class of the page being mocked and a corresponding .html that contains no markup. private final Class mockedPageClass; public MockPage(Class mockedPageClass) { this.mockedPageClass = mockedPageClass; } Then within the IPageFactory methods I check if the pageClass parameter is mockable given the singleton and return an instance of MockPage if it is, if not then I just delegate to the default factory. Then finally I created an extension to WicketTester and overrode the assertRenderedPage method to first check if the last page rendered is an instance of MockPage and if so then compare the pageClass parameter to the mockedPageClass that was set on the MockPage. If the last page rendered is not of instance MockPage then simply delegate to your parent method. The only other thing you need to do is to set the new IPageFactory up in the application being used my your WicketTester. Thoughts? -Craig Ingram Chen-2 wrote: > > We also suffer the same issues here. But due to unmanaged nature of > Wicket, > there is no chance to intercept construction of page B unless you build > your > own factory for page. > > class Page A { > MyFactory myFactory ; > public Page A { > add(new Link("toBPage") { > setResponsePage(myFactory.newBPage()); > }); > } > } > > and swapping mock MyFactory while testing. > > But such extra indirection make code slight complex and MyFactory is still > hard to test, either. > > > On 7/17/07, Craig Lenzen <[EMAIL PROTECTED]> wrote: >> >> >> I'm looking for some feedback as to an issue I'm having with the >> WicketTester. To start I'd like to point out that I'm using Spring and >> injecting my pages / components via the wicket spring project's component >> injector. >> >> Here is the situation, I have page A that has a link to page B. In the >> test >> of page A I test that the click in fact goes to page B. This is fine but >> the problem is, is that page B relies on a Spring service during its >> construction and the fact that the WicketTester actually tries to render >> page B which calls the service. The easy fix to this is to simply create >> a >> mock implementation of that service and set it in the mock context when >> testing page A, and don't forget you need to also setup the expected >> calls >> >> and returns. >> >> The problem here is that fact that I'm only testing page A, I don't care >> about the functionality of page B nor which services it might call. So >> is >> there a better way? Is there a way that you can mock the rendering of >> page >> B? Has anyone else ran into this issue and or questioned it, or has >> someone came up with a solution? >> >> To get a little more advanced you could also say that when testing a Page >> that added a number of panels I don't want those panels to render during >> the >> testing of the page, I only want to know the panels where added to the >> page. >> >> Thanks for everyone's help, >> Craig >> -- >> View this message in context: >> http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11641094 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> ___ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > > > -- > Ingram Chen > online share order: http://dinbendon.net > blog: http://www.javaworld.com.tw/roller/page/ingramchen > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-
[Wicket-user] WicketTester & border
I have a page containing a border and a form: GreyRoundedBorder greyBorder = new GreyRoundedBorder("configFrame", new ResourceModel("admin.config.title")); Form configForm = new Form("configForm", new CompoundPropertyModel(dbConfig)); greyBorder.add(configForm); When I want to unit test the form using WicketTester I get a NullPointer on public Component getComponentFromLastRenderedPage(String path) { final Component component = getLastRenderedPage().get(path); from BaseWicketTester. Apparently getComponentFromLastRenderedPage only checks the direct children of the Page and doesn't travel down the hierarchy. How to get a reference to the 'nested' Form ? regards, Thies - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
On Tue, 17 Jul 2007, Ingram Chen wrote: > We also suffer the same issues here. But due to unmanaged nature of Wicket, > there is no chance to intercept construction of page B unless you build your > own factory for page. > > class Page A { > MyFactory myFactory ; > public Page A { >add(new Link("toBPage") { > setResponsePage(myFactory.newBPage()); >}); > } > } I might do class PageA extends Page { public PageA() { add(new Link("toBPage") { @Override public void onLinkClicked() { goToPageB(); } ); } protected goToPageB() { ... and overriding goToPageB() in the test. This technique has even a fancy name in the excellent _Working Effectively with Legacy Code_ by Michael Feathers, so maybe it's a kludge to use it in non-legacy code. But it's simple and it works. - Timo - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
This concept might work ok if the link only goes to the same page every time it is clicked, but what if the link goes to a different page depending on presentation logic with in the page. I think you would be SOL in that case. -Craig Ingram Chen-2 wrote: > > We also suffer the same issues here. But due to unmanaged nature of > Wicket, > there is no chance to intercept construction of page B unless you build > your > own factory for page. > > class Page A { > MyFactory myFactory ; > public Page A { > add(new Link("toBPage") { > setResponsePage(myFactory.newBPage()); > }); > } > } > > and swapping mock MyFactory while testing. > > But such extra indirection make code slight complex and MyFactory is still > hard to test, either. > > > On 7/17/07, Craig Lenzen <[EMAIL PROTECTED]> wrote: >> >> >> I'm looking for some feedback as to an issue I'm having with the >> WicketTester. To start I'd like to point out that I'm using Spring and >> injecting my pages / components via the wicket spring project's component >> injector. >> >> Here is the situation, I have page A that has a link to page B. In the >> test >> of page A I test that the click in fact goes to page B. This is fine but >> the problem is, is that page B relies on a Spring service during its >> construction and the fact that the WicketTester actually tries to render >> page B which calls the service. The easy fix to this is to simply create >> a >> mock implementation of that service and set it in the mock context when >> testing page A, and don't forget you need to also setup the expected >> calls >> >> and returns. >> >> The problem here is that fact that I'm only testing page A, I don't care >> about the functionality of page B nor which services it might call. So >> is >> there a better way? Is there a way that you can mock the rendering of >> page >> B? Has anyone else ran into this issue and or questioned it, or has >> someone came up with a solution? >> >> To get a little more advanced you could also say that when testing a Page >> that added a number of panels I don't want those panels to render during >> the >> testing of the page, I only want to know the panels where added to the >> page. >> >> Thanks for everyone's help, >> Craig >> -- >> View this message in context: >> http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11641094 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> ___ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > > > -- > Ingram Chen > online share order: http://dinbendon.net > blog: http://www.javaworld.com.tw/roller/page/ingramchen > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11657439 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
I guess saying "I don't care about page B" is a little harsh. I care that when the link is clicked that the next page to be rendered is page B, what I don't care about is that page B was actually rendered. So I don't think mocking up the page is the proper solution. Instead I would want to mock up an internal component in wicket that skips the rendering of that page. It is been a while since I looked at the guts of wicket but I'm sure there is a way to do this, the question would be how much of the testing functionality have you bypassed by doing something like this. Maybe instead of testing that the last rendered page was page B, you have method that say something like "nextPageToBeRendered". Thoughts? -Craig Eelco Hillenius wrote: > >> The problem here is that fact that I'm only testing page A, I don't care >> about the functionality of page B nor which services it might call. So >> is >> there a better way? Is there a way that you can mock the rendering of >> page >> B? Has anyone else ran into this issue and or questioned it, or has >> someone came up with a solution? > > If you don't care about page B, why not soft code the link and just > test that it executes? For testing you let the link point to some mock > page. Would that help? > > Eelco > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11649927 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
The Spring injection is setup properly, for functional use and unit testing. The issue is, is that I should not have to worry about setting up page B dependencies when I'm testing page A. I should only have to worry about that dependency when it comes to actually testing page B. -Craig Jean-Baptiste Quenot-3 wrote: > > * Craig Lenzen: > >> I'm looking for some feedback as to an issue I'm having with the >> WicketTester. To start I'd like to point out that I'm using >> Spring and injecting my pages / components via the wicket spring >> project's component injector. >> >> Here is the situation, I have page A that has a link to page B. >> In the test of page A I test that the click in fact goes to page >> B. This is fine but the problem is, is that page B relies on a >> Spring service during its construction and the fact that the >> WicketTester actually tries to render page B which calls the >> service. > > And is the service properly injected by the component > instantiation listener? Have you setup Spring for your tests? > -- > Jean-Baptiste Quenot > aka John Banana Qwerty > http://caraldi.com/jbq/ > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11649825 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
* Craig Lenzen: > I'm looking for some feedback as to an issue I'm having with the > WicketTester. To start I'd like to point out that I'm using > Spring and injecting my pages / components via the wicket spring > project's component injector. > > Here is the situation, I have page A that has a link to page B. > In the test of page A I test that the click in fact goes to page > B. This is fine but the problem is, is that page B relies on a > Spring service during its construction and the fact that the > WicketTester actually tries to render page B which calls the > service. And is the service properly injected by the component instantiation listener? Have you setup Spring for your tests? -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
> The problem here is that fact that I'm only testing page A, I don't care > about the functionality of page B nor which services it might call. So is > there a better way? Is there a way that you can mock the rendering of page > B? Has anyone else ran into this issue and or questioned it, or has > someone came up with a solution? If you don't care about page B, why not soft code the link and just test that it executes? For testing you let the link point to some mock page. Would that help? Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
> But due to unmanaged nature of Wicket, there is no chance to intercept > construction of page B unless you build your own factory for page. Not entirely true as there is IComponentInstantiationListener. Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and mocking up next page rendered.
We also suffer the same issues here. But due to unmanaged nature of Wicket, there is no chance to intercept construction of page B unless you build your own factory for page. class Page A { MyFactory myFactory ; public Page A { add(new Link("toBPage") { setResponsePage(myFactory.newBPage()); }); } } and swapping mock MyFactory while testing. But such extra indirection make code slight complex and MyFactory is still hard to test, either. On 7/17/07, Craig Lenzen <[EMAIL PROTECTED]> wrote: I'm looking for some feedback as to an issue I'm having with the WicketTester. To start I'd like to point out that I'm using Spring and injecting my pages / components via the wicket spring project's component injector. Here is the situation, I have page A that has a link to page B. In the test of page A I test that the click in fact goes to page B. This is fine but the problem is, is that page B relies on a Spring service during its construction and the fact that the WicketTester actually tries to render page B which calls the service. The easy fix to this is to simply create a mock implementation of that service and set it in the mock context when testing page A, and don't forget you need to also setup the expected calls and returns. The problem here is that fact that I'm only testing page A, I don't care about the functionality of page B nor which services it might call. So is there a better way? Is there a way that you can mock the rendering of page B? Has anyone else ran into this issue and or questioned it, or has someone came up with a solution? To get a little more advanced you could also say that when testing a Page that added a number of panels I don't want those panels to render during the testing of the page, I only want to know the panels where added to the page. Thanks for everyone's help, Craig -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11641094 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Ingram Chen online share order: http://dinbendon.net blog: http://www.javaworld.com.tw/roller/page/ingramchen - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester and mocking up next page rendered.
I'm looking for some feedback as to an issue I'm having with the WicketTester. To start I'd like to point out that I'm using Spring and injecting my pages / components via the wicket spring project's component injector. Here is the situation, I have page A that has a link to page B. In the test of page A I test that the click in fact goes to page B. This is fine but the problem is, is that page B relies on a Spring service during its construction and the fact that the WicketTester actually tries to render page B which calls the service. The easy fix to this is to simply create a mock implementation of that service and set it in the mock context when testing page A, and don't forget you need to also setup the expected calls and returns. The problem here is that fact that I'm only testing page A, I don't care about the functionality of page B nor which services it might call. So is there a better way? Is there a way that you can mock the rendering of page B? Has anyone else ran into this issue and or questioned it, or has someone came up with a solution? To get a little more advanced you could also say that when testing a Page that added a number of panels I don't want those panels to render during the testing of the page, I only want to know the panels where added to the page. Thanks for everyone's help, Craig -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11641094 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester does not clean up resources very well
Well, thats why i asked if maybe i was missing something :) Anyway an issue has been created https://issues.apache.org/jira/browse/WICKET-762 Maurice Oh btw like Martijn said there might be a legit reason to keep the session and stuff around after the processing thingy but i really think they should be gone after destroy has been called. On 7/16/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > I thought that not all resources were cleaned up so that test cases > can query the response and other things. The responsibility is on the > tester to initiate a new fresh RequestCycle iiuc. > > That said, it may be that we don't provide enough hooks to perform the clean > up. > > Martijn > > On 7/15/07, Maurice Marrink <[EMAIL PROTECTED]> wrote: > > I just noticed that running the following minimal junittest fails. > > WicketTester mock=new WicketTester(); > > mock.setupRequestAndResponse(); > > mock.processRequestCycle(); > > mock.destroy(); > > assertNull(Session.get()); //actually should throw > > IllegalStateException but > > > > I would expect the threadlocal Session to be gone after the request > > had been processed but it is even available after the application has > > been destroyed. > > Or am i missing something? > > > > Maurice > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > -- > Wicket joins the Apache Software Foundation as Apache Wicket > Apache Wicket 1.3.0-beta2 is released > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta2/ > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester does not clean up resources very well
I thought that not all resources were cleaned up so that test cases can query the response and other things. The responsibility is on the tester to initiate a new fresh RequestCycle iiuc. That said, it may be that we don't provide enough hooks to perform the clean up. Martijn On 7/15/07, Maurice Marrink <[EMAIL PROTECTED]> wrote: > I just noticed that running the following minimal junittest fails. > WicketTester mock=new WicketTester(); > mock.setupRequestAndResponse(); > mock.processRequestCycle(); > mock.destroy(); > assertNull(Session.get()); //actually should throw > IllegalStateException but > > I would expect the threadlocal Session to be gone after the request > had been processed but it is even available after the application has > been destroyed. > Or am i missing something? > > Maurice > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > -- Wicket joins the Apache Software Foundation as Apache Wicket Apache Wicket 1.3.0-beta2 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta2/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester does not clean up resources very well
On 7/15/07, Maurice Marrink <[EMAIL PROTECTED]> wrote: > I just noticed that running the following minimal junittest fails. > WicketTester mock=new WicketTester(); > mock.setupRequestAndResponse(); > mock.processRequestCycle(); > mock.destroy(); > assertNull(Session.get()); //actually should throw > IllegalStateException but > > I would expect the threadlocal Session to be gone after the request > had been processed but it is even available after the application has > been destroyed. > Or am i missing something? Could you open an issue for this Maurice? Thanks, Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester does not clean up resources very well
Mr Mean wrote: > > > I would expect the threadlocal Session to be gone after the request > had been processed but it is even available after the application has > been destroyed. > > That would further explain what I was posting about here: http://www.nabble.com/Wicket-1.3.0-beta2---OutOfMemoryError-tf4073994.html. Severian. -- View this message in context: http://www.nabble.com/WicketTester-does-not-clean-up-resources-very-well-tf4083413.html#a11610616 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester does not clean up resources very well
I just noticed that running the following minimal junittest fails. WicketTester mock=new WicketTester(); mock.setupRequestAndResponse(); mock.processRequestCycle(); mock.destroy(); assertNull(Session.get()); //actually should throw IllegalStateException but I would expect the threadlocal Session to be gone after the request had been processed but it is even available after the application has been destroyed. Or am i missing something? Maurice - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and Spring
Here it is warts and all: http://www.antwerkz.com/wp/?p=1026 On 7/11/07, Evan Chooly <[EMAIL PROTECTED]> wrote: yeah, I saw that which is great. The problem is still getting the environment set up so that spring, et. al, can find everything it needs to initialize the application context. I figured it out yesterday and am writing up a blog entry on it now. On 7/10/07, Ingram Chen <[EMAIL PROTECTED]> wrote: > > for wicket 1.2, see http://cwiki.apache.org/WICKET/spring.html for > reference (button) > > Wicket 1.3 can use actual WebApplication so it should be no problem. > > On 7/11/07, Evan Chooly < [EMAIL PROTECTED]> wrote: > > > > Does anyone have any documentation on using WicketTester with > > annotation based spring injection? I tried creating a WicketTester using my > > own Application rather then the DummyApplication that's used by default but > > spring complains with: java.lang.IllegalStateException: No > > WebApplicationContext found: no ContextLoaderListener registered? > > > > But it's not immediately clear how I can do that from my test code. > > Anyone have any ideas? All the google results i've found so far deal with > > creating mocks and manully injecting them which is not really what I want. > > > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > -- > Ingram Chen > online share order: http://dinbendon.net > blog: http://www.javaworld.com.tw/roller/page/ingramchen > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and Spring
yeah, I saw that which is great. The problem is still getting the environment set up so that spring, et. al, can find everything it needs to initialize the application context. I figured it out yesterday and am writing up a blog entry on it now. On 7/10/07, Ingram Chen <[EMAIL PROTECTED]> wrote: for wicket 1.2, see http://cwiki.apache.org/WICKET/spring.html for reference (button) Wicket 1.3 can use actual WebApplication so it should be no problem. On 7/11/07, Evan Chooly <[EMAIL PROTECTED]> wrote: > > Does anyone have any documentation on using WicketTester with annotation > based spring injection? I tried creating a WicketTester using my own > Application rather then the DummyApplication that's used by default but > spring complains with: java.lang.IllegalStateException: No > WebApplicationContext found: no ContextLoaderListener registered? > > But it's not immediately clear how I can do that from my test code. > Anyone have any ideas? All the google results i've found so far deal with > creating mocks and manully injecting them which is not really what I want. > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- Ingram Chen online share order: http://dinbendon.net blog: http://www.javaworld.com.tw/roller/page/ingramchen - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and Spring
for wicket 1.2, see http://cwiki.apache.org/WICKET/spring.html for reference (button) Wicket 1.3 can use actual WebApplication so it should be no problem. On 7/11/07, Evan Chooly <[EMAIL PROTECTED]> wrote: Does anyone have any documentation on using WicketTester with annotation based spring injection? I tried creating a WicketTester using my own Application rather then the DummyApplication that's used by default but spring complains with: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? But it's not immediately clear how I can do that from my test code. Anyone have any ideas? All the google results i've found so far deal with creating mocks and manully injecting them which is not really what I want. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Ingram Chen online share order: http://dinbendon.net blog: http://www.javaworld.com.tw/roller/page/ingramchen - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester and Spring
Does anyone have any documentation on using WicketTester with annotation based spring injection? I tried creating a WicketTester using my own Application rather then the DummyApplication that's used by default but spring complains with: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? But it's not immediately clear how I can do that from my test code. Anyone have any ideas? All the google results i've found so far deal with creating mocks and manully injecting them which is not really what I want. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester class in Wicket 1.3
What should it do? the same as?: assertRenderedPage(p.getClass); assertSame(p, tester.getLastRenderedPage()); Frank On 6/15/07, Sean Sullivan <[EMAIL PROTECTED]> wrote: I'm using the WicketTester class from Wicket 1.3 trunk. WicketTester provides these methods: public Page startPage(Class c) public Page startPage(Page p) public void assertRenderedPage(Class expectedRenderedPageClass) I was wondering if there should also be a method with this signature: public void assertRenderedPage(Page p) What do you think? Sean - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester class in Wicket 1.3
I'm using the WicketTester class from Wicket 1.3 trunk. WicketTester provides these methods: public Page startPage(Class c) public Page startPage(Page p) public void assertRenderedPage(Class expectedRenderedPageClass) I was wondering if there should also be a method with this signature: public void assertRenderedPage(Page p) What do you think? Sean - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wickettester failures
THANK YOU! I was pulling my hair out, and since this was my first time with the WicketTester, i was totally thinking it was my use of the wicket classes. Now i'm back to kicking ass! On 6/6/07, James McLaughlin <[EMAIL PROTECTED]> wrote: > Hi Ryan, > > This explains it: > http://www.jroller.com/page/gridhaus?entry=maven2_testing_madness > > File it under "Ways in which maven hates me..." :) > > If you put this stanza in your pom, your test will work: > > > ... > > org.apache.maven.plugins > maven-surefire-plugin > > > **/*Panel* > > > > > best, > jim > > On 6/6/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote: > > On 6/5/07, James McLaughlin <[EMAIL PROTECTED]> wrote: > > > Hi Ryan, > > > I don't think you can test it like that unless you have a default > > > constructor, and even then I don't think it will work (I'm a bit > > > spotty on this). What I have always done is this: > > > > > > tester.startPanel(new TestPanelSource () { > > > Panel getTestPanel(final String panelId) { > > >return new TestPanel(panelId); > > > } > > > }); > > > > > > Hope that fixes it for you. > > > > No luck. Using the TestPanelSource still has the same issues. I've > > also tried using tester.startPage() instead of using panels, and I > > still get the same exception: > > > > org.apache.maven.surefire.booter.SurefireExecutionException: There is > > no application attached to current thread main > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wickettester failures
Hi Ryan, This explains it: http://www.jroller.com/page/gridhaus?entry=maven2_testing_madness File it under "Ways in which maven hates me..." :) If you put this stanza in your pom, your test will work: ... org.apache.maven.plugins maven-surefire-plugin **/*Panel* best, jim On 6/6/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote: > On 6/5/07, James McLaughlin <[EMAIL PROTECTED]> wrote: > > Hi Ryan, > > I don't think you can test it like that unless you have a default > > constructor, and even then I don't think it will work (I'm a bit > > spotty on this). What I have always done is this: > > > > tester.startPanel(new TestPanelSource () { > > Panel getTestPanel(final String panelId) { > >return new TestPanel(panelId); > > } > > }); > > > > Hope that fixes it for you. > > No luck. Using the TestPanelSource still has the same issues. I've > also tried using tester.startPage() instead of using panels, and I > still get the same exception: > > org.apache.maven.surefire.booter.SurefireExecutionException: There is > no application attached to current thread main > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wickettester failures
On 6/5/07, James McLaughlin <[EMAIL PROTECTED]> wrote: > Hi Ryan, > I don't think you can test it like that unless you have a default > constructor, and even then I don't think it will work (I'm a bit > spotty on this). What I have always done is this: > > tester.startPanel(new TestPanelSource () { > Panel getTestPanel(final String panelId) { >return new TestPanel(panelId); > } > }); > > Hope that fixes it for you. No luck. Using the TestPanelSource still has the same issues. I've also tried using tester.startPage() instead of using panels, and I still get the same exception: org.apache.maven.surefire.booter.SurefireExecutionException: There is no application attached to current thread main - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wickettester failures
here is the output from maven (copied from bamboo logs): [INFO] Surefire report directory: /data/home/wicket/var/data/ bamboo/xml-data/build-dir/ WICKETSCRIPTACULOUS-TRUNK/target/ surefire-reports org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class org.wicketstuff.scriptaculous.inplaceeditor.TestPanel'; nested exception is java.lang.InstantiationException: org.wicketstuff.scriptaculous.inplaceeditor.TestPanel; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class org.wicketstuff.scriptaculous.inplaceeditor.TestPanel'; nested exception is java.lang.InstantiationException: org.wicketstuff.scriptaculous.inplaceeditor.TestPanel org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class org.wicketstuff.scriptaculous.inplaceeditor.TestPanel'; nested exception is java.lang.InstantiationException: org.wicketstuff.scriptaculous.inplaceeditor.TestPanel java.lang.InstantiationException: org.wicketstuff.scriptaculous.inplaceeditor.TestPanel at java.lang.Class.newInstance0(Class.java:335) at java.lang.Class.newInstance(Class.java:303) at org.apache.maven.surefire.testset.PojoTestSet.(PojoTestSet.java:52) at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:61) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:93) at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147) at org.apache.maven.surefire.Surefire.run(Surefire.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747) On 6/5/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > What is the failure stack trace when you execute it in maven? > > Eelco > > On 6/5/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote: > > I could use a little help here. I'm trying to write a unit test for > > my component in wicketstuff-scriptaculous. The test runs in eclipse > > just fine, but running "mvn test" causes a build failure. > > > > What is the correct way to test this? > > > > public class AjaxEditInPlaceLabelTest extends TestCase { > > public void testModelIsNotEscaped() { > > WicketTester tester = new WicketTester(); > > tester.startPanel(TestPanel.class); > > > > tester.assertContains("me & you"); > > } > > } > > > > public class TestPanel extends Panel { > > public TestPanel(String id) { > > super(id); > > add(new AjaxEditInPlaceLabel("label", new Model("me & > > you"))); > > } > > } > > > > > > http://www.wicketstuff.org/bamboo/build/viewBuildLog.action?buildKey=WICKETSCRIPTACULOUS-TRUNK&buildNumber=49 > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wickettester failures
What is the failure stack trace when you execute it in maven? Eelco On 6/5/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote: > I could use a little help here. I'm trying to write a unit test for > my component in wicketstuff-scriptaculous. The test runs in eclipse > just fine, but running "mvn test" causes a build failure. > > What is the correct way to test this? > > public class AjaxEditInPlaceLabelTest extends TestCase { > public void testModelIsNotEscaped() { > WicketTester tester = new WicketTester(); > tester.startPanel(TestPanel.class); > > tester.assertContains("me & you"); > } > } > > public class TestPanel extends Panel { > public TestPanel(String id) { > super(id); > add(new AjaxEditInPlaceLabel("label", new Model("me & you"))); > } > } > > > http://www.wicketstuff.org/bamboo/build/viewBuildLog.action?buildKey=WICKETSCRIPTACULOUS-TRUNK&buildNumber=49 > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wickettester failures
Hi Ryan, I don't think you can test it like that unless you have a default constructor, and even then I don't think it will work (I'm a bit spotty on this). What I have always done is this: tester.startPanel(new TestPanelSource () { Panel getTestPanel(final String panelId) { return new TestPanel(panelId); } }); Hope that fixes it for you. best, jim On 6/5/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote: > I could use a little help here. I'm trying to write a unit test for > my component in wicketstuff-scriptaculous. The test runs in eclipse > just fine, but running "mvn test" causes a build failure. > > What is the correct way to test this? > > public class AjaxEditInPlaceLabelTest extends TestCase { > public void testModelIsNotEscaped() { > WicketTester tester = new WicketTester(); > tester.startPanel(TestPanel.class); > > tester.assertContains("me & you"); > } > } > > public class TestPanel extends Panel { > public TestPanel(String id) { > super(id); > add(new AjaxEditInPlaceLabel("label", new Model("me & you"))); > } > } > > > http://www.wicketstuff.org/bamboo/build/viewBuildLog.action?buildKey=WICKETSCRIPTACULOUS-TRUNK&buildNumber=49 > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] wickettester failures
I could use a little help here. I'm trying to write a unit test for my component in wicketstuff-scriptaculous. The test runs in eclipse just fine, but running "mvn test" causes a build failure. What is the correct way to test this? public class AjaxEditInPlaceLabelTest extends TestCase { public void testModelIsNotEscaped() { WicketTester tester = new WicketTester(); tester.startPanel(TestPanel.class); tester.assertContains("me & you"); } } public class TestPanel extends Panel { public TestPanel(String id) { super(id); add(new AjaxEditInPlaceLabel("label", new Model("me & you"))); } } http://www.wicketstuff.org/bamboo/build/viewBuildLog.action?buildKey=WICKETSCRIPTACULOUS-TRUNK&buildNumber=49 - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester & Sessions (1.3.0-incubating-beta1)
Yes, I raised JIRA bug WICKET-574. -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10659833 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester & Sessions (1.3.0-incubating-beta1)
Did a JIRA bug get created for this? I'm having the same issue and want to document in my code the JIRA issue number. If a bug hasn't been created then I'd be happy to create it myself. Thanks Craig severian wrote: > > I've been having trouble using sessions with WicketTester, even after > looking over the old messages on this list. I've been trying to implement > something like the example in Gurumurthy's "Pro Wicket" book, where a > Login page places a User object in the session, and other pages > subsequently have access to the cached User object. > > When trying to unit test one of the subsequent pages in isolation (i.e. > without first going through the Login page), I figured I just had to place > a User object in the test instance of my session class, like this: > > > -- > WicketTester tester = new WicketTester(myApp, myPath); > > MySession mySession = (MySession) tester.getWicketSession(); > mySession.setCurrentUser(getCurrentUser()); > > tester.startPage(MyPage.class); > -- > > > Unfortunately, this didn't work. The WicketTester constructor correctly > creates an instance of MySession, but never binds it to the session store. > Consequently, the later call to tester.startPage() creates a new instance > of MySession, which obviously contains no User object, causing my tests to > fail. > > As a workaround, I forced the bind() call myself, after the WicketTester > constructor: > > > -- > WicketTester tester = new WicketTester(myApp, myPath); > tester.getApplication().getSessionStore().bind(tester.getWicketRequest(), > tester.getWicketSession()); > > MySession mySession = (MySession) tester.getWicketSession(); > mySession.setCurrentUser(getCurrentUser()); > > tester.startPage(MyPage.class); > -- > > > This allows my tests to succeed. However, I'm suspicious that either I'm > missing something subtle, or there's a bug in the wicket test framework. > For example, should MockWebApplication.createRequestCycle() force a bind > after setting up its session via: > this.wicketSession = (WebSession) Session.findOrCreate(); > > It seems to me that it should, but I'm a Wicket newbie... > -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10656736 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester & Sessions (1.3.0-incubating-beta1)
please fire a jira bug -igor On 5/15/07, severian <[EMAIL PROTECTED]> wrote: I've been having trouble using sessions with WicketTester, even after looking over the old messages on this list. I've been trying to implement something like the example in Gurumurthy's "Pro Wicket" book, where a Login page places a User object in the session, and other pages subsequently have access to the cached User object. When trying to unit test one of the subsequent pages in isolation (i.e. without first going through the Login page), I figured I just had to place a User object in the test instance of my session class, like this: -- WicketTester tester = new WicketTester(myApp, myPath); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- Unfortunately, this didn't work. The WicketTester constructor correctly creates an instance of MySession, but never binds it to the session store. Consequently, the later call to tester.startPage() creates a new instance of MySession, which obviously contains no User object, causing my tests to fail. As a workaround, I forced the bind() call myself, after the WicketTester constructor: -- WicketTester tester = new WicketTester(myApp, myPath); tester.getApplication().getSessionStore().bind(tester.getWicketRequest(), tester.getWicketSession()); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- This allows my tests to succeed. However, I'm suspicious that either I'm missing something subtle, or there's a bug in the wicket test framework. For example, should MockWebApplication.createRequestCycle() force a bind after setting up its session via: this.wicketSession = (WebSession) Session.findOrCreate(); It seems to me that it should, but I'm a Wicket newbie... -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10625617 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester & Sessions (1.3.0-incubating-beta1)
I've been having trouble using sessions with WicketTester, even after looking over the old messages on this list. I've been trying to implement something like the example in Gurumurthy's "Pro Wicket" book, where a Login page places a User object in the session, and other pages subsequently have access to the cached User object. When trying to unit test one of the subsequent pages in isolation (i.e. without first going through the Login page), I figured I just had to place a User object in the test instance of my session class, like this: -- WicketTester tester = new WicketTester(myApp, myPath); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- Unfortunately, this didn't work. The WicketTester constructor correctly creates an instance of MySession, but never binds it to the session store. Consequently, the later call to tester.startPage() creates a new instance of MySession, which obviously contains no User object, causing my tests to fail. As a workaround, I forced the bind() call myself, after the WicketTester constructor: -- WicketTester tester = new WicketTester(myApp, myPath); tester.getApplication().getSessionStore().bind(tester.getWicketRequest(), tester.getWicketSession()); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- This allows my tests to succeed. However, I'm suspicious that either I'm missing something subtle, or there's a bug in the wicket test framework. For example, should MockWebApplication.createRequestCycle() force a bind after setting up its session via: this.wicketSession = (WebSession) Session.findOrCreate(); It seems to me that it should, but I'm a Wicket newbie... -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10625617 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Wickettester and Validators
you have to build the message yourself then. page.getLocalizer().getString("RequiredValidator") or something like that -igor On 5/12/07, behlma <[EMAIL PROTECTED]> wrote: Anyone or is it the wrong approach? behlma wrote: > > Hi guys, > I'm just fiddling around with the FormTester. > > Say I have a RequiredValidator and StringLengthValidator on my textfields > in a form, with custom error messages specified in the page's .properties > file. > > How can I let wickettester retrieve those custom message, instead of > hardcoding them into: > > tester.assertErrorMessages(new String[] {"my custom error message for > LengthVal", "my custom error message for StringVal} > ? > -- View this message in context: http://www.nabble.com/Wickettester-and-Validators-tf3728789.html#a10448855 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Wickettester and Validators
Anyone or is it the wrong approach? behlma wrote: > > Hi guys, > I'm just fiddling around with the FormTester. > > Say I have a RequiredValidator and StringLengthValidator on my textfields > in a form, with custom error messages specified in the page's .properties > file. > > How can I let wickettester retrieve those custom message, instead of > hardcoding them into: > > tester.assertErrorMessages(new String[] {"my custom error message for > LengthVal", "my custom error message for StringVal} > ? > -- View this message in context: http://www.nabble.com/Wickettester-and-Validators-tf3728789.html#a10448855 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Wickettester and Validators
Hi guys, I'm just fiddling around with the FormTester. Say I have a RequiredValidator and StringLengthValidator on my textfields in a form, with custom error messages specified in the page's .properties file. How can I let wickettester retrieve those custom message, instead of hardcoding them into: tester.assertErrorMessages(new String[] {"my custom error message for LengthVal", "my custom error message for StringVal} ? -- View this message in context: http://www.nabble.com/Wickettester-and-Validators-tf3728789.html#a10436719 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester problem
please ignore. it looks like i forgot to include javaee.jar From: "Vadim Tesis" <[EMAIL PROTECTED]> Reply-To: wicket-user@lists.sourceforge.net To: wicket-user@lists.sourceforge.net Subject: [Wicket-user] WicketTester problem Date: Sun, 22 Apr 2007 20:06:41 + Hi all, i'm trying to write a simple test to see if a page gets rendered. when i run the test i'm getting error: NoClassDefFoundError for GenericServlet (see below). it complains about the line where WicketTester gets instantiated. i tried to specify absolute path to the .war file in the WicketTester's constructor but getting the same error. do you know what might cause the problem? Thanks, Vadim C:>java -cp build\classes;..\lib\junit-4.1.jar;..\lib\wicket-1.2.5.jar junit .textui.TestRunner com.ds.deal.gui.GuiAllTests .E Time: 0.046 There was 1 error: 1) testHomePageRender(com.ds.deal.gui.HomeTest)java.lang.NoClassDefFoundError: javax/servl et/GenericServlet at com.ds.deal.gui.HomeTest.setUp(HomeTest.java:12) FAILURES!!! Tests run: 1, Failures: 0, Errors: 1 this is the code: public class HomeTest extends TestCase { private WicketTester m_tester; public void setUp() { m_tester = new WicketTester(); } // end of setUp() public void testHomePageRender() { m_tester.startPage(Home.class); // ensure that request has not been intercepted or redirected m_tester.assertRenderedPage(Home.class); // a page might render with an error message m_tester.assertNoErrorMessage(); } // end of testHomePageRender() } // end of class HomeTest _ The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user _ MSN is giving away a trip to Vegas to see Elton John. Enter to win today. http://msnconcertcontest.com?icid-nceltontagline - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester problem
Hi all, i'm trying to write a simple test to see if a page gets rendered. when i run the test i'm getting error: NoClassDefFoundError for GenericServlet (see below). it complains about the line where WicketTester gets instantiated. i tried to specify absolute path to the .war file in the WicketTester's constructor but getting the same error. do you know what might cause the problem? Thanks, Vadim C:>java -cp build\classes;..\lib\junit-4.1.jar;..\lib\wicket-1.2.5.jar junit .textui.TestRunner com.ds.deal.gui.GuiAllTests .E Time: 0.046 There was 1 error: 1) testHomePageRender(com.ds.deal.gui.HomeTest)java.lang.NoClassDefFoundError: javax/servl et/GenericServlet at com.ds.deal.gui.HomeTest.setUp(HomeTest.java:12) FAILURES!!! Tests run: 1, Failures: 0, Errors: 1 this is the code: public class HomeTest extends TestCase { private WicketTester m_tester; public void setUp() { m_tester = new WicketTester(); } // end of setUp() public void testHomePageRender() { m_tester.startPage(Home.class); // ensure that request has not been intercepted or redirected m_tester.assertRenderedPage(Home.class); // a page might render with an error message m_tester.assertNoErrorMessage(); } // end of testHomePageRender() } // end of class HomeTest _ The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester Best Practices
well, while testing panel, one should prepend "panel" in wicket path like: tester.startPanel(MyPanel.class); tester.clickLink("panel:logout"); this is pain and ugly but current WicketTester only support full absolute path to refer certain component. On 4/18/07, craigdd <[EMAIL PROTECTED]> wrote: I'm looking for some input on what is the best practices for testing Panels that aren't inner classes to WebPage objects If I do the following; WicketTester tester = new WicketTester(); tester.startPanel(MyPanel.class); tester.clickLink("logout"); I get an exception saying path: 'logout' does no exist for page: DummyPanelPage My alternative is to set a startPage to a WebPage that contains my panel. However, I don't think that a panel should have to rely on a WebPage...meaning I can create and test a new Panel without it being attached to a WebPage. In the past I've created some abstraction objects that allow you to do this but is seems like a lot of work and I was hoping that there is a better way. -Craig -- View this message in context: http://www.nabble.com/WicketTester-Best-Practices-tf3598521.html#a10050859 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Ingram Chen ��便��啦: http://dinbendon.net blog: http://www.javaworld.com.tw/roller/page/ingramchen - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester Best Practices
I'm looking for some input on what is the best practices for testing Panels that aren't inner classes to WebPage objects If I do the following; WicketTester tester = new WicketTester(); tester.startPanel(MyPanel.class); tester.clickLink("logout"); I get an exception saying path: 'logout' does no exist for page: DummyPanelPage My alternative is to set a startPage to a WebPage that contains my panel. However, I don't think that a panel should have to rely on a WebPage...meaning I can create and test a new Panel without it being attached to a WebPage. In the past I've created some abstraction objects that allow you to do this but is seems like a lot of work and I was hoping that there is a better way. -Craig -- View this message in context: http://www.nabble.com/WicketTester-Best-Practices-tf3598521.html#a10050859 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester
Can you please create a JIRA issue for this? It seems to be a bug in the custom serialization code that is experimental in Wicket now. It would actually be great if we could switch to an in-memory session store when executing tests. Eelco On 4/4/07, Mats Norén <[EMAIL PROTECTED]> wrote: > Update, I switched to the latest snapshot and got the same error > > > On 4/4/07, Mats Norén <[EMAIL PROTECTED]> wrote: > > I try to setup a simple testcase with a bookmarkablepage and get the > > following exception about the serialization. > > > > INFO - Application- [WicketTester$1] init: Wicket > > extensions initializer > > INFO - Application- [WicketTester$1] init: Wicket > > core library initializer > > INFO - Application- [WicketTester$1] init: Wicket JMX > > initializer > > INFO - Initializer- registering Wicket mbeans with > > server [EMAIL PROTECTED] > > INFO - WebApplication - [WicketTester$1] Started Wicket > > in development mode > > ERROR - Objects- Error serializing object class > > wicket.util.tester.DummyHomePage [object=[Page class = > > wicket.util.tester.DummyHomePage, id = 0, version = 0]] > > wicket.util.io.WicketSerializeableException: No serializeable > > constructor found for class > > wicket.protocol.http.MockHttpServletRequest > > wicket.util.tester.DummyHomePage->testPageSource->se.curalia.ekn.page.project.ProjectLeadAddsComment$1->this$0->se.curalia.ekn.page.project.ProjectLeadAddsComment->tester->wicket.util.tester.WicketTester->servletRequest > > NOTE: if you feel Wicket is at fault with this exception, please > > report to the mailing list. You can switch to JDK based serialization > > by calling: wicket.util.lang.Objects.setObjectStreamFactory(new > > IObjectStreamFactory.DefaultObjectStreamFactory()) e.g. in the init > > method of your application > > > > The testing code: > > > > > > AnnotApplicationContextMock appctx = new AnnotApplicationContextMock(); > > appctx.putBean("commentDAO", commentDAO); > > appctx.putBean("projectDAO", projectDAO); > > > > > > this.tester.getApplication().addComponentInstantiationListener(new > > SpringComponentInjector(this.tester.getApplication(), appctx)); > > > > tester.startPage(new ITestPageSource() { > > public Page getTestPage() { > > PageParameters params = new PageParameters(); > > params.add("id", "1"); > > return new Diary(params); > > } > > }); > > > > I'm using incubator-1.3.0 rev 520893 from about two weeks back. > > > > /regards Mats > > > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester
Update, I switched to the latest snapshot and got the same error On 4/4/07, Mats Norén <[EMAIL PROTECTED]> wrote: > I try to setup a simple testcase with a bookmarkablepage and get the > following exception about the serialization. > > INFO - Application- [WicketTester$1] init: Wicket > extensions initializer > INFO - Application- [WicketTester$1] init: Wicket > core library initializer > INFO - Application- [WicketTester$1] init: Wicket JMX > initializer > INFO - Initializer- registering Wicket mbeans with > server [EMAIL PROTECTED] > INFO - WebApplication - [WicketTester$1] Started Wicket > in development mode > ERROR - Objects- Error serializing object class > wicket.util.tester.DummyHomePage [object=[Page class = > wicket.util.tester.DummyHomePage, id = 0, version = 0]] > wicket.util.io.WicketSerializeableException: No serializeable > constructor found for class > wicket.protocol.http.MockHttpServletRequest > wicket.util.tester.DummyHomePage->testPageSource->se.curalia.ekn.page.project.ProjectLeadAddsComment$1->this$0->se.curalia.ekn.page.project.ProjectLeadAddsComment->tester->wicket.util.tester.WicketTester->servletRequest > NOTE: if you feel Wicket is at fault with this exception, please > report to the mailing list. You can switch to JDK based serialization > by calling: wicket.util.lang.Objects.setObjectStreamFactory(new > IObjectStreamFactory.DefaultObjectStreamFactory()) e.g. in the init > method of your application > > The testing code: > > > AnnotApplicationContextMock appctx = new AnnotApplicationContextMock(); > appctx.putBean("commentDAO", commentDAO); > appctx.putBean("projectDAO", projectDAO); > > > this.tester.getApplication().addComponentInstantiationListener(new > SpringComponentInjector(this.tester.getApplication(), appctx)); > > tester.startPage(new ITestPageSource() { > public Page getTestPage() { > PageParameters params = new PageParameters(); > params.add("id", "1"); > return new Diary(params); > } > }); > > I'm using incubator-1.3.0 rev 520893 from about two weeks back. > > /regards Mats > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester
I try to setup a simple testcase with a bookmarkablepage and get the following exception about the serialization. INFO - Application- [WicketTester$1] init: Wicket extensions initializer INFO - Application- [WicketTester$1] init: Wicket core library initializer INFO - Application- [WicketTester$1] init: Wicket JMX initializer INFO - Initializer- registering Wicket mbeans with server [EMAIL PROTECTED] INFO - WebApplication - [WicketTester$1] Started Wicket in development mode ERROR - Objects- Error serializing object class wicket.util.tester.DummyHomePage [object=[Page class = wicket.util.tester.DummyHomePage, id = 0, version = 0]] wicket.util.io.WicketSerializeableException: No serializeable constructor found for class wicket.protocol.http.MockHttpServletRequest wicket.util.tester.DummyHomePage->testPageSource->se.curalia.ekn.page.project.ProjectLeadAddsComment$1->this$0->se.curalia.ekn.page.project.ProjectLeadAddsComment->tester->wicket.util.tester.WicketTester->servletRequest NOTE: if you feel Wicket is at fault with this exception, please report to the mailing list. You can switch to JDK based serialization by calling: wicket.util.lang.Objects.setObjectStreamFactory(new IObjectStreamFactory.DefaultObjectStreamFactory()) e.g. in the init method of your application The testing code: AnnotApplicationContextMock appctx = new AnnotApplicationContextMock(); appctx.putBean("commentDAO", commentDAO); appctx.putBean("projectDAO", projectDAO); this.tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(this.tester.getApplication(), appctx)); tester.startPage(new ITestPageSource() { public Page getTestPage() { PageParameters params = new PageParameters(); params.add("id", "1"); return new Diary(params); } }); I'm using incubator-1.3.0 rev 520893 from about two weeks back. /regards Mats - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester
Hi, Is there an example on how to test bookmarkable pages with pageparameters? Do I have to use the ITestPage and call the constructor page(PageParameters params)? /Mats - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester message resolution
You are using 1.2.x? To me it sounds like a bug that WicketTester or MockWebApplication does not look into the application properties file as a normal "Application" does. We should simply look at the config of normal application and copy the one line of config into WicketTester. Juergen On 3/7/07, Jean-Baptiste Quenot <[EMAIL PROTECTED]> wrote: > * Dmitry Kandalov: > > > > > > Jean-Baptiste Quenot-3 wrote: > > > > > > Nice code snippet, would you mind opening an issue, and providing > > > your sample code as attachment? > > > > Sure, https://issues.apache.org/jira/browse/WICKET-368 > > Thanks! > > > Could you please also take a look at > > https://issues.apache.org/jira/browse/WICKET-258 :) > > Yes, it's on my TODO list, I'll do it if no one beats me. > -- > Jean-Baptiste Quenot > aka John Banana Qwerty > http://caraldi.com/jbq/ > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester message resolution
* Dmitry Kandalov: > > > Jean-Baptiste Quenot-3 wrote: > > > > Nice code snippet, would you mind opening an issue, and providing > > your sample code as attachment? > > Sure, https://issues.apache.org/jira/browse/WICKET-368 Thanks! > Could you please also take a look at > https://issues.apache.org/jira/browse/WICKET-258 :) Yes, it's on my TODO list, I'll do it if no one beats me. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester message resolution
Jean-Baptiste Quenot-3 wrote: > > * Dmitry Kandalov: > >> To use application properties I extend WicketTester and have >> this in constructor: > > Hi Dmitry, > > Nice code snippet, would you mind opening an issue, and providing > your sample code as attachment? > Sure, https://issues.apache.org/jira/browse/WICKET-368 Could you please also take a look at https://issues.apache.org/jira/browse/WICKET-258 :) -- View this message in context: http://www.nabble.com/WicketTester-message-resolution-tf3360811.html#a9350442 Sent from the Wicket - User mailing list archive at Nabble.com. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester message resolution
* Dmitry Kandalov: > To use application properties I extend WicketTester and have > this in constructor: Hi Dmitry, Nice code snippet, would you mind opening an issue, and providing your sample code as attachment? Thanks in advance, -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester message resolution
On 3/7/07, Dmitry Kandalov <[EMAIL PROTECTED]> wrote: > To use application properties I extend WicketTester and have this in > constructor: > [CUT] Thanks Dmitry I'll give it a try -- Filippo Diotalevi http://www.diotalevi.com http://www.jugmilano.it - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester message resolution
FilippoDiotalevi wrote: > > Hi, > my application is in the (usual, I think) situation where the messages > for the page (i.e.) ContactMePage are partly contained in the > ContactMePage.properties file, and partly in the global > MyWebApplication.properties file. > > In this situation, when I use WicketTester to test the ContactMePage I > see a lot of INFO log like: > > WicketMessageResolver - No value found for message key: contact.email > > because the MockWebApplication cannot resolve messages belonging to > the global property file. > Is there a way to make WicketTester aware of the existence of global > message bundles? > > (And a more general question) how do you test that all wicket:messages > are rendered correctly? > To use application properties I extend WicketTester and have this in constructor: CompoundResourceStreamLocator locator = ( CompoundResourceStreamLocator )getResourceSettings().getResourceStreamLocator(); locator.add( 0, new AbstractResourceStreamLocator() { protected IResourceStream locate( final Class clazz, final String path ) { String testPropertiesFile = MyTester.class.getSimpleName() + ".properties"; String realPropertiesFile = MyApplication.class.getSimpleName() + ".properties"; if( path.contains( testPropertiesFile ) ) { String substitutedPath = path.replace( testPropertiesFile, realPropertiesFile ); return new ClassLoaderResourceStreamLocator().locate( MyApplication.class, substitutedPath ); } return null; } } ); I test wicket:messages simply with WicketTester#assertLabel(...) -- View this message in context: http://www.nabble.com/WicketTester-message-resolution-tf3360811.html#a9349318 Sent from the Wicket - User mailing list archive at Nabble.com. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester message resolution
Hi, my application is in the (usual, I think) situation where the messages for the page (i.e.) ContactMePage are partly contained in the ContactMePage.properties file, and partly in the global MyWebApplication.properties file. In this situation, when I use WicketTester to test the ContactMePage I see a lot of INFO log like: WicketMessageResolver - No value found for message key: contact.email because the MockWebApplication cannot resolve messages belonging to the global property file. Is there a way to make WicketTester aware of the existence of global message bundles? (And a more general question) how do you test that all wicket:messages are rendered correctly? Thanks -- Filippo Diotalevi http://www.diotalevi.com http://www.jugmilano.it - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester question
On 3/4/07, Jean-Baptiste Quenot <[EMAIL PROTECTED]> wrote: > So, you're using Wicket 1.2.5? Yes, Wicket 1.2.5 -- Filippo Diotalevi http://www.diotalevi.com http://www.jugmilano.it - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester question
So, you're using Wicket 1.2.5? I came across the same thing, and had to disable a unit test: See bugTestPageConstructor() in WicketTesterTest And like you it uses the startPage(Page) method. What is really strange is that the same code runs smoothly in Wicket 2. Help from the team would be appreciated, I couldn't find the culprit yet. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester question
On 3/2/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > All the components are logged as 'not rendered', but all tests are > > passed and the application works. > > Is this the normal behaviour of tests? > > That doesn't look normal to me. Did you get any further insight? Yes, what I discovered is that if I initialize the WicketTester with the construct wt.startPage(new ITestPageSource() { public Page getTestPage() { return new SummaryJob(new JobPost()); } }); everything goes well; on the contrary, if I use the other constructor wt.startPage(new SummaryJob(new JobPost())); the test runs fine, but I have all the exceptions I reported before in the log. -- Filippo Diotalevi http://www.diotalevi.com http://www.jugmilano.it - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester question
> All the components are logged as 'not rendered', but all tests are > passed and the application works. > Is this the normal behaviour of tests? That doesn't look normal to me. Did you get any further insight? Eelco - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester question
Hi, I'm writing tests using WicketTester (with Wicket 1.2.5); a sample test is: public void testPageShouldHaveRequiredComponents() { WicketTester wt = new WicketTester(); wt.startPage(new SummaryPage(JobPostCreatorHelper.createJobPost())); wt.assertLabel("company.name", JobPostCreatorHelper.COMPANY_NAME); wt.assertLabel("company.description", JobPostCreatorHelper.COMPANY_DESCRIPTION); } The test runs fine, but the logs are filled with exceptions like: ERROR - RequestCycle - The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered). 1. [MarkupContainer [Component id = _, page = board.pages.SummaryPage, path = 0:_.HtmlBodyContainer, isVisible = true, isVersioned = true]] 2. [Component id = company.name, page =board.pages.SummaryPage, path = 0:company.name.Label, isVisible = true, isVersioned = true] All the components are logged as 'not rendered', but all tests are passed and the application works. Is this the normal behaviour of tests? -- Filippo Diotalevi http://www.diotalevi.com http://www.jugmilano.it - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and DropDownChoice.onSelectionChanged()
* Johan Compagner: > something like this: > >setupRequestAndResponse(); >getServletRequest().setRequestToComponent(DDC); >processRequestCycle(); Since a few seconds in 1.3 you can also do directly: tester.executeListener(DDC); -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and DropDownChoice.onSelectionChanged()
something like this: setupRequestAndResponse(); getServletRequest().setRequestToComponent(DDC); processRequestCycle(); johan On 2/7/07, Dmitry Kandalov <[EMAIL PROTECTED]> wrote: Hi, I have a code like this formTester.select( PATH_TO_DDC, 2 ); formTester.submit(); And I want onSelectionChanged() event to be called on DropDownChoice. What is the best way to do it? Thanks in advance. -- View this message in context: http://www.nabble.com/WicketTester-and-DropDownChoice.onSelectionChanged%28%29-tf3185588.html#a8841575 Sent from the Wicket - User mailing list archive at Nabble.com. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester and DropDownChoice.onSelectionChanged()
Hi, I have a code like this formTester.select( PATH_TO_DDC, 2 ); formTester.submit(); And I want onSelectionChanged() event to be called on DropDownChoice. What is the best way to do it? Thanks in advance. -- View this message in context: http://www.nabble.com/WicketTester-and-DropDownChoice.onSelectionChanged%28%29-tf3185588.html#a8841575 Sent from the Wicket - User mailing list archive at Nabble.com. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] wickettester: PageExpiredErrorPage
Hi, I am using WicketTester and have the following code for submitting a form: public void testRegistrationEmptyForm() { FormTester form = _tester.newFormTester("editPersonPanel:personForm"); form.submit(); _tester.assertRenderedPage(Registration.class); } Now, the final assertion fails with the message ComparisonFailure: expected but was . What could be the problem? Cheers Erik - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester migrating from 1.1 to 1.2
This works perfectly. Thanks. - Dave On Aug 7, 2006, at 10:09 PM, Juergen Donnerstag wrote: > This is how WicketTestCase does it and it is used in hundreds of tests > > application = new WicketTester(null); > application.setHomePage(pageClass); > > // Do the processing > application.setupRequestAndResponse(); > application.processRequestCycle(); > > assertEquals(pageClass, > application.getLastRenderedPage().getClass > ()); > > // Validate the document > String document = > application.getServletResponse().getDocument(); > > Juergen - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester migrating from 1.1 to 1.2
Why are you calling again render on the page?The page is already rendered by the call startPage()On 8/8/06, David Hansen < [EMAIL PROTECTED]> wrote:For the last little while, we've been doing just fine under 1.1 withthe following( for generation of email, the text of which is pulledfrom the response ): WicketTester tester = new WicketTester( ); StringResponse response = new StringResponse( ); RequestCycle cycle = tester.createRequestCycle( ); tester.getWicketSession( ).setRequestCycle( cycle ); cycle.setResponse( response ); Page page = tester.startPage( newOrderPlaced.XPageSource( order ) ); page.getSession( ).setRequestCycle( cycle ); page.render( );As part of our effort to migrate to 1.2, however,Session#setRequestCycle( ) no longer exists, so we tried assumingthat WicketTester would create a RequestCycle and put it intothreadlocal where the result of tester.startPage( ) would have access to it, but no dice. page.getRequestCycle( ) returns null andpage.render( ) results in an NPE thrown in Page#configureResponse( )Any ways around this? Bear in mind this is being run inside a workerthread completely outside the main wicket app, so pushing and popping sessions won't work here. Thanks. - Dave-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester migrating from 1.1 to 1.2
This is how WicketTestCase does it and it is used in hundreds of tests application = new WicketTester(null); application.setHomePage(pageClass); // Do the processing application.setupRequestAndResponse(); application.processRequestCycle(); assertEquals(pageClass, application.getLastRenderedPage().getClass()); // Validate the document String document = application.getServletResponse().getDocument(); Juergen On 8/8/06, David Hansen <[EMAIL PROTECTED]> wrote: > For the last little while, we've been doing just fine under 1.1 with > the following( for generation of email, the text of which is pulled > from the response ): > > WicketTester tester = new WicketTester( ); > > StringResponse response = new StringResponse( ); > RequestCycle cycle = tester.createRequestCycle( ); > > tester.getWicketSession( ).setRequestCycle > ( cycle ); > cycle.setResponse( response ); > > Page page = tester.startPage( new > OrderPlaced.XPageSource( order ) ); > page.getSession( ).setRequestCycle( cycle ); > page.render( ); > > As part of our effort to migrate to 1.2, however, > Session#setRequestCycle( ) no longer exists, so we tried assuming > that WicketTester would create a RequestCycle and put it into > threadlocal where the result of tester.startPage( ) would have access > to it, but no dice. page.getRequestCycle( ) returns null and > page.render( ) results in an NPE thrown in Page#configureResponse( ) > > Any ways around this? Bear in mind this is being run inside a worker > thread completely outside the main wicket app, so pushing and popping > sessions won't work here. Thanks. > > - Dave > > > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester migrating from 1.1 to 1.2
For the last little while, we've been doing just fine under 1.1 with the following( for generation of email, the text of which is pulled from the response ): WicketTester tester = new WicketTester( ); StringResponse response = new StringResponse( ); RequestCycle cycle = tester.createRequestCycle( ); tester.getWicketSession( ).setRequestCycle ( cycle ); cycle.setResponse( response ); Page page = tester.startPage( new OrderPlaced.XPageSource( order ) ); page.getSession( ).setRequestCycle( cycle ); page.render( ); As part of our effort to migrate to 1.2, however, Session#setRequestCycle( ) no longer exists, so we tried assuming that WicketTester would create a RequestCycle and put it into threadlocal where the result of tester.startPage( ) would have access to it, but no dice. page.getRequestCycle( ) returns null and page.render( ) results in an NPE thrown in Page#configureResponse( ) Any ways around this? Bear in mind this is being run inside a worker thread completely outside the main wicket app, so pushing and popping sessions won't work here. Thanks. - Dave - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
It is just a bug. Thanks a lot !On 6/23/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: Fixed now.EelcoOn 6/22/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:> I guess it is a bug.>> Juergen>> On 6/22/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > ITestPageSource is not serializable. If it was, you wouldn't have this> > problem. I don't use that part of Wicket myself, nor wrote it, so I'm> > not sure if that interface not being serializable is intentional. > > Maybe Ingram Chen can comment on that?> >> > Eelco> >> >> > On 6/22/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > > > Juergen Donnerstag wrote:> > > > HTTP sessions and hence Wicket Pages get serialized and hence all it> > > > components and variable must be serializable or transient. We enforced > > > > that policy a little bit to make sure the error are detected earlier> > > > and late when the application is deployed already. Just make sure your> > > > components and component variable implement Serializable. > > >> > > I am aware of that. Please look at the example code I included in my> > > previous post. It's a trivial WebPage with a single label, and some> > > WicketTester test code. That's all that's needed to cause the exception. > > >This is code that I almost copied verbatim from the WicketTester api> > > docs.> > >> > > There are no custom beans, so I don't see what I could make> > > Serializable. In the actual project where I'm running into these > > > problems, all beans are serializable or transient, and all business> > > objects are injected with Spring proxies. (using @SpringBean annotations).> > >> > > The webapplication runs fine, it's *just* the WicketTester code that fails. > > >> > > Maybe there is a simple solution to this problem, but I'm obviously> > > overlooking it.> > >> > > cheers,> > > Gert> > > > > >> > >> > > >> > > > wicket.WicketRuntimeException: Internal error cloning object. Make sure> > > > all dependent objects implement Serializable. Class: > > > > wicket.util.tester.DummyHomePage> > > >> > > >> > > > On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > > > >> Hi list,> > > >>> > > >> After upgrading to Wicket 1.2, wicket tests for my project don't work> > > >> anymore. Testing a page that is initialized using a custom constructor > > > >> causes a WicketRuntimeException:> > > >>> > > >> wicket.WicketRuntimeException: Internal error cloning object. Make sure> > > >> all dependent objects implement Serializable. Class: > > > >> wicket.util.tester.DummyHomePage> > > >> at> > > >> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62)> > > >> [... bits of stacktrace omitted for brevity ...] > > > >> Caused by: java.io.NotSerializableException: com.example.MyPageTest$1> > > >>at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)> > > >>at > > > >> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)> > > >> [... rest of stacktrace omitted for brevity ...]> > > >>> > > >> > > > >> I created the initialized page with an anonymous ITestPageSource, as per> > > >> the WicketTester javadocs.> > > >>> > > >> Consider the following example code that causes the error: > > > >>> > > >> MyPage.html:> > > >> - - - - - - - - - - - - - - - - - - - - - - - - - -> > > >> http://wicket.sourceforge.net/">> > > >> bla> > > >> > > > >> (title) > > > >> > > > >> > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - -> > > >>> > > >> > > > >> MyPage.java:> > > >> - - - - - - - - - - - - - - - - - - - - - - - - - -> > > >> package com.example;> > > >>> > > >> import wicket.markup.html.WebPage;> > > >> import wicket.markup.html.basic.Label;> > > >>> > > >> public class MyPage extends WebPage {> > > >>> > > >> public MyPage() { > > > >> this("empty");> > > >> }> > > >>> > > >> public MyPage(String title) {> > > >> add(new Label("title",title)); > > > >> }> > > >> }> > > >> - - - - - - - - - - - - - - - - - - - - - - - - - -> > > >>> > > >>> > > >> and finally, MyPageTest.java:> > > >> - - - - - - - - - - - - - - - - - - - - - - - - - -> > > >> package com.example;> > > >>> > > >> import junit.framework.TestCase ;> > > >> import wicket.Page;> > > >> import wicket.util.tester.ITestPageSource;> > > >> import wicket.util.tester.WicketTester;> > > >>> > > >> public class MyPageTest extends TestCase { > > > >>> > > >> public void testRenderMyPage() {> > > >> WicketTester tester = new WicketTester();> > > >>> > > >> // the following statement throws the exception: > > > >> tester.startPage(new ITestPageSource() {> > > >> public Page getTestPage() {> > > >> return new MyPage("hello world");> > > >> } > > > >> });> > > >> }> > > >> }> > > >> - - - - - - - - - - - - - - - - - - - - - - - - - -> > > >>> > > >> What's happening here? Most of my pages use custom constructors to > > > >> initialize the page, and every test method that use these cause the> > > >> error. What can I do
Re: [Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
Fixed now. Eelco On 6/22/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: > I guess it is a bug. > > Juergen > > On 6/22/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > ITestPageSource is not serializable. If it was, you wouldn't have this > > problem. I don't use that part of Wicket myself, nor wrote it, so I'm > > not sure if that interface not being serializable is intentional. > > Maybe Ingram Chen can comment on that? > > > > Eelco > > > > > > On 6/22/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > > > Juergen Donnerstag wrote: > > > > HTTP sessions and hence Wicket Pages get serialized and hence all it > > > > components and variable must be serializable or transient. We enforced > > > > that policy a little bit to make sure the error are detected earlier > > > > and late when the application is deployed already. Just make sure your > > > > components and component variable implement Serializable. > > > > > > I am aware of that. Please look at the example code I included in my > > > previous post. It's a trivial WebPage with a single label, and some > > > WicketTester test code. That's all that's needed to cause the exception. > > >This is code that I almost copied verbatim from the WicketTester api > > > docs. > > > > > > There are no custom beans, so I don't see what I could make > > > Serializable. In the actual project where I'm running into these > > > problems, all beans are serializable or transient, and all business > > > objects are injected with Spring proxies. (using @SpringBean annotations). > > > > > > The webapplication runs fine, it's *just* the WicketTester code that > > > fails. > > > > > > Maybe there is a simple solution to this problem, but I'm obviously > > > overlooking it. > > > > > > cheers, > > > Gert > > > > > > > > > > > > > > > > > wicket.WicketRuntimeException: Internal error cloning object. Make sure > > > > all dependent objects implement Serializable. Class: > > > > wicket.util.tester.DummyHomePage > > > > > > > > > > > > On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > > > >> Hi list, > > > >> > > > >> After upgrading to Wicket 1.2, wicket tests for my project don't work > > > >> anymore. Testing a page that is initialized using a custom constructor > > > >> causes a WicketRuntimeException: > > > >> > > > >> wicket.WicketRuntimeException: Internal error cloning object. Make sure > > > >> all dependent objects implement Serializable. Class: > > > >> wicket.util.tester.DummyHomePage > > > >> at > > > >> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62) > > > >> [... bits of stacktrace omitted for brevity ...] > > > >> Caused by: java.io.NotSerializableException: com.example.MyPageTest$1 > > > >>at > > > >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) > > > >>at > > > >> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) > > > >> [... rest of stacktrace omitted for brevity ...] > > > >> > > > >> > > > >> I created the initialized page with an anonymous ITestPageSource, as > > > >> per > > > >> the WicketTester javadocs. > > > >> > > > >> Consider the following example code that causes the error: > > > >> > > > >> MyPage.html: > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > > >> http://wicket.sourceforge.net/";> > > > >> bla > > > >> > > > >> (title) > > > >> > > > >> > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > > >> > > > >> > > > >> MyPage.java: > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > > >> package com.example; > > > >> > > > >> import wicket.markup.html.WebPage; > > > >> import wicket.markup.html.basic.Label; > > > >> > > > >> public class MyPage extends WebPage { > > > >> > > > >> public MyPage() { > > > >> this("empty"); > > > >> } > > > >> > > > >> public MyPage(String title) { > > > >> add(new Label("title",title)); > > > >> } > > > >> } > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > > >> > > > >> > > > >> and finally, MyPageTest.java: > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > > >> package com.example; > > > >> > > > >> import junit.framework.TestCase; > > > >> import wicket.Page; > > > >> import wicket.util.tester.ITestPageSource; > > > >> import wicket.util.tester.WicketTester; > > > >> > > > >> public class MyPageTest extends TestCase { > > > >> > > > >> public void testRenderMyPage() { > > > >> WicketTester tester = new WicketTester(); > > > >> > > > >> // the following statement throws the exception: > > > >> tester.startPage(new ITestPageSource() { > > > >> public Page getTestPage() { > > > >> return new MyPage("hello world"); > > > >> } > > > >> }); > > > >> } > > > >> } > > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > > >> > > > >> What's happening here? Most of my pages use custom constructors to > > > >> initialize the page, and every test method that us
Re: [Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
I guess it is a bug. Juergen On 6/22/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > ITestPageSource is not serializable. If it was, you wouldn't have this > problem. I don't use that part of Wicket myself, nor wrote it, so I'm > not sure if that interface not being serializable is intentional. > Maybe Ingram Chen can comment on that? > > Eelco > > > On 6/22/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > > Juergen Donnerstag wrote: > > > HTTP sessions and hence Wicket Pages get serialized and hence all it > > > components and variable must be serializable or transient. We enforced > > > that policy a little bit to make sure the error are detected earlier > > > and late when the application is deployed already. Just make sure your > > > components and component variable implement Serializable. > > > > I am aware of that. Please look at the example code I included in my > > previous post. It's a trivial WebPage with a single label, and some > > WicketTester test code. That's all that's needed to cause the exception. > >This is code that I almost copied verbatim from the WicketTester api > > docs. > > > > There are no custom beans, so I don't see what I could make > > Serializable. In the actual project where I'm running into these > > problems, all beans are serializable or transient, and all business > > objects are injected with Spring proxies. (using @SpringBean annotations). > > > > The webapplication runs fine, it's *just* the WicketTester code that fails. > > > > Maybe there is a simple solution to this problem, but I'm obviously > > overlooking it. > > > > cheers, > > Gert > > > > > > > > > > > > wicket.WicketRuntimeException: Internal error cloning object. Make sure > > > all dependent objects implement Serializable. Class: > > > wicket.util.tester.DummyHomePage > > > > > > > > > On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > > >> Hi list, > > >> > > >> After upgrading to Wicket 1.2, wicket tests for my project don't work > > >> anymore. Testing a page that is initialized using a custom constructor > > >> causes a WicketRuntimeException: > > >> > > >> wicket.WicketRuntimeException: Internal error cloning object. Make sure > > >> all dependent objects implement Serializable. Class: > > >> wicket.util.tester.DummyHomePage > > >> at > > >> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62) > > >> [... bits of stacktrace omitted for brevity ...] > > >> Caused by: java.io.NotSerializableException: com.example.MyPageTest$1 > > >>at > > >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) > > >>at > > >> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) > > >> [... rest of stacktrace omitted for brevity ...] > > >> > > >> > > >> I created the initialized page with an anonymous ITestPageSource, as per > > >> the WicketTester javadocs. > > >> > > >> Consider the following example code that causes the error: > > >> > > >> MyPage.html: > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > >> http://wicket.sourceforge.net/";> > > >> bla > > >> > > >> (title) > > >> > > >> > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > >> > > >> > > >> MyPage.java: > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > >> package com.example; > > >> > > >> import wicket.markup.html.WebPage; > > >> import wicket.markup.html.basic.Label; > > >> > > >> public class MyPage extends WebPage { > > >> > > >> public MyPage() { > > >> this("empty"); > > >> } > > >> > > >> public MyPage(String title) { > > >> add(new Label("title",title)); > > >> } > > >> } > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > >> > > >> > > >> and finally, MyPageTest.java: > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > >> package com.example; > > >> > > >> import junit.framework.TestCase; > > >> import wicket.Page; > > >> import wicket.util.tester.ITestPageSource; > > >> import wicket.util.tester.WicketTester; > > >> > > >> public class MyPageTest extends TestCase { > > >> > > >> public void testRenderMyPage() { > > >> WicketTester tester = new WicketTester(); > > >> > > >> // the following statement throws the exception: > > >> tester.startPage(new ITestPageSource() { > > >> public Page getTestPage() { > > >> return new MyPage("hello world"); > > >> } > > >> }); > > >> } > > >> } > > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > > >> > > >> What's happening here? Most of my pages use custom constructors to > > >> initialize the page, and every test method that use these cause the > > >> error. What can I do about it? > > >> > > >> cheers, > > >> Gert > > >> > > >> > > >> -- > > >> Gert Jan Verhoog > > >> Func. Internet Integration > > >> W http://www.func.nl > > >> T +31 30 2109750 > > >> F +31 30 2109751 > > >> > > >> > > >> ___ > > >> Wicket-user mailing list > > >>
Re: [Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
ITestPageSource is not serializable. If it was, you wouldn't have this problem. I don't use that part of Wicket myself, nor wrote it, so I'm not sure if that interface not being serializable is intentional. Maybe Ingram Chen can comment on that? Eelco On 6/22/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > Juergen Donnerstag wrote: > > HTTP sessions and hence Wicket Pages get serialized and hence all it > > components and variable must be serializable or transient. We enforced > > that policy a little bit to make sure the error are detected earlier > > and late when the application is deployed already. Just make sure your > > components and component variable implement Serializable. > > I am aware of that. Please look at the example code I included in my > previous post. It's a trivial WebPage with a single label, and some > WicketTester test code. That's all that's needed to cause the exception. >This is code that I almost copied verbatim from the WicketTester api > docs. > > There are no custom beans, so I don't see what I could make > Serializable. In the actual project where I'm running into these > problems, all beans are serializable or transient, and all business > objects are injected with Spring proxies. (using @SpringBean annotations). > > The webapplication runs fine, it's *just* the WicketTester code that fails. > > Maybe there is a simple solution to this problem, but I'm obviously > overlooking it. > > cheers, > Gert > > > > > > > wicket.WicketRuntimeException: Internal error cloning object. Make sure > > all dependent objects implement Serializable. Class: > > wicket.util.tester.DummyHomePage > > > > > > On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > >> Hi list, > >> > >> After upgrading to Wicket 1.2, wicket tests for my project don't work > >> anymore. Testing a page that is initialized using a custom constructor > >> causes a WicketRuntimeException: > >> > >> wicket.WicketRuntimeException: Internal error cloning object. Make sure > >> all dependent objects implement Serializable. Class: > >> wicket.util.tester.DummyHomePage > >> at > >> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62) > >> [... bits of stacktrace omitted for brevity ...] > >> Caused by: java.io.NotSerializableException: com.example.MyPageTest$1 > >>at > >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) > >>at > >> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) > >> [... rest of stacktrace omitted for brevity ...] > >> > >> > >> I created the initialized page with an anonymous ITestPageSource, as per > >> the WicketTester javadocs. > >> > >> Consider the following example code that causes the error: > >> > >> MyPage.html: > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > >> http://wicket.sourceforge.net/";> > >> bla > >> > >> (title) > >> > >> > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > >> > >> > >> MyPage.java: > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > >> package com.example; > >> > >> import wicket.markup.html.WebPage; > >> import wicket.markup.html.basic.Label; > >> > >> public class MyPage extends WebPage { > >> > >> public MyPage() { > >> this("empty"); > >> } > >> > >> public MyPage(String title) { > >> add(new Label("title",title)); > >> } > >> } > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > >> > >> > >> and finally, MyPageTest.java: > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > >> package com.example; > >> > >> import junit.framework.TestCase; > >> import wicket.Page; > >> import wicket.util.tester.ITestPageSource; > >> import wicket.util.tester.WicketTester; > >> > >> public class MyPageTest extends TestCase { > >> > >> public void testRenderMyPage() { > >> WicketTester tester = new WicketTester(); > >> > >> // the following statement throws the exception: > >> tester.startPage(new ITestPageSource() { > >> public Page getTestPage() { > >> return new MyPage("hello world"); > >> } > >> }); > >> } > >> } > >> - - - - - - - - - - - - - - - - - - - - - - - - - - > >> > >> What's happening here? Most of my pages use custom constructors to > >> initialize the page, and every test method that use these cause the > >> error. What can I do about it? > >> > >> cheers, > >> Gert > >> > >> > >> -- > >> Gert Jan Verhoog > >> Func. Internet Integration > >> W http://www.func.nl > >> T +31 30 2109750 > >> F +31 30 2109751 > >> > >> > >> ___ > >> Wicket-user mailing list > >> Wicket-user@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/wicket-user > >> > > > > > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > -- > Gert Jan Verhoog > Func. Internet Integration > W http://www.func.nl
Re: [Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
Juergen Donnerstag wrote: > HTTP sessions and hence Wicket Pages get serialized and hence all it > components and variable must be serializable or transient. We enforced > that policy a little bit to make sure the error are detected earlier > and late when the application is deployed already. Just make sure your > components and component variable implement Serializable. I am aware of that. Please look at the example code I included in my previous post. It's a trivial WebPage with a single label, and some WicketTester test code. That's all that's needed to cause the exception. This is code that I almost copied verbatim from the WicketTester api docs. There are no custom beans, so I don't see what I could make Serializable. In the actual project where I'm running into these problems, all beans are serializable or transient, and all business objects are injected with Spring proxies. (using @SpringBean annotations). The webapplication runs fine, it's *just* the WicketTester code that fails. Maybe there is a simple solution to this problem, but I'm obviously overlooking it. cheers, Gert > > wicket.WicketRuntimeException: Internal error cloning object. Make sure > all dependent objects implement Serializable. Class: > wicket.util.tester.DummyHomePage > > > On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: >> Hi list, >> >> After upgrading to Wicket 1.2, wicket tests for my project don't work >> anymore. Testing a page that is initialized using a custom constructor >> causes a WicketRuntimeException: >> >> wicket.WicketRuntimeException: Internal error cloning object. Make sure >> all dependent objects implement Serializable. Class: >> wicket.util.tester.DummyHomePage >> at >> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62) >> [... bits of stacktrace omitted for brevity ...] >> Caused by: java.io.NotSerializableException: com.example.MyPageTest$1 >>at >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) >>at >> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) >> [... rest of stacktrace omitted for brevity ...] >> >> >> I created the initialized page with an anonymous ITestPageSource, as per >> the WicketTester javadocs. >> >> Consider the following example code that causes the error: >> >> MyPage.html: >> - - - - - - - - - - - - - - - - - - - - - - - - - - >> http://wicket.sourceforge.net/";> >> bla >> >> (title) >> >> >> - - - - - - - - - - - - - - - - - - - - - - - - - - >> >> >> MyPage.java: >> - - - - - - - - - - - - - - - - - - - - - - - - - - >> package com.example; >> >> import wicket.markup.html.WebPage; >> import wicket.markup.html.basic.Label; >> >> public class MyPage extends WebPage { >> >> public MyPage() { >> this("empty"); >> } >> >> public MyPage(String title) { >> add(new Label("title",title)); >> } >> } >> - - - - - - - - - - - - - - - - - - - - - - - - - - >> >> >> and finally, MyPageTest.java: >> - - - - - - - - - - - - - - - - - - - - - - - - - - >> package com.example; >> >> import junit.framework.TestCase; >> import wicket.Page; >> import wicket.util.tester.ITestPageSource; >> import wicket.util.tester.WicketTester; >> >> public class MyPageTest extends TestCase { >> >> public void testRenderMyPage() { >> WicketTester tester = new WicketTester(); >> >> // the following statement throws the exception: >> tester.startPage(new ITestPageSource() { >> public Page getTestPage() { >> return new MyPage("hello world"); >> } >> }); >> } >> } >> - - - - - - - - - - - - - - - - - - - - - - - - - - >> >> What's happening here? Most of my pages use custom constructors to >> initialize the page, and every test method that use these cause the >> error. What can I do about it? >> >> cheers, >> Gert >> >> >> -- >> Gert Jan Verhoog >> Func. Internet Integration >> W http://www.func.nl >> T +31 30 2109750 >> F +31 30 2109751 >> >> >> ___ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user -- Gert Jan Verhoog Func. Internet Integration W http://www.func.nl T +31 30 2109750 F +31 30 2109751 All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
HTTP sessions and hence Wicket Pages get serialized and hence all it components and variable must be serializable or transient. We enforced that policy a little bit to make sure the error are detected earlier and late when the application is deployed already. Just make sure your components and component variable implement Serializable. wicket.WicketRuntimeException: Internal error cloning object. Make sure all dependent objects implement Serializable. Class: wicket.util.tester.DummyHomePage On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote: > Hi list, > > After upgrading to Wicket 1.2, wicket tests for my project don't work > anymore. Testing a page that is initialized using a custom constructor > causes a WicketRuntimeException: > > wicket.WicketRuntimeException: Internal error cloning object. Make sure > all dependent objects implement Serializable. Class: > wicket.util.tester.DummyHomePage > at > wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62) > [... bits of stacktrace omitted for brevity ...] > Caused by: java.io.NotSerializableException: com.example.MyPageTest$1 >at > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) >at > java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) > [... rest of stacktrace omitted for brevity ...] > > > I created the initialized page with an anonymous ITestPageSource, as per > the WicketTester javadocs. > > Consider the following example code that causes the error: > > MyPage.html: > - - - - - - - - - - - - - - - - - - - - - - - - - - > http://wicket.sourceforge.net/";> > bla > > (title) > > > - - - - - - - - - - - - - - - - - - - - - - - - - - > > > MyPage.java: > - - - - - - - - - - - - - - - - - - - - - - - - - - > package com.example; > > import wicket.markup.html.WebPage; > import wicket.markup.html.basic.Label; > > public class MyPage extends WebPage { > > public MyPage() { > this("empty"); > } > > public MyPage(String title) { > add(new Label("title",title)); > } > } > - - - - - - - - - - - - - - - - - - - - - - - - - - > > > and finally, MyPageTest.java: > - - - - - - - - - - - - - - - - - - - - - - - - - - > package com.example; > > import junit.framework.TestCase; > import wicket.Page; > import wicket.util.tester.ITestPageSource; > import wicket.util.tester.WicketTester; > > public class MyPageTest extends TestCase { > > public void testRenderMyPage() { > WicketTester tester = new WicketTester(); > > // the following statement throws the exception: > tester.startPage(new ITestPageSource() { > public Page getTestPage() { > return new MyPage("hello world"); > } > }); > } > } > - - - - - - - - - - - - - - - - - - - - - - - - - - > > What's happening here? Most of my pages use custom constructors to > initialize the page, and every test method that use these cause the > error. What can I do about it? > > cheers, > Gert > > > -- > Gert Jan Verhoog > Func. Internet Integration > W http://www.func.nl > T +31 30 2109750 > F +31 30 2109751 > > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester in 1.2 causing "internal error cloning object" errors.
Hi list, After upgrading to Wicket 1.2, wicket tests for my project don't work anymore. Testing a page that is initialized using a custom constructor causes a WicketRuntimeException: wicket.WicketRuntimeException: Internal error cloning object. Make sure all dependent objects implement Serializable. Class: wicket.util.tester.DummyHomePage at wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62) [... bits of stacktrace omitted for brevity ...] Caused by: java.io.NotSerializableException: com.example.MyPageTest$1 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) [... rest of stacktrace omitted for brevity ...] I created the initialized page with an anonymous ITestPageSource, as per the WicketTester javadocs. Consider the following example code that causes the error: MyPage.html: - - - - - - - - - - - - - - - - - - - - - - - - - - http://wicket.sourceforge.net/";> bla (title) - - - - - - - - - - - - - - - - - - - - - - - - - - MyPage.java: - - - - - - - - - - - - - - - - - - - - - - - - - - package com.example; import wicket.markup.html.WebPage; import wicket.markup.html.basic.Label; public class MyPage extends WebPage { public MyPage() { this("empty"); } public MyPage(String title) { add(new Label("title",title)); } } - - - - - - - - - - - - - - - - - - - - - - - - - - and finally, MyPageTest.java: - - - - - - - - - - - - - - - - - - - - - - - - - - package com.example; import junit.framework.TestCase; import wicket.Page; import wicket.util.tester.ITestPageSource; import wicket.util.tester.WicketTester; public class MyPageTest extends TestCase { public void testRenderMyPage() { WicketTester tester = new WicketTester(); // the following statement throws the exception: tester.startPage(new ITestPageSource() { public Page getTestPage() { return new MyPage("hello world"); } }); } } - - - - - - - - - - - - - - - - - - - - - - - - - - What's happening here? Most of my pages use custom constructors to initialize the page, and every test method that use these cause the error. What can I do about it? cheers, Gert -- Gert Jan Verhoog Func. Internet Integration W http://www.func.nl T +31 30 2109750 F +31 30 2109751 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester broken on 1.2?
fixed it by creating a new cycle right before the page is created with newPage()On 6/8/06, Michael Day <[EMAIL PROTECTED] > wrote:I've tried that. It doesn't fix the problem. Also most tests inwicket core don't do that... Anyway, here is the code with that method: public class IndexedParamTest extends TestCase { public IndexedParamTest(String name) { super(name); } public void testPage() throws Exception { WicketTester app = new WicketTester(); // app.getMarkupSettings().setAutomaticLinking(true); // app.getMarkupSettings().setStripWicketTags(true); app.setHomePage(Page1.class); app.mountBookmarkablePage("/page1", Page1.class); // app.mount("/page1", new IndexedParamUrlCodingStrategy("/page1", Page1.class)); app.setupRequestAndResponse(); app.createRequestCycle(); app.startPage(Page1.class); // app.assertRenderedPage(Page1.class); // System.out.println(app.getPreviousRenderedPage().getResponse().getOutputStream().toString()); //app.setParameterForNextRequest("0", "param0"); } public static class Page1 extends WebPage { public Page1() { } }}On Jun 8, 2006, at 3:36 AM, Johan Compagner wrote:> you still need to create a request cycle: >> public WebRequestCycle createRequestCycle()>> right after you create the response/requests objects.>> j>> On 6/8/06, Michael Day < [EMAIL PROTECTED]> wrote: I had> created a bug report for it with a code sample, but I'll paste> another sample here:>> public class IndexedParamTest extends TestCase {> public IndexedParamTest(String name) { > super(name);> }>> public void testPage() throws Exception {> WicketTester app = new WicketTester();> app.setHomePage(Page1.class);> app.mountBookmarkablePage("/page1", Page1.class );> app.setupRequestAndResponse();> app.startPage(Page1.class);> }>> public static class Page1 extends WebPage { > public Page1() {> }> }> }>>> And here is the error:>> 2006-06-08 00:29:39,278 [main] INFO wicket.Application - You are in> DEVELOPMENT mode >> wicket.WicketRuntimeException: Can not set the attribute. No> RequestCycle available> at wicket.Session.setAttribute(Session.java:918)> at wicket.Session.newPageMap(Session.java :590)> at wicket.Session.pageMapForName(Session.java:466)> at wicket.PageMap.forName(PageMap.java:166)> at wicket.Page.init(Page.java:1158)> at wicket.Page.( Page.java:194)> at wicket.markup.html.WebPage.(WebPage.java:122)> at IndexedParamTest$Page1.(IndexedParamTest.java :41)> at sun.reflect.NativeConstructorAccessorImpl.newInstance0 > (Native> Method)> at sun.reflect.NativeConstructorAccessorImpl.newInstance> (NativeConstructorAccessorImpl.java:39)> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance > (DelegatingConstructorAccessorImpl.java:27)> at java.lang.reflect.Constructor.newInstance> (Constructor.java:274)> at java.lang.Class.newInstance0(Class.java:308)> at java.lang.Class.newInstance (Class.java:261)> at wicket.session.DefaultPageFactory.newPage> (DefaultPageFactory.java:> 58)> at> wicket.protocol.http.MockWebApplication.generateLastRenderedPage > (MockWebApplication.java:372)> at wicket.protocol.http.MockWebApplication.processRequestCycle> (MockWebApplication.java:327)> at wicket.protocol.http.MockWebApplication.processRequestCycle > (MockWebApplication.java:305)> at wicket.util.tester.WicketTester.startPage> (WicketTester.java:267)> at IndexedParamTest.testPage(IndexedParamTest.java:34)> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)> at sun.reflect.NativeMethodAccessorImpl.invoke> (NativeMethodAccessorImpl.java:39)> at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:25)> at com.intellij.rt.execution.junit2.JUnitStarter.main> (JUnitStarter.java :32)>>> On Jun 6, 2006, at 3:51 AM, Juergen Donnerstag wrote: >> > This thread has started with Michiel Trempe providing some pieces of> > code which don't work One piece was a subclass of Application which> > looked like> >> > public void init() > >{> >configure(DEVELOPMENT);> >}> >> > and that doesn't work. You need to call Application.init().> > Your problem obviously is a different one except that you get a > > similar error message. I don't know what is wrong with your code,> but> > I haven't seen it yet.> >> > Juergen> >> > On 6/6/06, Michael Day < [EMAIL PROTECTED] > wrote:> >> Hrm? I'm not extending WicketTester -- I'm extending TestCase. It> >> doesn't have an init() method. I tried adding app.configure> >> ("development"), but it didn't fix the issue. > >>> >> On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote:> >>> >>> You need to ch
Re: [Wicket-user] WicketTester broken on 1.2?
ahh the problem is that your HomePage is not directly rendered because you mount the homepagethen this code is encountered: BookmarkablePageRequestTarget homepageTarget = new BookmarkablePageRequestTarget( homePageClass, parameters); IRequestCodingStrategy requestCodingStrategy = requestCycle.getProcessor() .getRequestCodingStrategy(); CharSequence path = requestCodingStrategy.pathForTarget(homepageTarget); if (path != null) { // The home page was mounted at the given path. // Issue a redirect to that path requestCycle.setRedirect(true); }so a redirect is triggered. On 6/8/06, Michael Day < [EMAIL PROTECTED]> wrote:I've tried that. It doesn't fix the problem. Also most tests in wicket core don't do that... Anyway, here is the code with that method:public class IndexedParamTest extends TestCase { public IndexedParamTest(String name) { super(name); } public void testPage() throws Exception { WicketTester app = new WicketTester(); // app.getMarkupSettings().setAutomaticLinking(true); // app.getMarkupSettings().setStripWicketTags(true); app.setHomePage(Page1.class); app.mountBookmarkablePage("/page1", Page1.class); // app.mount("/page1", new IndexedParamUrlCodingStrategy("/page1", Page1.class)); app.setupRequestAndResponse(); app.createRequestCycle(); app.startPage(Page1.class); // app.assertRenderedPage(Page1.class); // System.out.println (app.getPreviousRenderedPage().getResponse().getOutputStream().toString()); //app.setParameterForNextRequest("0", "param0"); } public static class Page1 extends WebPage { public Page1() { } }}On Jun 8, 2006, at 3:36 AM, Johan Compagner wrote:> you still need to create a request cycle:>> public WebRequestCycle createRequestCycle() >> right after you create the response/requests objects.>> j>> On 6/8/06, Michael Day <[EMAIL PROTECTED]> wrote: I had > created a bug report for it with a code sample, but I'll paste> another sample here:>> public class IndexedParamTest extends TestCase {> public IndexedParamTest(String name) { > super(name);> }>> public void testPage() throws Exception {> WicketTester app = new WicketTester();> app.setHomePage(Page1.class);> app.mountBookmarkablePage("/page1", Page1.class );> app.setupRequestAndResponse();> app.startPage(Page1.class);> }>> public static class Page1 extends WebPage { > public Page1() {> }> }> }>>> And here is the error:>> 2006-06-08 00:29:39,278 [main] INFO wicket.Application - You are in> DEVELOPMENT mode >> wicket.WicketRuntimeException: Can not set the attribute. No> RequestCycle available> at wicket.Session.setAttribute(Session.java:918)> at wicket.Session.newPageMap(Session.java :590)> at wicket.Session.pageMapForName(Session.java:466)> at wicket.PageMap.forName(PageMap.java:166)> at wicket.Page.init(Page.java:1158)> at wicket.Page.( Page.java:194)> at wicket.markup.html.WebPage.(WebPage.java:122)> at IndexedParamTest$Page1.(IndexedParamTest.java :41)> at sun.reflect.NativeConstructorAccessorImpl.newInstance0 > (Native> Method)> at sun.reflect.NativeConstructorAccessorImpl.newInstance> (NativeConstructorAccessorImpl.java:39)> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance > (DelegatingConstructorAccessorImpl.java:27)> at java.lang.reflect.Constructor.newInstance> (Constructor.java:274)> at java.lang.Class.newInstance0(Class.java:308)> at java.lang.Class.newInstance (Class.java:261)> at wicket.session.DefaultPageFactory.newPage> (DefaultPageFactory.java:> 58)> at> wicket.protocol.http.MockWebApplication.generateLastRenderedPage > (MockWebApplication.java:372)> at wicket.protocol.http.MockWebApplication.processRequestCycle> (MockWebApplication.java:327)> at wicket.protocol.http.MockWebApplication.processRequestCycle > (MockWebApplication.java:305)> at wicket.util.tester.WicketTester.startPage> (WicketTester.java:267)> at IndexedParamTest.testPage(IndexedParamTest.java:34)> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)> at sun.reflect.NativeMethodAccessorImpl.invoke> (NativeMethodAccessorImpl.java:39)> at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:25)> at com.intellij.rt.execution.junit2.JUnitStarter.main> (JUnitStarter.java :32)>>> On Jun 6, 2006, at 3:51 AM, Juergen Donnerstag wrote: >> > This thread has started with Michiel Trempe providing some pieces of> > code which don't work One piece was a subclass of Application which> > looked like> >> > public void init()
Re: [Wicket-user] WicketTester broken on 1.2?
I've tried that. It doesn't fix the problem. Also most tests in wicket core don't do that... Anyway, here is the code with that method: public class IndexedParamTest extends TestCase { public IndexedParamTest(String name) { super(name); } public void testPage() throws Exception { WicketTester app = new WicketTester(); // app.getMarkupSettings().setAutomaticLinking(true); // app.getMarkupSettings().setStripWicketTags(true); app.setHomePage(Page1.class); app.mountBookmarkablePage("/page1", Page1.class); // app.mount("/page1", new IndexedParamUrlCodingStrategy("/ page1", Page1.class)); app.setupRequestAndResponse(); app.createRequestCycle(); app.startPage(Page1.class); // app.assertRenderedPage(Page1.class); // System.out.println(app.getPreviousRenderedPage ().getResponse().getOutputStream().toString()); //app.setParameterForNextRequest("0", "param0"); } public static class Page1 extends WebPage { public Page1() { } } } On Jun 8, 2006, at 3:36 AM, Johan Compagner wrote: > you still need to create a request cycle: > > public WebRequestCycle createRequestCycle() > > right after you create the response/requests objects. > > j > > On 6/8/06, Michael Day <[EMAIL PROTECTED]> wrote: I had > created a bug report for it with a code sample, but I'll paste > another sample here: > > public class IndexedParamTest extends TestCase { > public IndexedParamTest(String name) { > super(name); > } > > public void testPage() throws Exception { > WicketTester app = new WicketTester(); > app.setHomePage(Page1.class); > app.mountBookmarkablePage("/page1", Page1.class ); > app.setupRequestAndResponse(); > app.startPage(Page1.class); > } > > public static class Page1 extends WebPage { > public Page1() { > } > } > } > > > And here is the error: > > 2006-06-08 00:29:39,278 [main] INFO wicket.Application - You are in > DEVELOPMENT mode > > wicket.WicketRuntimeException: Can not set the attribute. No > RequestCycle available > at wicket.Session.setAttribute(Session.java:918) > at wicket.Session.newPageMap(Session.java:590) > at wicket.Session.pageMapForName(Session.java:466) > at wicket.PageMap.forName(PageMap.java:166) > at wicket.Page.init(Page.java:1158) > at wicket.Page.(Page.java:194) > at wicket.markup.html.WebPage.(WebPage.java:122) > at IndexedParamTest$Page1.(IndexedParamTest.java :41) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0 > (Native > Method) > at sun.reflect.NativeConstructorAccessorImpl.newInstance > (NativeConstructorAccessorImpl.java:39) > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance > (DelegatingConstructorAccessorImpl.java:27) > at java.lang.reflect.Constructor.newInstance > (Constructor.java:274) > at java.lang.Class.newInstance0(Class.java:308) > at java.lang.Class.newInstance (Class.java:261) > at wicket.session.DefaultPageFactory.newPage > (DefaultPageFactory.java: > 58) > at > wicket.protocol.http.MockWebApplication.generateLastRenderedPage > (MockWebApplication.java:372) > at wicket.protocol.http.MockWebApplication.processRequestCycle > (MockWebApplication.java:327) > at wicket.protocol.http.MockWebApplication.processRequestCycle > (MockWebApplication.java:305) > at wicket.util.tester.WicketTester.startPage > (WicketTester.java:267) > at IndexedParamTest.testPage(IndexedParamTest.java:34) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke > (NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:25) > at com.intellij.rt.execution.junit2.JUnitStarter.main > (JUnitStarter.java :32) > > > On Jun 6, 2006, at 3:51 AM, Juergen Donnerstag wrote: > > > This thread has started with Michiel Trempe providing some pieces of > > code which don't work One piece was a subclass of Application which > > looked like > > > > public void init() > >{ > >configure(DEVELOPMENT); > >} > > > > and that doesn't work. You need to call Application.init(). > > Your problem obviously is a different one except that you get a > > similar error message. I don't know what is wrong with your code, > but > > I haven't seen it yet. > > > > Juergen > > > > On 6/6/06, Michael Day <[EMAIL PROTECTED] > wrote: > >> Hrm? I'm not extending WicketTester -- I'm extending TestCase. It > >> doesn't have an init() method. I tried adding app.configure > >> ("development"), but it didn't fix the issue. > >> > >> On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote: > >> > >>> You need t
Re: [Wicket-user] WicketTester broken on 1.2?
you still need to create a request cycle:public WebRequestCycle createRequestCycle()right after you create the response/requests objects.jOn 6/8/06, Michael Day <[EMAIL PROTECTED]> wrote: I had created a bug report for it with a code sample, but I'll pasteanother sample here:public class IndexedParamTest extends TestCase { public IndexedParamTest(String name) { super(name); } public void testPage() throws Exception { WicketTester app = new WicketTester(); app.setHomePage(Page1.class); app.mountBookmarkablePage("/page1", Page1.class ); app.setupRequestAndResponse(); app.startPage(Page1.class); } public static class Page1 extends WebPage { public Page1() { } }} And here is the error:2006-06-08 00:29:39,278 [main] INFO wicket.Application - You are inDEVELOPMENT modewicket.WicketRuntimeException: Can not set the attribute. NoRequestCycle availableat wicket.Session.setAttribute(Session.java:918)at wicket.Session.newPageMap(Session.java:590)at wicket.Session.pageMapForName(Session.java:466)at wicket.PageMap.forName(PageMap.java:166) at wicket.Page.init(Page.java:1158)at wicket.Page.(Page.java:194)at wicket.markup.html.WebPage.(WebPage.java:122)at IndexedParamTest$Page1.(IndexedParamTest.java :41)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27)at java.lang.reflect.Constructor.newInstance(Constructor.java:274)at java.lang.Class.newInstance0(Class.java:308)at java.lang.Class.newInstance (Class.java:261)at wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:58)at wicket.protocol.http.MockWebApplication.generateLastRenderedPage(MockWebApplication.java:372)at wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:327)at wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:305)at wicket.util.tester.WicketTester.startPage (WicketTester.java:267)at IndexedParamTest.testPage(IndexedParamTest.java:34)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java :32)On Jun 6, 2006, at 3:51 AM, Juergen Donnerstag wrote:> This thread has started with Michiel Trempe providing some pieces of> code which don't work One piece was a subclass of Application which > looked like>> public void init()>{>configure(DEVELOPMENT);>}>> and that doesn't work. You need to call Application.init().> Your problem obviously is a different one except that you get a > similar error message. I don't know what is wrong with your code, but> I haven't seen it yet.>> Juergen>> On 6/6/06, Michael Day <[EMAIL PROTECTED] > wrote:>> Hrm? I'm not extending WicketTester -- I'm extending TestCase. It>> doesn't have an init() method. I tried adding app.configure>> ("development"), but it didn't fix the issue. On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote:> You need to change init to call the super implementation>> public void init() >>> {>>> super.init();>>> configure(DEVELOPMENT);>>> }>> Juergen>> On 5/31/06, Michael Day < [EMAIL PROTECTED]> wrote: I just noticed this thread after posting a bug report: http://sourceforge.net/tracker/index.php? func=detail&aid=1497866&group_id=119783&atid=684975 I assume it is related since the exception is the same. Michael Day On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote:> Test case wicket.util.tester.WicketTesterTest#testPageConstructor > has:>> MyMockApplication tester = new MyMockApplication();> Book mockBook = new Book("xxId", "xxName"); > Page page = new ViewBook(mockBook);> tester.startPage(page);>> // assertion> tester.assertRenderedPage(ViewBook.class);> tester.clickLink("link");> tester.assertRenderedPage(CreateBook.class);> > and that seems to work... not sure why that wouldn't work for you?>> Eelco>>> On 5/30/06, Michiel Trimpe < [EMAIL PROTECTED]> wrote:>> Hey everyone, I just finished creating tests in rc2, but after upgrading to>> wicket>> 1.2-final the tests now fail.
Re: [Wicket-user] WicketTester broken on 1.2?
I had created a bug report for it with a code sample, but I'll paste another sample here: public class IndexedParamTest extends TestCase { public IndexedParamTest(String name) { super(name); } public void testPage() throws Exception { WicketTester app = new WicketTester(); app.setHomePage(Page1.class); app.mountBookmarkablePage("/page1", Page1.class); app.setupRequestAndResponse(); app.startPage(Page1.class); } public static class Page1 extends WebPage { public Page1() { } } } And here is the error: 2006-06-08 00:29:39,278 [main] INFO wicket.Application - You are in DEVELOPMENT mode wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle available at wicket.Session.setAttribute(Session.java:918) at wicket.Session.newPageMap(Session.java:590) at wicket.Session.pageMapForName(Session.java:466) at wicket.PageMap.forName(PageMap.java:166) at wicket.Page.init(Page.java:1158) at wicket.Page.(Page.java:194) at wicket.markup.html.WebPage.(WebPage.java:122) at IndexedParamTest$Page1.(IndexedParamTest.java:41) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:308) at java.lang.Class.newInstance(Class.java:261) at wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java: 58) at wicket.protocol.http.MockWebApplication.generateLastRenderedPage (MockWebApplication.java:372) at wicket.protocol.http.MockWebApplication.processRequestCycle (MockWebApplication.java:327) at wicket.protocol.http.MockWebApplication.processRequestCycle (MockWebApplication.java:305) at wicket.util.tester.WicketTester.startPage(WicketTester.java:267) at IndexedParamTest.testPage(IndexedParamTest.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main (JUnitStarter.java:32) On Jun 6, 2006, at 3:51 AM, Juergen Donnerstag wrote: > This thread has started with Michiel Trempe providing some pieces of > code which don't work One piece was a subclass of Application which > looked like > > public void init() >{ >configure(DEVELOPMENT); >} > > and that doesn't work. You need to call Application.init(). > Your problem obviously is a different one except that you get a > similar error message. I don't know what is wrong with your code, but > I haven't seen it yet. > > Juergen > > On 6/6/06, Michael Day <[EMAIL PROTECTED]> wrote: >> Hrm? I'm not extending WicketTester -- I'm extending TestCase. It >> doesn't have an init() method. I tried adding app.configure >> ("development"), but it didn't fix the issue. >> >> On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote: >> >>> You need to change init to call the super implementation >>> >>> public void init() >>> { >>> super.init(); >>> configure(DEVELOPMENT); >>> } >>> >>> Juergen >>> >>> On 5/31/06, Michael Day <[EMAIL PROTECTED]> wrote: I just noticed this thread after posting a bug report: http://sourceforge.net/tracker/index.php? func=detail&aid=1497866&group_id=119783&atid=684975 I assume it is related since the exception is the same. Michael Day On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: > Test case wicket.util.tester.WicketTesterTest#testPageConstructor > has: > > MyMockApplication tester = new MyMockApplication(); > Book mockBook = new Book("xxId", "xxName"); > Page page = new ViewBook(mockBook); > tester.startPage(page); > > // assertion > tester.assertRenderedPage(ViewBook.class); > tester.clickLink("link"); > tester.assertRenderedPage(CreateBook.class); > > and that seems to work... not sure why that wouldn't work for you? > > Eelco > > > On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: >> >> >> >> >> Hey everyone, >> >> >> >> I just finished creating tests in rc2, but after upgrading to >> wicket >> 1.2-final the tests now fail. >> >> >> >> AppTester.java >> >> public class A
Re: [Wicket-user] WicketTester broken on 1.2?
As I mentioned in the previous mail. You need to call public void init() { super.init(); configure(DEVELOPMENT); } I've created test case based on your code and it works. Juergen On 6/6/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: > Just did some testing further digging into the issue and it don't really > understand why it would work in the rest of Wicket, unless you test the > classes by startPage(Class) instead of startPage(Page). > > What the problem is, is that the tester tries to add the generated Page > to the session after processing the request, BUT the session uses the > RequestCycle in ThreadLocal, which is cleared when processing a request. > See: > WebRequestCycle(RequestCycle).threadDetach() line: 1079 > WebRequestCycle(RequestCycle).detach() line: 836 > WebRequestCycle(RequestCycle).steps() line: 1052 > WebRequestCycle(RequestCycle).request(IRequestTarget) line: 499 > WebRequestCycle(RequestCycle).request(Component) line: 477 > ConnectivityTester(MockWebApplication).processRequestCycle(Component) > line: 291 > > Anyone up for a quick fix? Please?? > > Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 > (0)6 41482341mobile > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Michael > Day > Sent: Tuesday, June 06, 2006 6:42 AM > To: wicket-user@lists.sourceforge.net > Subject: Re: [Wicket-user] WicketTester broken on 1.2? > > Hrm? I'm not extending WicketTester -- I'm extending TestCase. It > doesn't have an init() method. I tried adding app.configure > ("development"), but it didn't fix the issue. > > On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote: > > > You need to change init to call the super implementation > > > > public void init() > > { > > super.init(); > > configure(DEVELOPMENT); > > } > > > > Juergen > > > > On 5/31/06, Michael Day <[EMAIL PROTECTED]> wrote: > >> I just noticed this thread after posting a bug report: > >> > >> http://sourceforge.net/tracker/index.php? > >> func=detail&aid=1497866&group_id=119783&atid=684975 > >> > >> I assume it is related since the exception is the same. > >> > >> Michael Day > >> > >> On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: > >> > >>> Test case wicket.util.tester.WicketTesterTest#testPageConstructor > >>> has: > >>> > >>> MyMockApplication tester = new MyMockApplication(); > >>> Book mockBook = new Book("xxId", "xxName"); > >>> Page page = new ViewBook(mockBook); > >>> tester.startPage(page); > >>> > >>> // assertion > >>> tester.assertRenderedPage(ViewBook.class); > >>> tester.clickLink("link"); > >>> tester.assertRenderedPage(CreateBook.class); > >>> > >>> and that seems to work... not sure why that wouldn't work for you? > >>> > >>> Eelco > >>> > >>> > >>> On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: > >>>> > >>>> > >>>> > >>>> > >>>> Hey everyone, > >>>> > >>>> > >>>> > >>>> I just finished creating tests in rc2, but after upgrading to > >>>> wicket > >>>> 1.2-final the tests now fail. > >>>> > >>>> > >>>> > >>>>>>>>>>>> AppTester.java >>>>>>>> > >>>> > >>>> public class AppTester extends WicketTester { > >>>> > >>>> public AppTester() { > >>>> > >>>> super("/admin"); > >>>> > >>>> } > >>>> > >>>> public void init() { > >>>> > >>>> configure(DEVELOPMENT); > >>>> > >>>> } > >>>> > >>>> @Override > >>>> > >>>> public Class getHomePage() { > >>>> > >>>> return ListPage.class; > >>>> > >>>> } > >>>> > >>>> } > >>>> > >>>>>>>>> TestList.java >>
Re: [Wicket-user] WicketTester broken on 1.2?
This thread has started with Michiel Trempe providing some pieces of code which don't work One piece was a subclass of Application which looked like public void init() { configure(DEVELOPMENT); } and that doesn't work. You need to call Application.init(). Your problem obviously is a different one except that you get a similar error message. I don't know what is wrong with your code, but I haven't seen it yet. Juergen On 6/6/06, Michael Day <[EMAIL PROTECTED]> wrote: > Hrm? I'm not extending WicketTester -- I'm extending TestCase. It > doesn't have an init() method. I tried adding app.configure > ("development"), but it didn't fix the issue. > > On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote: > > > You need to change init to call the super implementation > > > > public void init() > > { > > super.init(); > > configure(DEVELOPMENT); > > } > > > > Juergen > > > > On 5/31/06, Michael Day <[EMAIL PROTECTED]> wrote: > >> I just noticed this thread after posting a bug report: > >> > >> http://sourceforge.net/tracker/index.php? > >> func=detail&aid=1497866&group_id=119783&atid=684975 > >> > >> I assume it is related since the exception is the same. > >> > >> Michael Day > >> > >> On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: > >> > >>> Test case wicket.util.tester.WicketTesterTest#testPageConstructor > >>> has: > >>> > >>> MyMockApplication tester = new MyMockApplication(); > >>> Book mockBook = new Book("xxId", "xxName"); > >>> Page page = new ViewBook(mockBook); > >>> tester.startPage(page); > >>> > >>> // assertion > >>> tester.assertRenderedPage(ViewBook.class); > >>> tester.clickLink("link"); > >>> tester.assertRenderedPage(CreateBook.class); > >>> > >>> and that seems to work... not sure why that wouldn't work for you? > >>> > >>> Eelco > >>> > >>> > >>> On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: > > > > > Hey everyone, > > > > I just finished creating tests in rc2, but after upgrading to > wicket > 1.2-final the tests now fail. > > > > AppTester.java > > public class AppTester extends WicketTester { > > public AppTester() { > > super("/admin"); > > } > > public void init() { > > configure(DEVELOPMENT); > > } > > @Override > > public Class getHomePage() { > > return ListPage.class; > > } > > } > > > TestList.java >>> > tester = new AppTester(); > > tester.startPage(new ListPage()); > > > > And this returns the error: > > wicket.WicketRuntimeException: Can not set the attribute. No > RequestCycle > available > > at wicket.Session.setAttribute(Session.java:918) > > at wicket.PageMap.put(PageMap.java:519) > > at wicket.Session.touch(Session.java:720) > > at > wicket.util.tester.WicketTester.startPage(WicketTester.java:248) > > > > > > Is this because the tester is broken, or am I doing something > wrong? > > > > - michiel > > > > > > Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] > | +31 > (0)6 41482341mobile > > > > > > This e-mail message contains information which is confidential > and may be > privileged. It is intended for use by the addressee only. If you > are not the > intended addressee, we request that you notify the sender > immediately and > delete or destroy this e-mail message and any attachment(s), > without > copying, saving, forwarding, disclosing or using its contents in > any other > way. TomTom N.V., TomTom International BV or any other company > belonging to > the TomTom group of companies will not be liable for damage > relating to the > communication by e-mail of data, documents or any other > information. > > > >>> > >>> > >>> --- > >>> All the advantages of Linux Managed Hosting--Without the Cost and > >>> Risk! > >>> Fully trained technicians. The highest number of Red Hat > >>> certifications in > >>> the hosting industry. Fanatical Support. Click to learn more > >>> http://sel.as-us.falkag.net/sel? > >>> cmd=lnk&kid=107521&bid=248729&dat=121642 > >>> ___ > >>> Wicket-user mailing list > >>> Wicket-user@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/wicket-user > >>> > >>> > >> > >> > >> > >>
Re: [Wicket-user] WicketTester broken on 1.2?
Just did some testing further digging into the issue and it don't really understand why it would work in the rest of Wicket, unless you test the classes by startPage(Class) instead of startPage(Page). What the problem is, is that the tester tries to add the generated Page to the session after processing the request, BUT the session uses the RequestCycle in ThreadLocal, which is cleared when processing a request. See: WebRequestCycle(RequestCycle).threadDetach() line: 1079 WebRequestCycle(RequestCycle).detach() line: 836 WebRequestCycle(RequestCycle).steps() line: 1052 WebRequestCycle(RequestCycle).request(IRequestTarget) line: 499 WebRequestCycle(RequestCycle).request(Component) line: 477 ConnectivityTester(MockWebApplication).processRequestCycle(Component) line: 291 Anyone up for a quick fix? Please?? Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 (0)6 41482341mobile -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Day Sent: Tuesday, June 06, 2006 6:42 AM To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] WicketTester broken on 1.2? Hrm? I'm not extending WicketTester -- I'm extending TestCase. It doesn't have an init() method. I tried adding app.configure ("development"), but it didn't fix the issue. On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote: > You need to change init to call the super implementation > > public void init() > { > super.init(); > configure(DEVELOPMENT); > } > > Juergen > > On 5/31/06, Michael Day <[EMAIL PROTECTED]> wrote: >> I just noticed this thread after posting a bug report: >> >> http://sourceforge.net/tracker/index.php? >> func=detail&aid=1497866&group_id=119783&atid=684975 >> >> I assume it is related since the exception is the same. >> >> Michael Day >> >> On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: >> >>> Test case wicket.util.tester.WicketTesterTest#testPageConstructor >>> has: >>> >>> MyMockApplication tester = new MyMockApplication(); >>> Book mockBook = new Book("xxId", "xxName"); >>> Page page = new ViewBook(mockBook); >>> tester.startPage(page); >>> >>> // assertion >>> tester.assertRenderedPage(ViewBook.class); >>> tester.clickLink("link"); >>> tester.assertRenderedPage(CreateBook.class); >>> >>> and that seems to work... not sure why that wouldn't work for you? >>> >>> Eelco >>> >>> >>> On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: >>>> >>>> >>>> >>>> >>>> Hey everyone, >>>> >>>> >>>> >>>> I just finished creating tests in rc2, but after upgrading to >>>> wicket >>>> 1.2-final the tests now fail. >>>> >>>> >>>> >>>>>>>>>>>> AppTester.java >>>>>>>> >>>> >>>> public class AppTester extends WicketTester { >>>> >>>> public AppTester() { >>>> >>>> super("/admin"); >>>> >>>> } >>>> >>>> public void init() { >>>> >>>> configure(DEVELOPMENT); >>>> >>>> } >>>> >>>> @Override >>>> >>>> public Class getHomePage() { >>>> >>>> return ListPage.class; >>>> >>>> } >>>> >>>> } >>>> >>>>>>>>> TestList.java >>>>>>> >>>> tester = new AppTester(); >>>> >>>> tester.startPage(new ListPage()); >>>> >>>> >>>> >>>> And this returns the error: >>>> >>>> wicket.WicketRuntimeException: Can not set the attribute. No >>>> RequestCycle >>>> available >>>> >>>> at wicket.Session.setAttribute(Session.java:918) >>>> >>>> at wicket.PageMap.put(PageMap.java:519) >>>> >>>> at wicket.Session.touch(Session.java:720) >>>> >>>> at >>>> wicket.util.tester.WicketTester.startPage(WicketTester.java:248) >>>> >>>> >>>> >>>> >>>&
Re: [Wicket-user] WicketTester broken on 1.2?
Hrm? I'm not extending WicketTester -- I'm extending TestCase. It doesn't have an init() method. I tried adding app.configure ("development"), but it didn't fix the issue. On Jun 4, 2006, at 4:33 AM, Juergen Donnerstag wrote: > You need to change init to call the super implementation > > public void init() > { > super.init(); > configure(DEVELOPMENT); > } > > Juergen > > On 5/31/06, Michael Day <[EMAIL PROTECTED]> wrote: >> I just noticed this thread after posting a bug report: >> >> http://sourceforge.net/tracker/index.php? >> func=detail&aid=1497866&group_id=119783&atid=684975 >> >> I assume it is related since the exception is the same. >> >> Michael Day >> >> On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: >> >>> Test case wicket.util.tester.WicketTesterTest#testPageConstructor >>> has: >>> >>> MyMockApplication tester = new MyMockApplication(); >>> Book mockBook = new Book("xxId", "xxName"); >>> Page page = new ViewBook(mockBook); >>> tester.startPage(page); >>> >>> // assertion >>> tester.assertRenderedPage(ViewBook.class); >>> tester.clickLink("link"); >>> tester.assertRenderedPage(CreateBook.class); >>> >>> and that seems to work... not sure why that wouldn't work for you? >>> >>> Eelco >>> >>> >>> On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: Hey everyone, I just finished creating tests in rc2, but after upgrading to wicket 1.2-final the tests now fail. AppTester.java public class AppTester extends WicketTester { public AppTester() { super("/admin"); } public void init() { configure(DEVELOPMENT); } @Override public Class getHomePage() { return ListPage.class; } } > TestList.java >>> tester = new AppTester(); tester.startPage(new ListPage()); And this returns the error: wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle available at wicket.Session.setAttribute(Session.java:918) at wicket.PageMap.put(PageMap.java:519) at wicket.Session.touch(Session.java:720) at wicket.util.tester.WicketTester.startPage(WicketTester.java:248) Is this because the tester is broken, or am I doing something wrong? - michiel Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 (0)6 41482341mobile This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom International BV or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information. >>> >>> >>> --- >>> All the advantages of Linux Managed Hosting--Without the Cost and >>> Risk! >>> Fully trained technicians. The highest number of Red Hat >>> certifications in >>> the hosting industry. Fanatical Support. Click to learn more >>> http://sel.as-us.falkag.net/sel? >>> cmd=lnk&kid=107521&bid=248729&dat=121642 >>> ___ >>> Wicket-user mailing list >>> Wicket-user@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/wicket-user >>> >>> >> >> >> >> --- >> All the advantages of Linux Managed Hosting--Without the Cost and >> Risk! >> Fully trained technicians. The highest number of Red Hat >> certifications in >> the hosting industry. Fanatical Support. Click to learn more >> http://sel.as-us.falkag.net/sel? >> cmd=lnk&kid=107521&bid=248729&dat=121642 >> ___ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > ___ Wicket-user mailing list Wicket-user@lists.sourceforge.n
Re: [Wicket-user] WicketTester broken on 1.2?
You need to change init to call the super implementation public void init() { super.init(); configure(DEVELOPMENT); } Juergen On 5/31/06, Michael Day <[EMAIL PROTECTED]> wrote: > I just noticed this thread after posting a bug report: > > http://sourceforge.net/tracker/index.php? > func=detail&aid=1497866&group_id=119783&atid=684975 > > I assume it is related since the exception is the same. > > Michael Day > > On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: > > > Test case wicket.util.tester.WicketTesterTest#testPageConstructor has: > > > > MyMockApplication tester = new MyMockApplication(); > > Book mockBook = new Book("xxId", "xxName"); > > Page page = new ViewBook(mockBook); > > tester.startPage(page); > > > > // assertion > > tester.assertRenderedPage(ViewBook.class); > > tester.clickLink("link"); > > tester.assertRenderedPage(CreateBook.class); > > > > and that seems to work... not sure why that wouldn't work for you? > > > > Eelco > > > > > > On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: > >> > >> > >> > >> > >> Hey everyone, > >> > >> > >> > >> I just finished creating tests in rc2, but after upgrading to wicket > >> 1.2-final the tests now fail. > >> > >> > >> > >> AppTester.java > >> > >> public class AppTester extends WicketTester { > >> > >> public AppTester() { > >> > >> super("/admin"); > >> > >> } > >> > >> public void init() { > >> > >> configure(DEVELOPMENT); > >> > >> } > >> > >> @Override > >> > >> public Class getHomePage() { > >> > >> return ListPage.class; > >> > >> } > >> > >> } > >> > >> >TestList.java >>> > >> tester = new AppTester(); > >> > >> tester.startPage(new ListPage()); > >> > >> > >> > >> And this returns the error: > >> > >> wicket.WicketRuntimeException: Can not set the attribute. No > >> RequestCycle > >> available > >> > >> at wicket.Session.setAttribute(Session.java:918) > >> > >> at wicket.PageMap.put(PageMap.java:519) > >> > >> at wicket.Session.touch(Session.java:720) > >> > >> at > >> wicket.util.tester.WicketTester.startPage(WicketTester.java:248) > >> > >> > >> > >> > >> > >> Is this because the tester is broken, or am I doing something wrong? > >> > >> > >> > >> - michiel > >> > >> > >> > >> > >> > >> Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] > >> | +31 > >> (0)6 41482341mobile > >> > >> > >> > >> > >> > >> This e-mail message contains information which is confidential > >> and may be > >> privileged. It is intended for use by the addressee only. If you > >> are not the > >> intended addressee, we request that you notify the sender > >> immediately and > >> delete or destroy this e-mail message and any attachment(s), without > >> copying, saving, forwarding, disclosing or using its contents in > >> any other > >> way. TomTom N.V., TomTom International BV or any other company > >> belonging to > >> the TomTom group of companies will not be liable for damage > >> relating to the > >> communication by e-mail of data, documents or any other information. > >> > >> > > > > > > --- > > All the advantages of Linux Managed Hosting--Without the Cost and > > Risk! > > Fully trained technicians. The highest number of Red Hat > > certifications in > > the hosting industry. Fanatical Support. Click to learn more > > http://sel.as-us.falkag.net/sel? > > cmd=lnk&kid=107521&bid=248729&dat=121642 > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > --- > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester broken on 1.2?
I just noticed this thread after posting a bug report: http://sourceforge.net/tracker/index.php? func=detail&aid=1497866&group_id=119783&atid=684975 I assume it is related since the exception is the same. Michael Day On May 30, 2006, at 1:46 PM, Eelco Hillenius wrote: Test case wicket.util.tester.WicketTesterTest#testPageConstructor has: MyMockApplication tester = new MyMockApplication(); Book mockBook = new Book("xxId", "xxName"); Page page = new ViewBook(mockBook); tester.startPage(page); // assertion tester.assertRenderedPage(ViewBook.class); tester.clickLink("link"); tester.assertRenderedPage(CreateBook.class); and that seems to work... not sure why that wouldn't work for you? Eelco On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: Hey everyone, I just finished creating tests in rc2, but after upgrading to wicket 1.2-final the tests now fail. AppTester.java public class AppTester extends WicketTester { public AppTester() { super("/admin"); } public void init() { configure(DEVELOPMENT); } @Override public Class getHomePage() { return ListPage.class; } } >TestList.java >>> tester = new AppTester(); tester.startPage(new ListPage()); And this returns the error: wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle available at wicket.Session.setAttribute(Session.java:918) at wicket.PageMap.put(PageMap.java:519) at wicket.Session.touch(Session.java:720) at wicket.util.tester.WicketTester.startPage(WicketTester.java:248) Is this because the tester is broken, or am I doing something wrong? - michiel Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 (0)6 41482341mobile This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom International BV or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information. --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel? cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester broken on 1.2?
Test case wicket.util.tester.WicketTesterTest#testPageConstructor has: MyMockApplication tester = new MyMockApplication(); Book mockBook = new Book("xxId", "xxName"); Page page = new ViewBook(mockBook); tester.startPage(page); // assertion tester.assertRenderedPage(ViewBook.class); tester.clickLink("link"); tester.assertRenderedPage(CreateBook.class); and that seems to work... not sure why that wouldn't work for you? Eelco On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: Hey everyone, I just finished creating tests in rc2, but after upgrading to wicket 1.2-final the tests now fail. AppTester.java public class AppTester extends WicketTester { public AppTester() { super("/admin"); } public void init() { configure(DEVELOPMENT); } @Override public Class getHomePage() { return ListPage.class; } } >TestList.java >>> tester = new AppTester(); tester.startPage(new ListPage()); And this returns the error: wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle available at wicket.Session.setAttribute(Session.java:918) at wicket.PageMap.put(PageMap.java:519) at wicket.Session.touch(Session.java:720) at wicket.util.tester.WicketTester.startPage(WicketTester.java:248) Is this because the tester is broken, or am I doing something wrong? - michiel Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 (0)6 41482341mobile This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom International BV or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information. --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester broken on 1.2?
plenty of our unit tests are based on WicketTester and they are still working properly. The change is not with WicketTester but with RequestCycle and the point in time it is available. May I suggest you check out the unit tests (WicketTestCase). Juergen On 5/30/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: MyMockApplication is WicketTester btw ( public class MyMockApplication extends WicketTester { /** * Constructor. */ public MyMockApplication() { } } ) On 5/30/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > Test case wicket.util.tester.WicketTesterTest#testPageConstructor has: > > MyMockApplication tester = new MyMockApplication(); > Book mockBook = new Book("xxId", "xxName"); > Page page = new ViewBook(mockBook); > tester.startPage(page); > > // assertion > tester.assertRenderedPage(ViewBook.class); > tester.clickLink("link"); > tester.assertRenderedPage(CreateBook.class); > > and that seems to work... not sure why that wouldn't work for you? > > Eelco > > > On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Hey everyone, > > > > > > > > I just finished creating tests in rc2, but after upgrading to wicket > > 1.2-final the tests now fail. > > > > > > > > AppTester.java > > > > public class AppTester extends WicketTester { > > > > public AppTester() { > > > > super("/admin"); > > > > } > > > > public void init() { > > > > configure(DEVELOPMENT); > > > > } > > > > @Override > > > > public Class getHomePage() { > > > > return ListPage.class; > > > > } > > > > } > > > > >TestList.java >>> > > tester = new AppTester(); > > > > tester.startPage(new ListPage()); > > > > > > > > And this returns the error: > > > > wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle > > available > > > > at wicket.Session.setAttribute(Session.java:918) > > > > at wicket.PageMap.put(PageMap.java:519) > > > > at wicket.Session.touch(Session.java:720) > > > > at > > wicket.util.tester.WicketTester.startPage(WicketTester.java:248) > > > > > > > > > > > > Is this because the tester is broken, or am I doing something wrong? > > > > > > > > - michiel > > > > > > > > > > > > Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 > > (0)6 41482341mobile > > > > > > > > > > > > This e-mail message contains information which is confidential and may be > > privileged. It is intended for use by the addressee only. If you are not the > > intended addressee, we request that you notify the sender immediately and > > delete or destroy this e-mail message and any attachment(s), without > > copying, saving, forwarding, disclosing or using its contents in any other > > way. TomTom N.V., TomTom International BV or any other company belonging to > > the TomTom group of companies will not be liable for damage relating to the > > communication by e-mail of data, documents or any other information. > > > > > --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester broken on 1.2?
MyMockApplication is WicketTester btw ( public class MyMockApplication extends WicketTester { /** * Constructor. */ public MyMockApplication() { } } ) On 5/30/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: Test case wicket.util.tester.WicketTesterTest#testPageConstructor has: MyMockApplication tester = new MyMockApplication(); Book mockBook = new Book("xxId", "xxName"); Page page = new ViewBook(mockBook); tester.startPage(page); // assertion tester.assertRenderedPage(ViewBook.class); tester.clickLink("link"); tester.assertRenderedPage(CreateBook.class); and that seems to work... not sure why that wouldn't work for you? Eelco On 5/30/06, Michiel Trimpe <[EMAIL PROTECTED]> wrote: > > > > > Hey everyone, > > > > I just finished creating tests in rc2, but after upgrading to wicket > 1.2-final the tests now fail. > > > > AppTester.java > > public class AppTester extends WicketTester { > > public AppTester() { > > super("/admin"); > > } > > public void init() { > > configure(DEVELOPMENT); > > } > > @Override > > public Class getHomePage() { > > return ListPage.class; > > } > > } > > >TestList.java >>> > tester = new AppTester(); > > tester.startPage(new ListPage()); > > > > And this returns the error: > > wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle > available > > at wicket.Session.setAttribute(Session.java:918) > > at wicket.PageMap.put(PageMap.java:519) > > at wicket.Session.touch(Session.java:720) > > at > wicket.util.tester.WicketTester.startPage(WicketTester.java:248) > > > > > > Is this because the tester is broken, or am I doing something wrong? > > > > - michiel > > > > > > Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 > (0)6 41482341mobile > > > > > > This e-mail message contains information which is confidential and may be > privileged. It is intended for use by the addressee only. If you are not the > intended addressee, we request that you notify the sender immediately and > delete or destroy this e-mail message and any attachment(s), without > copying, saving, forwarding, disclosing or using its contents in any other > way. TomTom N.V., TomTom International BV or any other company belonging to > the TomTom group of companies will not be liable for damage relating to the > communication by e-mail of data, documents or any other information. > > --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester broken on 1.2?
Hey everyone, I just finished creating tests in rc2, but after upgrading to wicket 1.2-final the tests now fail. AppTester.java public class AppTester extends WicketTester { public AppTester() { super("/admin"); } public void init() { configure(DEVELOPMENT); } @Override public Class getHomePage() { return ListPage.class; } } >TestList.java >>> tester = new AppTester(); tester.startPage(new ListPage()); And this returns the error: wicket.WicketRuntimeException: Can not set the attribute. No RequestCycle available at wicket.Session.setAttribute(Session.java:918) at wicket.PageMap.put(PageMap.java:519) at wicket.Session.touch(Session.java:720) at wicket.util.tester.WicketTester.startPage(WicketTester.java:248) Is this because the tester is broken, or am I doing something wrong? - michiel Michiel Trimpe| Java Developer| TomTom | [EMAIL PROTECTED] | +31 (0)6 41482341mobile This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom International BV or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information.
Re: [Wicket-user] WicketTester & .properties file
Ingram Chen schreef: You can alter locale in webSession, for example: wicketTester.getWicketSession().setLocale(new Locale("fa_IR")); Thanks, but that wasn't really what i was looking for. I've now subclassed my own WicketTester: MyWicketTester, and i can have my own MyWicketTester.properties file (and any localized versions) to manipulate. This works fine so far. --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester & .properties file
You can alter locale in webSession, for example:wicketTester.getWicketSession().setLocale(new Locale("fa_IR"));On 5/22/06, BramB < [EMAIL PROTECTED]> wrote: I'm using the getString(String key) method in a few Components, to accesslocalized Strings from the properties file.When testing the components with WicketTester, how do i point WicketTesterto the properties file i want it to use? --View this message in context: http://www.nabble.com/WicketTester+-+.properties+file-t1663331.html#a4506775Sent from the Wicket - User forum at Nabble.com.---Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-- Ingram ChenJava [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen
[Wicket-user] WicketTester & .properties file
I'm using the getString(String key) method in a few Components, to access localized Strings from the properties file. When testing the components with WicketTester, how do i point WicketTester to the properties file i want it to use? -- View this message in context: http://www.nabble.com/WicketTester+-+.properties+file-t1663331.html#a4506775 Sent from the Wicket - User forum at Nabble.com. --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester throws exception instead of failing
Could you please open a bug and if possible attach a simple junit test case Juergen On 4/22/06, Iman Rahmatizadeh <[EMAIL PROTECTED]> wrote: > Hi, > The WicketTester.assertVisible(path) method should check to see if the > component with > the given path is visible or not, but instead it throws a > NullPointerException whenever > it should fail. The getComponentFromLastRenderedPage(path) > method returns null if the component > is invisible. This way i guess the assertVisible method will never be able > to fail. Is this > a bug or something ? > > Iman > --- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ Wicket-user > mailing list Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester throws exception instead of failing
Hi, The WicketTester.assertVisible(path) method should check to see if the component with the given path is visible or not, but instead it throws a NullPointerException whenever it should fail. The getComponentFromLastRenderedPage(path) method returns null if the component is invisible. This way i guess the assertVisible method will never be able to fail. Is this a bug or something ? Iman --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester and checkAccess redirections
No, it is not expected. Would you please copy the unit test and send it to me. I make sure it'll work in 1.2 Juergen On 4/11/06, Gustavo Hexsel <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using Wicket 1.1.1 and trying to get my first WicketTester to work with > the current app. I can't seem to get the redirectToInterceptPage(Page) > method to actually redirect to the page. It works fine from Tomcat and > Jetty, but the WicketTester seems to ignore the call (though I stepped into > it and saw it was actually called). > > Is this the expected behaviour? If so, how do you test the interceptions? > > >[]s Gus > > > --- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester and checkAccess redirections
Hi, I'm using Wicket 1.1.1 and trying to get my first WicketTester to work with the current app. I can't seem to get the redirectToInterceptPage(Page) method to actually redirect to the page. It works fine from Tomcat and Jetty, but the WicketTester seems to ignore the call (though I stepped into it and saw it was actually called). Is this the expected behaviour? If so, how do you test the interceptions? []s Gus --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester replaces Application class
yea... That's one of major drawback of WicketTester since it heavily relies on MockWebApplication. so I personnally avoid to use Application to manage resources.To test with Spring, wiki has an excellent integration and testing, see: http://www.wicket-wiki.org.uk/wiki/index.php/SpringYou may got some ideas there.On 3/14/06, Nick Heudecker <[EMAIL PROTECTED]> wrote: The problem with WicketTester is it replaces your Application subclass, so if you're using something like Spring, you no longer have access to Spring-managed beans. Is there a convenient workaround for this? -- Ingram ChenJava [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen
[Wicket-user] WicketTester replaces Application class
The problem with WicketTester is it replaces your Application subclass, so if you're using something like Spring, you no longer have access to Spring-managed beans. Is there a convenient workaround for this?
Re: [Wicket-user] WicketTester broken (FormTester won't gather request parameters on page)
I think I got the problemfirst, the test I provided is wrong, the 2nd FormTester should instantiated withoutfill blank string on FormComponets, or it will overwrite all FormComponent's input. // disable filling blank string for all FormComponents FormTester formTesterContinue = tester.newFormTester("createForm", false);But even with this fix, the problem still persist. After debugging/traceing, I found that MockWebApplication didn't convert existfield values into request parameters even in previous Wicket release. FormComponentjust get null rawInput, and validation passed just because previous version's RequiredValidator will bypass it: // previous RequiredValidator public final void onValidate(FormComponent formComponent, String value) { //bypass if value is null if (formComponent instanceof AbstractTextComponent && value == null) { return; } //...omit rest }// latest RequiredValidator , implementation changed. public final void onValidate(final FormComponent formComponent, final String value) { // Check value only if form component can take on a null value if (formComponent.isInputNullable()) { // Check value if (Strings.isEmpty(value)) { error(formComponent); } } }So basically my test worked before is relying on I miss interpret RequiredValidator's behavior. I always think that MockWebApplication will gather exist values of field intorequest parameters and so my formTester could continue to process. :(Is it possible to make Mock enviroment to gather field values already on Page ? I believe this is more natural. and it makes testing more smoothly.On 2/19/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:It looks like a namespace issue. We recently started using a kind of namespace for various "resources" including url parameter. Reason:avoiding issues due to users using wicket "preserved" names.JuergenOn 2/18/06, Ingram Chen < [EMAIL PROTECTED]> wrote:> I upgrade to latest CVS, but found behavior of FormTester changed.> below is small test case for> wicket.util.tester.WicketTesterTest:>> public void testCreateBook_submit() throws Exception > {> MyMockApplication tester = new MyMockApplication();> tester.startPage(CreateBook.class);>> FormTester formTester = tester.newFormTester("createForm");> > // two fields are required, one is "name", the other is "id"> // and we only fill one:> formTester.setValue("name", "xxName");> formTester.submit ();>> // we got validation error message:> tester.assertErrorMessages (new String[] { "id is required" });>> // now we continue test the same page, the "name" Field should > // contains value "xxName" on the page> FormTester formTesterContinue = tester.newFormTester("createForm");>> // fill "id" with value "xxId", so all validations should be passed > formTesterContinue.setValue("id", "xxId");> formTesterContinue.submit();>> // but test failed ! I got "name is required" message because> // there is no "name" in request parameter. > tester.assertNoErrorMessage();> }>> FormTester can not convert exist values of fields into request parameters.> Are there changes on MockHttpServletRequest or something recently ? >> --> Ingram Chen> Java [EMAIL PROTECTED]> Institue of BioMedical Sciences Academia Sinica Taiwan> blog: http://www.javaworld.com.tw/roller/page/ingramchen ---This SF.net email is sponsored by: Splunk Inc. Do you grep through log filesfor problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-- Ingram ChenJava [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen
Re: [Wicket-user] WicketTester broken (FormTester won't gather request parameters on page)
It looks like a namespace issue. We recently started using a kind of namespace for various "resources" including url parameter. Reason: avoiding issues due to users using wicket "preserved" names. Juergen On 2/18/06, Ingram Chen <[EMAIL PROTECTED]> wrote: > I upgrade to latest CVS, but found behavior of FormTester changed. > below is small test case for > wicket.util.tester.WicketTesterTest: > > public void testCreateBook_submit() throws Exception > { > MyMockApplication tester = new MyMockApplication(); > tester.startPage(CreateBook.class); > > FormTester formTester = tester.newFormTester("createForm"); > > // two fields are required, one is "name", the other is "id" > // and we only fill one: > formTester.setValue("name", "xxName"); > formTester.submit(); > > // we got validation error message: > tester.assertErrorMessages (new String[] { "id is required" }); > > // now we continue test the same page, the "name" Field should > // contains value "xxName" on the page > FormTester formTesterContinue = tester.newFormTester("createForm"); > > // fill "id" with value "xxId", so all validations should be passed > formTesterContinue.setValue("id", "xxId"); > formTesterContinue.submit(); > > // but test failed ! I got "name is required" message because > // there is no "name" in request parameter. > tester.assertNoErrorMessage(); > } > > FormTester can not convert exist values of fields into request parameters. > Are there changes on MockHttpServletRequest or something recently ? > > -- > Ingram Chen > Java [EMAIL PROTECTED] > Institue of BioMedical Sciences Academia Sinica Taiwan > blog: http://www.javaworld.com.tw/roller/page/ingramchen --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] WicketTester broken (FormTester won't gather request parameters on page)
I upgrade to latest CVS, but found behavior of FormTester changed.below is small test case for wicket.util.tester.WicketTesterTest:public void testCreateBook_submit() throws Exception { MyMockApplication tester = new MyMockApplication(); tester.startPage(CreateBook.class); FormTester formTester = tester.newFormTester("createForm"); // two fields are required, one is "name", the other is "id" // and we only fill one: formTester.setValue("name", "xxName"); formTester.submit(); // we got validation error message: tester.assertErrorMessages (new String[] { "id is required" }); // now we continue test the same page, the "name" Field should // contains value "xxName" on the page FormTester formTesterContinue = tester.newFormTester("createForm"); // fill "id" with value "xxId", so all validations should be passed formTesterContinue.setValue("id", "xxId"); formTesterContinue.submit(); // but test failed ! I got "name is required" message because // there is no "name" in request parameter. tester.assertNoErrorMessage();}FormTester can not convert exist values of fields into request parameters. Are there changes on MockHttpServletRequest or something recently ? -- Ingram ChenJava [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen