Re: Test errors after upgrading to Wicket 8.7.0

2020-01-10 Thread Francesco Chicchiriccò
Worked like a charm, thanks!

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

Regards.

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

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



Re: Test errors after upgrading to Wicket 8.7.0

2020-01-10 Thread Martin Grigorov
On Fri, Jan 10, 2020 at 2:55 PM Francesco Chicchiriccò 
wrote:

> On 2020/01/10 12:24:49, Martin Grigorov  wrote:
> > Hi Francesco,
> >
> > This was a bug in Wicket, a security related one.
> > You will need to fix your code.
> >
> > The change should look something like this:
> >
> >
> > -   tester.getRequest().setParameter("select",
> > page.option1.getValue());
> > -   tester.getRequest().setParameter("text", "text is
> required");
> > -   tester.submitForm(page.form);
> > +   final FormTester formTester2 =
> tester.newFormTester("form");
> > +   formTester2.setValue("select", "option1");
> > +   formTester2.setValue("text", "text is required");
> > +   formTester2.submit();
> >
> > from
> >
> https://gitbox.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=0c19cf8;hp=3d8f8b306a92cee71020a633be1d347177d7b7fc
>
> Thanks Martin.
>
> As I can see from above, you have a Form instance, which we don't have in
> [2].
>
> Moreover, the problem only occurs with MockWebRequest, not with regular
> operations (e.g. HttpServletRequest), hence I'd need to introduce a Form
> only to let tests pass...
>
> Is there any way to let WicketTester use a different implementation then
> MockWebRequest?
>

This is how we resolve the method:

+   protected List getParameterValues(String inputName)
+   {
+   String method = Form.METHOD_POST;
+   final Form form = findParent(Form.class);
+   final Request request = getRequest();
+   if (getRequest().getContainerRequest() instanceof
HttpServletRequest)
+   {
+   method = ((HttpServletRequest)
getRequest().getContainerRequest()).getMethod();
+   }
+   else if (form != null)
+   {
+   method = form.getMethod();
+   }

Try with:
tester.getRequest().setMethod("get");
tester.getRequest().setParameter("select", page.option1.getValue());
...


> Regards.
>
> > On Fri, Jan 10, 2020 at 9:31 AM Francesco Chicchiriccò <
> ilgro...@apache.org>
> > wrote:
> >
> > > Hi there,
> > > it seems we have some issues with Wicket Tester, after upgrading to
> 8.7.0
> > > from 8.6.1.
> > >
> > > In particular, due to the change [1] for WICKET-6708, we have found
> that
> > > MockWebRequest is not behaving as expected; no troubles occur instead
> > > during normal operations with HttpServletRequest.
> > >
> > > The test failures occur because MockWebRequest's method is (correctly)
> set
> > > to POST but parameters are submitted with URL, when using
> DropDownChoice
> > > with onChange behavior [2].
> > >
> > > Of course, such situation was fine with code prior to [1] but not
> working
> > > anymore: I have verified that expected submit parameters are part of
> URL,
> > > hence are available as getQueryParameters() but getPostParameters() is
> > > invoked instead.
> > >
> > > FYI, one of failing test cases in [3].
> > >
> > > Please let me know if this is a bug with MockWebRequest or whether we
> have
> > > to update our test code, thanks.
> > >
> > > Regards.
> > >
> > > [1]
> https://github.com/apache/wicket/commit/9c3129517a15c37cc90fb27a697868a825940aa0#diff-51cf2faf6078497df77cc6d995dd1b98R763
> > > [2]
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java#L71
> > > [3]
> https://github.com/apache/syncope/blob/2_1_X/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java#L57
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Test errors after upgrading to Wicket 8.7.0

2020-01-10 Thread Francesco Chicchiriccò
On 2020/01/10 12:24:49, Martin Grigorov  wrote: 
> Hi Francesco,
> 
> This was a bug in Wicket, a security related one.
> You will need to fix your code.
> 
> The change should look something like this:
> 
> 
> -   tester.getRequest().setParameter("select",
> page.option1.getValue());
> -   tester.getRequest().setParameter("text", "text is required");
> -   tester.submitForm(page.form);
> +   final FormTester formTester2 = tester.newFormTester("form");
> +   formTester2.setValue("select", "option1");
> +   formTester2.setValue("text", "text is required");
> +   formTester2.submit();
> 
> from
> https://gitbox.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=0c19cf8;hp=3d8f8b306a92cee71020a633be1d347177d7b7fc

Thanks Martin.

As I can see from above, you have a Form instance, which we don't have in [2].

Moreover, the problem only occurs with MockWebRequest, not with regular 
operations (e.g. HttpServletRequest), hence I'd need to introduce a Form only 
to let tests pass...

Is there any way to let WicketTester use a different implementation then 
MockWebRequest?

Regards.

> On Fri, Jan 10, 2020 at 9:31 AM Francesco Chicchiriccò 
> wrote:
> 
> > Hi there,
> > it seems we have some issues with Wicket Tester, after upgrading to 8.7.0
> > from 8.6.1.
> >
> > In particular, due to the change [1] for WICKET-6708, we have found that
> > MockWebRequest is not behaving as expected; no troubles occur instead
> > during normal operations with HttpServletRequest.
> >
> > The test failures occur because MockWebRequest's method is (correctly) set
> > to POST but parameters are submitted with URL, when using DropDownChoice
> > with onChange behavior [2].
> >
> > Of course, such situation was fine with code prior to [1] but not working
> > anymore: I have verified that expected submit parameters are part of URL,
> > hence are available as getQueryParameters() but getPostParameters() is
> > invoked instead.
> >
> > FYI, one of failing test cases in [3].
> >
> > Please let me know if this is a bug with MockWebRequest or whether we have
> > to update our test code, thanks.
> >
> > Regards.
> >
> > [1] 
> > https://github.com/apache/wicket/commit/9c3129517a15c37cc90fb27a697868a825940aa0#diff-51cf2faf6078497df77cc6d995dd1b98R763
> > [2] 
> > https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java#L71
> > [3] 
> > https://github.com/apache/syncope/blob/2_1_X/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java#L57

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



Re: Test errors after upgrading to Wicket 8.7.0

2020-01-10 Thread Martin Grigorov
Hi Francesco,

This was a bug in Wicket, a security related one.
You will need to fix your code.

The change should look something like this:


-   tester.getRequest().setParameter("select",
page.option1.getValue());
-   tester.getRequest().setParameter("text", "text is required");
-   tester.submitForm(page.form);
+   final FormTester formTester2 = tester.newFormTester("form");
+   formTester2.setValue("select", "option1");
+   formTester2.setValue("text", "text is required");
+   formTester2.submit();

from
https://gitbox.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=0c19cf8;hp=3d8f8b306a92cee71020a633be1d347177d7b7fc


On Fri, Jan 10, 2020 at 9:31 AM Francesco Chicchiriccò 
wrote:

> Hi there,
> it seems we have some issues with Wicket Tester, after upgrading to 8.7.0
> from 8.6.1.
>
> In particular, due to the change [1] for WICKET-6708, we have found that
> MockWebRequest is not behaving as expected; no troubles occur instead
> during normal operations with HttpServletRequest.
>
> The test failures occur because MockWebRequest's method is (correctly) set
> to POST but parameters are submitted with URL, when using DropDownChoice
> with onChange behavior [2].
>
> Of course, such situation was fine with code prior to [1] but not working
> anymore: I have verified that expected submit parameters are part of URL,
> hence are available as getQueryParameters() but getPostParameters() is
> invoked instead.
>
> FYI, one of failing test cases in [3].
>
> Please let me know if this is a bug with MockWebRequest or whether we have
> to update our test code, thanks.
>
> Regards.
>
> [1]
> https://github.com/apache/wicket/commit/9c3129517a15c37cc90fb27a697868a825940aa0#diff-51cf2faf6078497df77cc6d995dd1b98R763
> [2]
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java#L71
> [3]
> https://github.com/apache/syncope/blob/2_1_X/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java#L57
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Test Page renders with Nested Panel

2017-02-14 Thread David Beer
Hi

Thanks for the link I will look into this further separately. See if I can
do something Similar for Java EE and @EJB etc.

On 14 February 2017 at 09:12, Martin Grigorov  wrote:

> Hi,
>
> I thought you want to use Spring (because the branch name mentions it).
> You can do the same with Java EE.
> If you use CDI then take a look at
> https://github.com/apache/wicket/tree/master/wicket-cdi-
> 1.1/src/test/java/org/apache/wicket/cdi
> I have no idea how to test @EJB and @Stateless. I haven't used those since
> very long time.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Feb 13, 2017 at 11:39 PM, David Beer 
> wrote:
>
> > Hi Martin
> >
> > Thanks for the PR. So the solution is to remove JavaEE EJB references
> > rather than to use them and test them. Understand Spring doesn't care
> about
> > EJB but and vice versa. I am only using spring for the security layer and
> > JavaEE for everything else.
> >
> > So does @SpringBean just convert the EJB to a spring bean.
> >
> > So the only other way to test the EJB approach is to pass a mock value to
> > the constructor and have it check if the value is null as the container
> > will Inject the value.
> >
> > David
> >
> >
> > On 13 February 2017 at 21:20, Martin Grigorov 
> > wrote:
> >
> > > https://github.com/dmbeer/wicket-7-spring-security/pull/1
> > > There you go!
> > >
> > > I've removed/commented out the Java EE stuff.
> > > Spring doesn't care about @EJB/@Stateless. As JavaEE doesn't care about
> > > @Component & Co.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Mon, Feb 13, 2017 at 10:05 PM, David Beer 
> > > wrote:
> > >
> > > > Hi Martin
> > > >
> > > > It appears there was an error when I tried to push the code. I am
> > trying
> > > to
> > > > test AdminPage, and failing to inject the mock from the application
> > > > context.
> > > >
> > > > AdminPage
> > > > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > > > wicket-7-test-spring-security/src/main/java/com/copperarrow/
> > > > pages/AdminPage.java
> > > > AdmingPageTest
> > > > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > > > wicket-7-test-spring-security/src/test/java/com/copperarrow/
> > > > pages/AdminPageTest.java
> > > > UserAccountDataProvider
> > > > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > > > wicket-7-test-spring-security/src/main/java/com/copperarrow/
> > > > model/dataproviders/UserAccountDataProvider.java
> > > >
> > > > This fails unable to attach container because UserDAO is always null
> > even
> > > > though I have added it to the applicationmock context.
> > > >
> > > >
> > > >
> > > > On 13 February 2017 at 19:57, Martin Grigorov 
> > > > wrote:
> > > >
> > > > > Hi David,
> > > > >
> > > > > Please give more information what is not working.
> > > > > There are 3 tests and all pass.
> > > > > I have no idea where to look for a problem.
> > > > >
> > > > > Martin Grigorov
> > > > > Wicket Training and Consulting
> > > > > https://twitter.com/mtgrigorov
> > > > >
> > > > > On Sat, Feb 11, 2017 at 11:12 PM, David Beer <
> david.m.b...@gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Hi Martin
> > > > > >
> > > > > > Thanks for the pointers some left over code from refactoring. I
> > have
> > > > > > created an example project located here
> > > > > >  > > > > > wicket-7-test-spring-security>
> > > > > > under branch wicket-7-test-spring-security. I am still struggling
> > to
> > > > get
> > > > > > the mocked DAO injected. Any pointers welcome or even a PR if not
> > too
> > > > > much
> > > > > > trouble or example somewhere.
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > David
> > > > > >
> > > > > > On 10 February 2017 at 07:46, Martin Grigorov <
> > mgrigo...@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > >
> > > > > > > On Fri, Feb 10, 2017 at 12:08 AM, David Beer <
> > > david.m.b...@gmail.com
> > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Guys
> > > > > > > >
> > > > > > > > I am new to WicketTester and testing pages here. I am also
> > > getting
> > > > > back
> > > > > > > > into wicket slowly.
> > > > > > > >
> > > > > > > > I have a page which currently simply adds a panel (more to
> > come),
> > > > the
> > > > > > > panel
> > > > > > > > contains a DataTable. I am not interested in the content of
> the
> > > > table
> > > > > > > just
> > > > > > > > that the page renders with an empty table.
> > > > > > > >
> > > > > > > > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> > > > > > > >
> > > > > > > > The problem is that when I do tester.startPage(MyPage.class)
> it
> > > > tries
> > > > > > to
> > > > > > > > add the data table and fails unless data provider size is set
> > to
> > > 0.
> > > > > > > >
> > > > > > > > MyPage Code
> > > > > > > >
> > > > > > > 

Re: Test Page renders with Nested Panel

2017-02-14 Thread Martin Grigorov
Hi,

I thought you want to use Spring (because the branch name mentions it).
You can do the same with Java EE.
If you use CDI then take a look at
https://github.com/apache/wicket/tree/master/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi
I have no idea how to test @EJB and @Stateless. I haven't used those since
very long time.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Feb 13, 2017 at 11:39 PM, David Beer  wrote:

> Hi Martin
>
> Thanks for the PR. So the solution is to remove JavaEE EJB references
> rather than to use them and test them. Understand Spring doesn't care about
> EJB but and vice versa. I am only using spring for the security layer and
> JavaEE for everything else.
>
> So does @SpringBean just convert the EJB to a spring bean.
>
> So the only other way to test the EJB approach is to pass a mock value to
> the constructor and have it check if the value is null as the container
> will Inject the value.
>
> David
>
>
> On 13 February 2017 at 21:20, Martin Grigorov 
> wrote:
>
> > https://github.com/dmbeer/wicket-7-spring-security/pull/1
> > There you go!
> >
> > I've removed/commented out the Java EE stuff.
> > Spring doesn't care about @EJB/@Stateless. As JavaEE doesn't care about
> > @Component & Co.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, Feb 13, 2017 at 10:05 PM, David Beer 
> > wrote:
> >
> > > Hi Martin
> > >
> > > It appears there was an error when I tried to push the code. I am
> trying
> > to
> > > test AdminPage, and failing to inject the mock from the application
> > > context.
> > >
> > > AdminPage
> > > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > > wicket-7-test-spring-security/src/main/java/com/copperarrow/
> > > pages/AdminPage.java
> > > AdmingPageTest
> > > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > > wicket-7-test-spring-security/src/test/java/com/copperarrow/
> > > pages/AdminPageTest.java
> > > UserAccountDataProvider
> > > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > > wicket-7-test-spring-security/src/main/java/com/copperarrow/
> > > model/dataproviders/UserAccountDataProvider.java
> > >
> > > This fails unable to attach container because UserDAO is always null
> even
> > > though I have added it to the applicationmock context.
> > >
> > >
> > >
> > > On 13 February 2017 at 19:57, Martin Grigorov 
> > > wrote:
> > >
> > > > Hi David,
> > > >
> > > > Please give more information what is not working.
> > > > There are 3 tests and all pass.
> > > > I have no idea where to look for a problem.
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Sat, Feb 11, 2017 at 11:12 PM, David Beer  >
> > > > wrote:
> > > >
> > > > > Hi Martin
> > > > >
> > > > > Thanks for the pointers some left over code from refactoring. I
> have
> > > > > created an example project located here
> > > > >  > > > > wicket-7-test-spring-security>
> > > > > under branch wicket-7-test-spring-security. I am still struggling
> to
> > > get
> > > > > the mocked DAO injected. Any pointers welcome or even a PR if not
> too
> > > > much
> > > > > trouble or example somewhere.
> > > > >
> > > > > Thanks
> > > > >
> > > > > David
> > > > >
> > > > > On 10 February 2017 at 07:46, Martin Grigorov <
> mgrigo...@apache.org>
> > > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > >
> > > > > > On Fri, Feb 10, 2017 at 12:08 AM, David Beer <
> > david.m.b...@gmail.com
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Guys
> > > > > > >
> > > > > > > I am new to WicketTester and testing pages here. I am also
> > getting
> > > > back
> > > > > > > into wicket slowly.
> > > > > > >
> > > > > > > I have a page which currently simply adds a panel (more to
> come),
> > > the
> > > > > > panel
> > > > > > > contains a DataTable. I am not interested in the content of the
> > > table
> > > > > > just
> > > > > > > that the page renders with an empty table.
> > > > > > >
> > > > > > > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> > > > > > >
> > > > > > > The problem is that when I do tester.startPage(MyPage.class) it
> > > tries
> > > > > to
> > > > > > > add the data table and fails unless data provider size is set
> to
> > 0.
> > > > > > >
> > > > > > > MyPage Code
> > > > > > >
> > > > > > > public class MyPage extends BasePage {
> > > > > > >
> > > > > > > private NotificationPanel notificationPanel;
> > > > > > > private BootstrapDefaultDataTable
> > userTable;
> > > > > > >
> > > > > >
> > > > > > This is not used/needed.
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > public MyPage() {
> > > > > > > notificationPanel = new NotificationPanel("notification");
> > > > > > > notificationPanel.setOutputMarkupId(true);
> > > > > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > > > > > a

Re: Test Page renders with Nested Panel

2017-02-13 Thread David Beer
Hi Martin

Thanks for the PR. So the solution is to remove JavaEE EJB references
rather than to use them and test them. Understand Spring doesn't care about
EJB but and vice versa. I am only using spring for the security layer and
JavaEE for everything else.

So does @SpringBean just convert the EJB to a spring bean.

So the only other way to test the EJB approach is to pass a mock value to
the constructor and have it check if the value is null as the container
will Inject the value.

David


On 13 February 2017 at 21:20, Martin Grigorov  wrote:

> https://github.com/dmbeer/wicket-7-spring-security/pull/1
> There you go!
>
> I've removed/commented out the Java EE stuff.
> Spring doesn't care about @EJB/@Stateless. As JavaEE doesn't care about
> @Component & Co.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Feb 13, 2017 at 10:05 PM, David Beer 
> wrote:
>
> > Hi Martin
> >
> > It appears there was an error when I tried to push the code. I am trying
> to
> > test AdminPage, and failing to inject the mock from the application
> > context.
> >
> > AdminPage
> > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > wicket-7-test-spring-security/src/main/java/com/copperarrow/
> > pages/AdminPage.java
> > AdmingPageTest
> > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > wicket-7-test-spring-security/src/test/java/com/copperarrow/
> > pages/AdminPageTest.java
> > UserAccountDataProvider
> > https://github.com/dmbeer/wicket-7-spring-security/blob/
> > wicket-7-test-spring-security/src/main/java/com/copperarrow/
> > model/dataproviders/UserAccountDataProvider.java
> >
> > This fails unable to attach container because UserDAO is always null even
> > though I have added it to the applicationmock context.
> >
> >
> >
> > On 13 February 2017 at 19:57, Martin Grigorov 
> > wrote:
> >
> > > Hi David,
> > >
> > > Please give more information what is not working.
> > > There are 3 tests and all pass.
> > > I have no idea where to look for a problem.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Sat, Feb 11, 2017 at 11:12 PM, David Beer 
> > > wrote:
> > >
> > > > Hi Martin
> > > >
> > > > Thanks for the pointers some left over code from refactoring. I have
> > > > created an example project located here
> > > >  > > > wicket-7-test-spring-security>
> > > > under branch wicket-7-test-spring-security. I am still struggling to
> > get
> > > > the mocked DAO injected. Any pointers welcome or even a PR if not too
> > > much
> > > > trouble or example somewhere.
> > > >
> > > > Thanks
> > > >
> > > > David
> > > >
> > > > On 10 February 2017 at 07:46, Martin Grigorov 
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > >
> > > > > On Fri, Feb 10, 2017 at 12:08 AM, David Beer <
> david.m.b...@gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Hi Guys
> > > > > >
> > > > > > I am new to WicketTester and testing pages here. I am also
> getting
> > > back
> > > > > > into wicket slowly.
> > > > > >
> > > > > > I have a page which currently simply adds a panel (more to come),
> > the
> > > > > panel
> > > > > > contains a DataTable. I am not interested in the content of the
> > table
> > > > > just
> > > > > > that the page renders with an empty table.
> > > > > >
> > > > > > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> > > > > >
> > > > > > The problem is that when I do tester.startPage(MyPage.class) it
> > tries
> > > > to
> > > > > > add the data table and fails unless data provider size is set to
> 0.
> > > > > >
> > > > > > MyPage Code
> > > > > >
> > > > > > public class MyPage extends BasePage {
> > > > > >
> > > > > > private NotificationPanel notificationPanel;
> > > > > > private BootstrapDefaultDataTable
> userTable;
> > > > > >
> > > > >
> > > > > This is not used/needed.
> > > > >
> > > > >
> > > > > >
> > > > > > public MyPage() {
> > > > > > notificationPanel = new NotificationPanel("notification");
> > > > > > notificationPanel.setOutputMarkupId(true);
> > > > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > > > > add(notificationPanel);
> > > > > > add(new MyPanel("users-table-panel"));
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > MyPanel code
> > > > > >
> > > > > > public class MyPanel extends Panel {
> > > > > >
> > > > > > private NotificationPanel notificationPanel;
> > > > > > private BootstrapDefaultDataTable
> > > userTable;
> > > > > >
> > > > > >
> > > > > > public UsersTablePanel(String id) {
> > > > > > super(id);
> > > > > > notificationPanel = new NotificationPanel("
> notification");
> > > > >
> > > > >
> > > > > This looks the same as in the page. Maybe one should be removed ?!
> > > > >
> > > > >
> > > > > > notificationPanel.setOutputMarkupId(true);
> > > > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > 

Re: Test Page renders with Nested Panel

2017-02-13 Thread Martin Grigorov
https://github.com/dmbeer/wicket-7-spring-security/pull/1
There you go!

I've removed/commented out the Java EE stuff.
Spring doesn't care about @EJB/@Stateless. As JavaEE doesn't care about
@Component & Co.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Feb 13, 2017 at 10:05 PM, David Beer  wrote:

> Hi Martin
>
> It appears there was an error when I tried to push the code. I am trying to
> test AdminPage, and failing to inject the mock from the application
> context.
>
> AdminPage
> https://github.com/dmbeer/wicket-7-spring-security/blob/
> wicket-7-test-spring-security/src/main/java/com/copperarrow/
> pages/AdminPage.java
> AdmingPageTest
> https://github.com/dmbeer/wicket-7-spring-security/blob/
> wicket-7-test-spring-security/src/test/java/com/copperarrow/
> pages/AdminPageTest.java
> UserAccountDataProvider
> https://github.com/dmbeer/wicket-7-spring-security/blob/
> wicket-7-test-spring-security/src/main/java/com/copperarrow/
> model/dataproviders/UserAccountDataProvider.java
>
> This fails unable to attach container because UserDAO is always null even
> though I have added it to the applicationmock context.
>
>
>
> On 13 February 2017 at 19:57, Martin Grigorov 
> wrote:
>
> > Hi David,
> >
> > Please give more information what is not working.
> > There are 3 tests and all pass.
> > I have no idea where to look for a problem.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Sat, Feb 11, 2017 at 11:12 PM, David Beer 
> > wrote:
> >
> > > Hi Martin
> > >
> > > Thanks for the pointers some left over code from refactoring. I have
> > > created an example project located here
> > >  > > wicket-7-test-spring-security>
> > > under branch wicket-7-test-spring-security. I am still struggling to
> get
> > > the mocked DAO injected. Any pointers welcome or even a PR if not too
> > much
> > > trouble or example somewhere.
> > >
> > > Thanks
> > >
> > > David
> > >
> > > On 10 February 2017 at 07:46, Martin Grigorov 
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > >
> > > > On Fri, Feb 10, 2017 at 12:08 AM, David Beer  >
> > > > wrote:
> > > >
> > > > > Hi Guys
> > > > >
> > > > > I am new to WicketTester and testing pages here. I am also getting
> > back
> > > > > into wicket slowly.
> > > > >
> > > > > I have a page which currently simply adds a panel (more to come),
> the
> > > > panel
> > > > > contains a DataTable. I am not interested in the content of the
> table
> > > > just
> > > > > that the page renders with an empty table.
> > > > >
> > > > > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> > > > >
> > > > > The problem is that when I do tester.startPage(MyPage.class) it
> tries
> > > to
> > > > > add the data table and fails unless data provider size is set to 0.
> > > > >
> > > > > MyPage Code
> > > > >
> > > > > public class MyPage extends BasePage {
> > > > >
> > > > > private NotificationPanel notificationPanel;
> > > > > private BootstrapDefaultDataTable userTable;
> > > > >
> > > >
> > > > This is not used/needed.
> > > >
> > > >
> > > > >
> > > > > public MyPage() {
> > > > > notificationPanel = new NotificationPanel("notification");
> > > > > notificationPanel.setOutputMarkupId(true);
> > > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > > > add(notificationPanel);
> > > > > add(new MyPanel("users-table-panel"));
> > > > > }
> > > > > }
> > > > >
> > > > > MyPanel code
> > > > >
> > > > > public class MyPanel extends Panel {
> > > > >
> > > > > private NotificationPanel notificationPanel;
> > > > > private BootstrapDefaultDataTable
> > userTable;
> > > > >
> > > > >
> > > > > public UsersTablePanel(String id) {
> > > > > super(id);
> > > > > notificationPanel = new NotificationPanel("notification");
> > > >
> > > >
> > > > This looks the same as in the page. Maybe one should be removed ?!
> > > >
> > > >
> > > > > notificationPanel.setOutputMarkupId(true);
> > > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > > > add(notificationPanel);
> > > > > usersTable();
> > > > > }
> > > > >
> > > > > private void usersTable() {
> > > > > List> columns = new
> > ArrayList<>();
> > > > > columns.add(new PropertyColumn<>(Model.of("First Name"),
> > > > > "firstName", "firstName"));
> > > > > columns.add(new PropertyColumn<>(Model.of("Last Name"),
> > > > > "lastName"));
> > > > > columns.add(new PropertyColumn<>(Model.of("Email
> Address"),
> > > > > "email"));
> > > > > columns.add(new PropertyColumn<>(Model.of("Username"),
> > > > > "userName"));
> > > > >
> > > > > userTable = new BootstrapDefaultDataTable<>("users-table",
> > > > > columns,
> > > > > new DataProvider(), 20);
> > > > >
> > > >
> > > > Here you create a new DataProvider.
> > > > Does it use some service (Spring, EJB, Guice,...) to load

Re: Test Page renders with Nested Panel

2017-02-13 Thread David Beer
Hi Martin

It appears there was an error when I tried to push the code. I am trying to
test AdminPage, and failing to inject the mock from the application context.

AdminPage
https://github.com/dmbeer/wicket-7-spring-security/blob/wicket-7-test-spring-security/src/main/java/com/copperarrow/pages/AdminPage.java
AdmingPageTest
https://github.com/dmbeer/wicket-7-spring-security/blob/wicket-7-test-spring-security/src/test/java/com/copperarrow/pages/AdminPageTest.java
UserAccountDataProvider
https://github.com/dmbeer/wicket-7-spring-security/blob/wicket-7-test-spring-security/src/main/java/com/copperarrow/model/dataproviders/UserAccountDataProvider.java

This fails unable to attach container because UserDAO is always null even
though I have added it to the applicationmock context.



On 13 February 2017 at 19:57, Martin Grigorov  wrote:

> Hi David,
>
> Please give more information what is not working.
> There are 3 tests and all pass.
> I have no idea where to look for a problem.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Sat, Feb 11, 2017 at 11:12 PM, David Beer 
> wrote:
>
> > Hi Martin
> >
> > Thanks for the pointers some left over code from refactoring. I have
> > created an example project located here
> >  > wicket-7-test-spring-security>
> > under branch wicket-7-test-spring-security. I am still struggling to get
> > the mocked DAO injected. Any pointers welcome or even a PR if not too
> much
> > trouble or example somewhere.
> >
> > Thanks
> >
> > David
> >
> > On 10 February 2017 at 07:46, Martin Grigorov 
> > wrote:
> >
> > > Hi,
> > >
> > >
> > > On Fri, Feb 10, 2017 at 12:08 AM, David Beer 
> > > wrote:
> > >
> > > > Hi Guys
> > > >
> > > > I am new to WicketTester and testing pages here. I am also getting
> back
> > > > into wicket slowly.
> > > >
> > > > I have a page which currently simply adds a panel (more to come), the
> > > panel
> > > > contains a DataTable. I am not interested in the content of the table
> > > just
> > > > that the page renders with an empty table.
> > > >
> > > > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> > > >
> > > > The problem is that when I do tester.startPage(MyPage.class) it tries
> > to
> > > > add the data table and fails unless data provider size is set to 0.
> > > >
> > > > MyPage Code
> > > >
> > > > public class MyPage extends BasePage {
> > > >
> > > > private NotificationPanel notificationPanel;
> > > > private BootstrapDefaultDataTable userTable;
> > > >
> > >
> > > This is not used/needed.
> > >
> > >
> > > >
> > > > public MyPage() {
> > > > notificationPanel = new NotificationPanel("notification");
> > > > notificationPanel.setOutputMarkupId(true);
> > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > > add(notificationPanel);
> > > > add(new MyPanel("users-table-panel"));
> > > > }
> > > > }
> > > >
> > > > MyPanel code
> > > >
> > > > public class MyPanel extends Panel {
> > > >
> > > > private NotificationPanel notificationPanel;
> > > > private BootstrapDefaultDataTable
> userTable;
> > > >
> > > >
> > > > public UsersTablePanel(String id) {
> > > > super(id);
> > > > notificationPanel = new NotificationPanel("notification");
> > >
> > >
> > > This looks the same as in the page. Maybe one should be removed ?!
> > >
> > >
> > > > notificationPanel.setOutputMarkupId(true);
> > > > notificationPanel.hideAfter(Duration.seconds(2));
> > > > add(notificationPanel);
> > > > usersTable();
> > > > }
> > > >
> > > > private void usersTable() {
> > > > List> columns = new
> ArrayList<>();
> > > > columns.add(new PropertyColumn<>(Model.of("First Name"),
> > > > "firstName", "firstName"));
> > > > columns.add(new PropertyColumn<>(Model.of("Last Name"),
> > > > "lastName"));
> > > > columns.add(new PropertyColumn<>(Model.of("Email Address"),
> > > > "email"));
> > > > columns.add(new PropertyColumn<>(Model.of("Username"),
> > > > "userName"));
> > > >
> > > > userTable = new BootstrapDefaultDataTable<>("users-table",
> > > > columns,
> > > > new DataProvider(), 20);
> > > >
> > >
> > > Here you create a new DataProvider.
> > > Does it use some service (Spring, EJB, Guice,...) to load the items ?!
> > >
> > >
> > > > userTable.add(new TableBehavior().hover().bordered());
> > > > add(userTable);
> > > > }
> > > > }
> > > >
> > > > MyPageTest Code
> > > >
> > > > public class AdminViewPageTest extends WicketApplicationTest {
> > > >
> > > > private WicketTester tester;
> > > >
> > > > private UsersDataProvider usersDataProvider;
> > > >
> > > > private AdminViewPage adminViewPage;
> > > >
> > > > @Before
> > > > public void setUp() throws Exception {
> > > > super.setUp();
> > > > usersDataProvider = mock(UsersDataProvider.class);
> > > > adminViewPage = new AdminViewPage();
> > > > doNothing().wh

Re: Test Page renders with Nested Panel

2017-02-13 Thread Martin Grigorov
Hi David,

Please give more information what is not working.
There are 3 tests and all pass.
I have no idea where to look for a problem.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sat, Feb 11, 2017 at 11:12 PM, David Beer  wrote:

> Hi Martin
>
> Thanks for the pointers some left over code from refactoring. I have
> created an example project located here
>  wicket-7-test-spring-security>
> under branch wicket-7-test-spring-security. I am still struggling to get
> the mocked DAO injected. Any pointers welcome or even a PR if not too much
> trouble or example somewhere.
>
> Thanks
>
> David
>
> On 10 February 2017 at 07:46, Martin Grigorov 
> wrote:
>
> > Hi,
> >
> >
> > On Fri, Feb 10, 2017 at 12:08 AM, David Beer 
> > wrote:
> >
> > > Hi Guys
> > >
> > > I am new to WicketTester and testing pages here. I am also getting back
> > > into wicket slowly.
> > >
> > > I have a page which currently simply adds a panel (more to come), the
> > panel
> > > contains a DataTable. I am not interested in the content of the table
> > just
> > > that the page renders with an empty table.
> > >
> > > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> > >
> > > The problem is that when I do tester.startPage(MyPage.class) it tries
> to
> > > add the data table and fails unless data provider size is set to 0.
> > >
> > > MyPage Code
> > >
> > > public class MyPage extends BasePage {
> > >
> > > private NotificationPanel notificationPanel;
> > > private BootstrapDefaultDataTable userTable;
> > >
> >
> > This is not used/needed.
> >
> >
> > >
> > > public MyPage() {
> > > notificationPanel = new NotificationPanel("notification");
> > > notificationPanel.setOutputMarkupId(true);
> > > notificationPanel.hideAfter(Duration.seconds(2));
> > > add(notificationPanel);
> > > add(new MyPanel("users-table-panel"));
> > > }
> > > }
> > >
> > > MyPanel code
> > >
> > > public class MyPanel extends Panel {
> > >
> > > private NotificationPanel notificationPanel;
> > > private BootstrapDefaultDataTable userTable;
> > >
> > >
> > > public UsersTablePanel(String id) {
> > > super(id);
> > > notificationPanel = new NotificationPanel("notification");
> >
> >
> > This looks the same as in the page. Maybe one should be removed ?!
> >
> >
> > > notificationPanel.setOutputMarkupId(true);
> > > notificationPanel.hideAfter(Duration.seconds(2));
> > > add(notificationPanel);
> > > usersTable();
> > > }
> > >
> > > private void usersTable() {
> > > List> columns = new ArrayList<>();
> > > columns.add(new PropertyColumn<>(Model.of("First Name"),
> > > "firstName", "firstName"));
> > > columns.add(new PropertyColumn<>(Model.of("Last Name"),
> > > "lastName"));
> > > columns.add(new PropertyColumn<>(Model.of("Email Address"),
> > > "email"));
> > > columns.add(new PropertyColumn<>(Model.of("Username"),
> > > "userName"));
> > >
> > > userTable = new BootstrapDefaultDataTable<>("users-table",
> > > columns,
> > > new DataProvider(), 20);
> > >
> >
> > Here you create a new DataProvider.
> > Does it use some service (Spring, EJB, Guice,...) to load the items ?!
> >
> >
> > > userTable.add(new TableBehavior().hover().bordered());
> > > add(userTable);
> > > }
> > > }
> > >
> > > MyPageTest Code
> > >
> > > public class AdminViewPageTest extends WicketApplicationTest {
> > >
> > > private WicketTester tester;
> > >
> > > private UsersDataProvider usersDataProvider;
> > >
> > > private AdminViewPage adminViewPage;
> > >
> > > @Before
> > > public void setUp() throws Exception {
> > > super.setUp();
> > > usersDataProvider = mock(UsersDataProvider.class);
> > > adminViewPage = new AdminViewPage();
> > > doNothing().when(usersDataProvider).checkDAO();
> > > when(usersDataProvider.size()).thenReturn(0L);
> > >
> >
> > This usersDataProvider is not really used by UsersTablePanel.java because
> > it creates its own one (new DataProvider()). So the mocking doesn't
> really
> > help.
> >
> >
> > > tester = getTester();
> > > tester.startPage(adminViewPage);
> > > }
> > >
> > > @Test
> > > public void renderSuccessfully() throws Exception {
> > > tester.assertRenderedPage(AdminViewPage.class);
> > > }
> > >
> > > }
> > >
> > > Any pointers would be great.
> > >
> >
> > Usually the DataProviders use some service to load the items and this
> > service is injected (Spring, CDI, ...).
> > Then in your tests you need to provide Dependency Injection context that
> > provides mocked service. This way Wicket will used the mock for the tests
> > and the real service when running the application.
> >
> >
> > >
> > > Thanks
> > >
> > > David
> > >
> >
>


Re: Test Page renders with Nested Panel

2017-02-11 Thread David Beer
Hi Martin

Thanks for the pointers some left over code from refactoring. I have
created an example project located here

under branch wicket-7-test-spring-security. I am still struggling to get
the mocked DAO injected. Any pointers welcome or even a PR if not too much
trouble or example somewhere.

Thanks

David

On 10 February 2017 at 07:46, Martin Grigorov  wrote:

> Hi,
>
>
> On Fri, Feb 10, 2017 at 12:08 AM, David Beer 
> wrote:
>
> > Hi Guys
> >
> > I am new to WicketTester and testing pages here. I am also getting back
> > into wicket slowly.
> >
> > I have a page which currently simply adds a panel (more to come), the
> panel
> > contains a DataTable. I am not interested in the content of the table
> just
> > that the page renders with an empty table.
> >
> > MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
> >
> > The problem is that when I do tester.startPage(MyPage.class) it tries to
> > add the data table and fails unless data provider size is set to 0.
> >
> > MyPage Code
> >
> > public class MyPage extends BasePage {
> >
> > private NotificationPanel notificationPanel;
> > private BootstrapDefaultDataTable userTable;
> >
>
> This is not used/needed.
>
>
> >
> > public MyPage() {
> > notificationPanel = new NotificationPanel("notification");
> > notificationPanel.setOutputMarkupId(true);
> > notificationPanel.hideAfter(Duration.seconds(2));
> > add(notificationPanel);
> > add(new MyPanel("users-table-panel"));
> > }
> > }
> >
> > MyPanel code
> >
> > public class MyPanel extends Panel {
> >
> > private NotificationPanel notificationPanel;
> > private BootstrapDefaultDataTable userTable;
> >
> >
> > public UsersTablePanel(String id) {
> > super(id);
> > notificationPanel = new NotificationPanel("notification");
>
>
> This looks the same as in the page. Maybe one should be removed ?!
>
>
> > notificationPanel.setOutputMarkupId(true);
> > notificationPanel.hideAfter(Duration.seconds(2));
> > add(notificationPanel);
> > usersTable();
> > }
> >
> > private void usersTable() {
> > List> columns = new ArrayList<>();
> > columns.add(new PropertyColumn<>(Model.of("First Name"),
> > "firstName", "firstName"));
> > columns.add(new PropertyColumn<>(Model.of("Last Name"),
> > "lastName"));
> > columns.add(new PropertyColumn<>(Model.of("Email Address"),
> > "email"));
> > columns.add(new PropertyColumn<>(Model.of("Username"),
> > "userName"));
> >
> > userTable = new BootstrapDefaultDataTable<>("users-table",
> > columns,
> > new DataProvider(), 20);
> >
>
> Here you create a new DataProvider.
> Does it use some service (Spring, EJB, Guice,...) to load the items ?!
>
>
> > userTable.add(new TableBehavior().hover().bordered());
> > add(userTable);
> > }
> > }
> >
> > MyPageTest Code
> >
> > public class AdminViewPageTest extends WicketApplicationTest {
> >
> > private WicketTester tester;
> >
> > private UsersDataProvider usersDataProvider;
> >
> > private AdminViewPage adminViewPage;
> >
> > @Before
> > public void setUp() throws Exception {
> > super.setUp();
> > usersDataProvider = mock(UsersDataProvider.class);
> > adminViewPage = new AdminViewPage();
> > doNothing().when(usersDataProvider).checkDAO();
> > when(usersDataProvider.size()).thenReturn(0L);
> >
>
> This usersDataProvider is not really used by UsersTablePanel.java because
> it creates its own one (new DataProvider()). So the mocking doesn't really
> help.
>
>
> > tester = getTester();
> > tester.startPage(adminViewPage);
> > }
> >
> > @Test
> > public void renderSuccessfully() throws Exception {
> > tester.assertRenderedPage(AdminViewPage.class);
> > }
> >
> > }
> >
> > Any pointers would be great.
> >
>
> Usually the DataProviders use some service to load the items and this
> service is injected (Spring, CDI, ...).
> Then in your tests you need to provide Dependency Injection context that
> provides mocked service. This way Wicket will used the mock for the tests
> and the real service when running the application.
>
>
> >
> > Thanks
> >
> > David
> >
>


Re: Test Page renders with Nested Panel

2017-02-09 Thread Martin Grigorov
Hi,


On Fri, Feb 10, 2017 at 12:08 AM, David Beer  wrote:

> Hi Guys
>
> I am new to WicketTester and testing pages here. I am also getting back
> into wicket slowly.
>
> I have a page which currently simply adds a panel (more to come), the panel
> contains a DataTable. I am not interested in the content of the table just
> that the page renders with an empty table.
>
> MyPage -> MyPanel -> Adds a DataTable, using dataproviders.
>
> The problem is that when I do tester.startPage(MyPage.class) it tries to
> add the data table and fails unless data provider size is set to 0.
>
> MyPage Code
>
> public class MyPage extends BasePage {
>
> private NotificationPanel notificationPanel;
> private BootstrapDefaultDataTable userTable;
>

This is not used/needed.


>
> public MyPage() {
> notificationPanel = new NotificationPanel("notification");
> notificationPanel.setOutputMarkupId(true);
> notificationPanel.hideAfter(Duration.seconds(2));
> add(notificationPanel);
> add(new MyPanel("users-table-panel"));
> }
> }
>
> MyPanel code
>
> public class MyPanel extends Panel {
>
> private NotificationPanel notificationPanel;
> private BootstrapDefaultDataTable userTable;
>
>
> public UsersTablePanel(String id) {
> super(id);
> notificationPanel = new NotificationPanel("notification");


This looks the same as in the page. Maybe one should be removed ?!


> notificationPanel.setOutputMarkupId(true);
> notificationPanel.hideAfter(Duration.seconds(2));
> add(notificationPanel);
> usersTable();
> }
>
> private void usersTable() {
> List> columns = new ArrayList<>();
> columns.add(new PropertyColumn<>(Model.of("First Name"),
> "firstName", "firstName"));
> columns.add(new PropertyColumn<>(Model.of("Last Name"),
> "lastName"));
> columns.add(new PropertyColumn<>(Model.of("Email Address"),
> "email"));
> columns.add(new PropertyColumn<>(Model.of("Username"),
> "userName"));
>
> userTable = new BootstrapDefaultDataTable<>("users-table",
> columns,
> new DataProvider(), 20);
>

Here you create a new DataProvider.
Does it use some service (Spring, EJB, Guice,...) to load the items ?!


> userTable.add(new TableBehavior().hover().bordered());
> add(userTable);
> }
> }
>
> MyPageTest Code
>
> public class AdminViewPageTest extends WicketApplicationTest {
>
> private WicketTester tester;
>
> private UsersDataProvider usersDataProvider;
>
> private AdminViewPage adminViewPage;
>
> @Before
> public void setUp() throws Exception {
> super.setUp();
> usersDataProvider = mock(UsersDataProvider.class);
> adminViewPage = new AdminViewPage();
> doNothing().when(usersDataProvider).checkDAO();
> when(usersDataProvider.size()).thenReturn(0L);
>

This usersDataProvider is not really used by UsersTablePanel.java because
it creates its own one (new DataProvider()). So the mocking doesn't really
help.


> tester = getTester();
> tester.startPage(adminViewPage);
> }
>
> @Test
> public void renderSuccessfully() throws Exception {
> tester.assertRenderedPage(AdminViewPage.class);
> }
>
> }
>
> Any pointers would be great.
>

Usually the DataProviders use some service to load the items and this
service is injected (Spring, CDI, ...).
Then in your tests you need to provide Dependency Injection context that
provides mocked service. This way Wicket will used the mock for the tests
and the real service when running the application.


>
> Thanks
>
> David
>


Re: Test with IMarkupResourceStreamProvider and using IMarkupResourceStreamProvider for input

2016-03-30 Thread Martin Grigorov
Hi,

On Wed, Mar 30, 2016 at 11:08 AM, andre seame  wrote:

> Hello,
>
> 1°) According the advices of this mailing list, I try to use
> IMarkupResourceStreamProvider as described in
>
> https://ci.apache.org/projects/wicket/guide/7.x/guide/single.html#advanced_5
>
> When using something like:
>
> public class AutoMarkupGenPanel extends Panel implements
> IMarkupResourceStreamProvider
>  {
> public AutoMarkupGenPanel(String id, IModel model)
>   {
> super(id, model);
> }
>
> @Override
> public IResourceStream getMarkupResourceStream(MarkupContainer
> container,
> Class containerClass)
>{
> String markup = "Panel markup";
> StringResourceStream resourceStream = new
> StringResourceStream(markup);
> return resourceStream;
> }
> }
> I get :
> Last cause: Expected to find  in associated markup file.
> Markup: org.apache.wicket.util.resource.StringResourceStream@761796f3
> :
>
> Misunderstanding or bug in documentation?
>

Bug in the documentation.


>
> 2°) If I change the markup to: String markup = " my dynamic
> code ";
> It is OK.
>
> If I declare class AutoMarkupGenPanel extends Panel as class
> AutoMarkupGenPanel extends Label, it does not work. It seems just as
> getMarkupResourceStream is not called.
>

Label is not MarkupContainer, it is a WebComponent. So it depends on its
parent to provide its markup.
It is a bit confusing, I see, but this is how it works.


>
>
> 3°) I want to have is :  />";
>
> It fails:
>
> Root cause:
>
> Unable to find component with id 'dateTo' in [InputText [Component id =
> after]]
> Expected:
> 'filterForm:tableWithFilterForm:topToolbars:toolbars:3:headers:6:header:panel:after:dateTo'.
> Found with similar names: 'filterForm:dateTo'
>

It seems you add the Panel directly to the "filterForm", while you should
add it much deeper in its hierarchy.


>  MarkupStream: [markup =
> org.apache.wicket.util.resource.StringResourceStream@3055f58b:
> 
> , index = 1,
> current =  '' (line 0, column 0)]
>  at
> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526)
>
> Is it possible to use IMarkupResourceStreamProvider  in this use case ?
>
>
> Thanks for any idea or pointers.
>
> PHL.
>
>


Re: Test based on AbstractWicketTest fails with "No RequestCycle is currently set"

2013-09-09 Thread Martin Dietze
On Mon, September 09, 2013, Martin Dietze wrote:

> No, nothing of that kind. It's just a helper to make sure noone
> uses Ajax on components which are added to the markup as
> "..".

OK, that one is solved, too. After replacing the Application
used in this test by the one created to solve the other problem
(related to the resources for JS and CSS), this problem
disappeared. Obviously the problem I saw in the stack trace 
was misleading here.

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
Ed is the standard text editor.

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



Re: Test based on AbstractWicketTest fails with "No RequestCycle is currently set"

2013-09-09 Thread Martin Dietze
On Sat, September 07, 2013, Martin Grigorov wrote:

> > com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48)
> >
> 
> What is this doing ?
> Does it start a new thread by chance ?
> Or doing something like: ThreadContext.detach() /
> ThreadContext.setRequestCycle(null)

No, nothing of that kind. It's just a helper to make sure noone
uses Ajax on components which are added to the markup as
"..".
The code goes like this:

| public class WicketContainerChecker implements 
IComponentInstantiationListener {
| private static final Behavior BEHAVIOR = new Behavior() {
| private static final long serialVersionUID = 1L;
| 
| @Override
| public void onComponentTag( final Component component, final 
ComponentTag tag ) {
| if ( tag instanceof WicketTag && "container".equals( 
tag.getName() ) && component.getOutputMarkupId() ) {
| throw new IllegalStateException( "Component " + component + " 
requests a markup id (" + component.getMarkupId() + ") but is attached to " + 
tag
| + "! This will not work in deployment mode!" );
| }
| }
| };
| 
| @Override
| public void onInstantiation( Component component ) {
| component.add( BEHAVIOR );
| }
| }

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
WE ARE THE BORG - RESISTANCE IS VOLTAGE DIVIDED BY CURRENT!

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



Re: Test based on AbstractWicketTest fails with "No RequestCycle is currently set"

2013-09-07 Thread Martin Grigorov
On Fri, Sep 6, 2013 at 7:41 PM, Martin Dietze  wrote:

> On Fri, September 06, 2013, Martin Grigorov wrote:
>
> > 2. #testAddingAndSwitchingFields
> >
> > you look at the wrong test
> > we cannot help you when we have the wrong source given
>
> Yes, sorry, I picked the wrong stacktrace, however they're all
> identical anyway. The method 'testAddingAndSwitchingFields'
> starts the same way as 'testRender':
>
> |public void testAddingAndSwitchingFields( final int numberOfFields,
> final List switchButtonPaths, final List expectedFieldOrder
> ) {
> |final FeedbackFormSpec formSpec =
> FeedbackFormSpecTestFactory.createEmpty();
> |this.tester.startPage( new FeedbackFormSpecEditorTestPage(
> formSpec ) );
> |// ...
>
> I.e., the stacktrace below is exactly the same from the moment
> I instanciate the test page, and the super constructor is
> called.
>
> Here's the stacktrace again:
>
> org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!
> org.apache.wicket.Component.getRequest(Component.java:1803)
> org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318)
> org.apache.wicket.Page.dirty(Page.java:249)
> org.apache.wicket.Page.componentStateChanging(Page.java:926)
> org.apache.wicket.Component.addStateChange(Component.java:3527)
> org.apache.wicket.Behaviors.add(Behaviors.java:55)
> org.apache.wicket.Component.add(Component.java:4511)
>
> com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48)
>

What is this doing ?
Does it start a new thread by chance ?
Or doing something like: ThreadContext.detach() /
ThreadContext.setRequestCycle(null)


>
> org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38)
>
> org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
>
> org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
>
> org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33)
> org.apache.wicket.Component.(Component.java:683)
> org.apache.wicket.MarkupContainer.(MarkupContainer.java:121)
> org.apache.wicket.Page.(Page.java:168)
> org.apache.wicket.Page.(Page.java:132)
> org.apache.wicket.markup.html.WebPage.(WebPage.java:76)
>
> com.mycompany.ui.components.types.FeedbackFormSpecEditorTestPage.(FeedbackFormSpecEditorTestPage.java:38)
>
> com.mycompany.ui.components.types.FeedbackFormSpecEditorTest.testAddingAndSwitchingFields(FeedbackFormSpecEditorTest.java:80)
>
> M'bert
>
> --
> --- / http://herbert.the-little-red-haired-girl.org /
> -
> =+=
> I am not in a hurry. I prefer to cross the town.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Test based on AbstractWicketTest fails with "No RequestCycle is currently set"

2013-09-06 Thread Martin Dietze
On Fri, September 06, 2013, Martin Grigorov wrote:

> 2. #testAddingAndSwitchingFields
> 
> you look at the wrong test
> we cannot help you when we have the wrong source given

Yes, sorry, I picked the wrong stacktrace, however they're all
identical anyway. The method 'testAddingAndSwitchingFields'
starts the same way as 'testRender':

|public void testAddingAndSwitchingFields( final int numberOfFields, final 
List switchButtonPaths, final List expectedFieldOrder ) {
|final FeedbackFormSpec formSpec = 
FeedbackFormSpecTestFactory.createEmpty();
|this.tester.startPage( new FeedbackFormSpecEditorTestPage( formSpec ) 
);
|// ...

I.e., the stacktrace below is exactly the same from the moment 
I instanciate the test page, and the super constructor is
called.

Here's the stacktrace again:

org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!
org.apache.wicket.Component.getRequest(Component.java:1803)
org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318)
org.apache.wicket.Page.dirty(Page.java:249)
org.apache.wicket.Page.componentStateChanging(Page.java:926)
org.apache.wicket.Component.addStateChange(Component.java:3527)
org.apache.wicket.Behaviors.add(Behaviors.java:55)
org.apache.wicket.Component.add(Component.java:4511)
com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48)
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38)
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33)
org.apache.wicket.Component.(Component.java:683)
org.apache.wicket.MarkupContainer.(MarkupContainer.java:121)
org.apache.wicket.Page.(Page.java:168)
org.apache.wicket.Page.(Page.java:132)
org.apache.wicket.markup.html.WebPage.(WebPage.java:76)
com.mycompany.ui.components.types.FeedbackFormSpecEditorTestPage.(FeedbackFormSpecEditorTestPage.java:38)
com.mycompany.ui.components.types.FeedbackFormSpecEditorTest.testAddingAndSwitchingFields(FeedbackFormSpecEditorTest.java:80)

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
I am not in a hurry. I prefer to cross the town.

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



Re: Test based on AbstractWicketTest fails with "No RequestCycle is currently set"

2013-09-06 Thread Martin Grigorov
Hi,


On Fri, Sep 6, 2013 at 3:36 PM, Martin Dietze  wrote:

> I am currently trying to repair some old tests (which I did not
> even write myself) based on AbstractWicketTest and WicketTester.
> At the moment all tests derived from AbstractWicketTest or using
> TestNGWicketTester fail with some exception inside Wicket.
>
> Since I am rather unfamiliar with the wicket test infrastructure,
> I'd like to ask here, if the stuff below rings any bell with
> anyone of you? Did I forget something fundamental? A missing
> RequestCycle seems rather fundamental to me, i.e. I'd expect
> the testing infrastructure to take care that there is one, or
> am I mistaken here?
>
> The one based on AbstractWicketTest basically tries to render a
> page and check for some exception etc., it's code is rather
> simplish:
>
> |public void testRender( final FeedbackFormSpec formSpec ) {
>

1. #testRender


> |this.tester.startPage( new FeedbackFormSpecEditorTestPage(
> formSpec ) );
> |this.tester.assertRenderedPage(
> FeedbackFormSpecEditorTestPage.class );
> |this.tester.dumpPage();
> |}
>
> I get this stacktrace:
>
> org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!
> org.apache.wicket.Component.getRequest(Component.java:1803)
> org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318)
> org.apache.wicket.Page.dirty(Page.java:249)
> org.apache.wicket.Page.componentStateChanging(Page.java:926)
> org.apache.wicket.Component.addStateChange(Component.java:3527)
> org.apache.wicket.Behaviors.add(Behaviors.java:55)
> org.apache.wicket.Component.add(Component.java:4511)
>
> com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48)
>
> org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38)
>
> org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
>
> org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
>
> org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33)
> org.apache.wicket.Component.(Component.java:683)
> org.apache.wicket.MarkupContainer.(MarkupContainer.java:121)
> org.apache.wicket.Page.(Page.java:168)
> org.apache.wicket.Page.(Page.java:132)
> org.apache.wicket.markup.html.WebPage.(WebPage.java:76)
>
> com.mycompany.ui.components.types.FeedbackFormSpecEditorTestPage.(FeedbackFormSpecEditorTestPage.java:38)
>
> com.mycompany.ui.components.types.FeedbackFormSpecEditorTest.testAddingAndSwitchingFields(FeedbackFormSpecEditorTest.java:80)
>

2. #testAddingAndSwitchingFields

you look at the wrong test
we cannot help you when we have the wrong source given


> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:597)
>
> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
> org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
> org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
> org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
>
> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
> org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
> org.testng.TestRunner.privateRun(TestRunner.java:767)
> org.testng.TestRunner.run(TestRunner.java:617)
> org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
> org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
> org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
> org.testng.SuiteRunner.run(SuiteRunner.java:240)
> org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
> org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
> org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
> org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
> org.testng.TestNG.run(TestNG.java:1031)
> org.testng.TestNG.privateMain(TestNG.java:1338)
> org.testng.TestNG.main(TestNG.java:1307)
>
> Cheers,
>
> M'bert
>
> --
> --- / http://herbert.the-little-red-haired-girl.org /
> -
> =+=
> I now declare this bizarre open!
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Test Select2Choice with WicketTester

2013-02-14 Thread Ulf Gitschthaler
Thanks for your answer, I'll try this out today.
 
On Feb 14, 2013, at 11:53 AM, Ernesto Reinaldo Barreiro  
wrote:

> Hi,
> 
> On Thu, Feb 14, 2013 at 10:12 AM, Ulf Gitschthaler <
> ulf.gitschtha...@comsysto.com> wrote:
> 
>> In most cases I want to simulate a user typing something in and selecting
>> one of the offered choices. Afterwards I'd also like to submit the form and
>> check if the model object of the Select2Choice field contains the right
>> value, respectively I want to be able to submit the form if a Select2Choice
>> field is a required field.
>> 
> 
> 
> Mind that  this component do is:
> 
> 1- It implements IResourceListener to be able to stream back JSON like:
> 
> {"results":[{"id":2,"text":"Air Show"},{"id":180,"text":"American
> Football"},{"id":4,"text":"Anniversary"
> },{"id":6,"text":"Aquarium"},{"id":116,"text":"Babies"},{"id":8,"text":"Bar"},{"id":10,"text":"Baseball"},{"id":12,"text":"Basketball"},{"id":14,"text":"Beach
> Volleyball"},{"id":16,"text":"Beergarden"},{"id"
> :18,"text":"Billard"},{"id":22,"text":"Botellón"},{"id":20,"text":"Bowling"},{"id":24,"text":"Bullfight"},{"id":36,"text":"Cafeteria"},{"id":26,"text":"Casino"},{"id":28,"text":"Child
> Museum"},{"id":176,"text"
> :"Childrem"},{"id":30,"text":"Cinema"},{"id":32,"text":"Circus"},{"id":34,"text":"Climbing"},{"id":38,"text":"Comedy
> Club"},{"id":110,"text":"Concert"},{"id":40,"text":"Cricket"},{"id":42,"text":"DanceClass"},{"id":44,"text":"Dancing"},{"id":46,"text":"Daycare"},{"id":48,"text":"Deep
> Sea Fishing"},{"id"
> :50,"text":"Dinopark"},{"id":52,"text":"Diving"},{"id":54,"text":"Fair"},{"id":206,"text":"Family"},
> {"id":208,"text":"Female"},{"id":56,"text":"Fireworks"},{"id":58,"text":"Fishing"},{"id":182,"text":"Forest"
> },{"id":60,"text":"Gay-Female"},{"id":62,"text":"Gay-Male"},{"id":64,"text":"Golfing"},{"id":66,"text":"Handball"},{"id":68,"text":"Hang
> Gliding"},{"id":70,"text":"Hiking"},{"id":108,"text":"Hiphop
> Concert"},{"id":72,"text":"Historical
> Museum"},{"id":74,"text":"Horse
> Riding"},{"id":76,"text":"Hunting"},{"id":78,"text":"Jazz
> Club"},{"id":80,"text":"Kayaking"},{"id":82,"text":"Kitesurfing"},{"id":84,"text":"Library"},{"id":184,"text":"Love"},{"id":86,"text":"Magic
> Show"},{"id":178,"text":"Male"},{"id":88,"text":"Mountainbiking"
> },{"id":90,"text":"Museum-Archeological"},{"id":92,"text":"Museum-Art"},{"id":94,"text":"Museum-Crafts"
> },{"id":96,"text":"Museum-Industry"},{"id":98,"text":"Museum-Naval"},{"id":100,"text":"Museum-Science"
> },{"id":102,"text":"Museum-War"},{"id":104,"text":"Music-choral"},{"id":106,"text":"Music-Classical"
> },{"id":114,"text":"Nanny"},{"id":118,"text":"Paintball"},{"id":120,"text":"Paragliding"},{"id":122,"text"
> :"Parasailing"},{"id":124,"text":"Party"},{"id":126,"text":"Planetarium"},{"id":128,"text":"Playground"},{"id":130,"text":"Poker"},{"id":132,"text":"Public
> Art"},{"id":112,"text":"Rock Concert"},{"id":134,"text":"Ropes
> course"},{"id":136,"text":"Row Boat"},{"id":138,"text":"Rugby
> field"},{"id":140,"text":"Sailing"},{"id":142,"text":"Scout
> group"},{"id":144,"text":"Scuba
> Diving"},{"id":146,"text":"Snorkeling"},{"id":148,"text":"soccer"},{"id":150,"text":"Speed
> riding"},{"id":152,"text":"spelunking"},{"id":154,"text":"Squash"},{"id":156,"text":"Strip
> Club"},{"id":160,"text":"Surf
> Paddle"},{"id":158,"text":"Surfing"},{"id":162,"text":"Swimming"},{"id":166,"text":"Table
> Tennis"},{"id":164,"text":"Tea
> House"},{"id":168,"text":"Tennis"},{"id":170,"text":"Terrace"},{"id":172,"text":"Theater"},{"id":174,"text":"Theme
> Park"},{"id":186,"text":"Video
> Games"},{"id":188,"text":"Volleyball"},{"id":190,"text":"Walking
> Tour"},{"id":194,"text":"Water Park"},{"id":196,"text":"Water
> Skiing"},{"id":192,"text":"Watercraft"},{"id":198,"text":"Windsurfing"},{"id":200,"text":"Wine
> bar"},{"id":202,"text":"Wine Tasting"},{"id":204,"text":"Zoo"}],"more":null}
> 
> For this it uses ChoiceProvider. So, you could test user typing directly
> using ChoiceProvider or for instance
> 
> https://github.com/reiern70/wicket-select2/blob/master/wicket-select2/src/main/java/com/vaynberg/wicket/select2/AbstractSelect2Choice.java#L235
> 
> to test produced JSON. (This is not part of offcial select2 but it is a
> pending pull request). Maybe I can factor out this a bit more and add a
> method that receives int page and String term so that testing is even
> easier.
> 
> 2-On client side widget uses a hidden input to represent selections as
> 
>  value="2,4" style="display: none;">
> 
> Those "selected" values are initially  assigned via JSON when widget is
> constructed.  See method
> 
> https://github.com/reiern70/wicket-select2/blob/master/wicket-select2/src/main/java/com/vaynberg/wicket/select2/Select2MultiChoice.java#L114
> 
> So one way... to simulate this might be as in
> 
> TestMultiSelectPage testPage =tester.startPage(TestMultiSelectPage.class);
> tester.assertRenderedPage(TestMultiSelectPage.class);
> tester.getRequest().setParameter("countri

Re: Test Select2Choice with WicketTester

2013-02-14 Thread Ulf Gitschthaler
In most cases I want to simulate a user typing something in and selecting one 
of the offered choices. Afterwards I'd also like to submit the form and check 
if the model object of the Select2Choice field contains the right value, 
respectively I want to be able to submit the form if a Select2Choice field is a 
required field. 

Up to now it always failes because the model object is null. Just a simple 
example test case would be nice that shows how to test Select2Choice fields in 
a form. 

 

On Feb 13, 2013, at 9:41 PM, Ernesto Reinaldo Barreiro  
wrote:

> What exactly do you want to test? E.g. simulate user typing on field?
> 
> On Wed, Feb 13, 2013 at 8:25 PM, Stephen Walsh <
> step...@connectwithawalsh.com> wrote:
> 
>> I may have the same question. How do you go about testing a select2 box
>> with wicket tester?
>> 
>> 
>> Additionally, is there any documentation on how to use wicket tester?
>> —
>> Stephen Walsh
>> 
>> On Wed, Feb 13, 2013 at 6:08 AM, Sven Meier  wrote:
>> 
>>> What's your problem with Select2Choice and WicketTester?
>>> Sven
>>> On 02/13/2013 10:59 AM, Ulf Gitschthaler wrote:
 Hi,
 
 We currently use Select2Choice (http://tinyurl.com/ab7hm8g) on almost
>> every form on our website. Regretfully we didn't find a proper way to test
>> it with WicketTester so far.
 
 Thus, I'd like to know if anybody figured out how to include
>> Select2Choices in unit tests that use WicketTester. I didn't find anything
>> useful on the web so far, even the select2 github repo does not contain any
>> sample test.
 
 Thanks for your answers,
 Ulf
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
> 
> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ 


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



Re: Test project

2012-11-05 Thread Martin Grigorov
Use https://groups.google.com/forum/?fromgroups#!forum/atmosphere-framework


On Mon, Nov 5, 2012 at 1:10 PM, Mats  wrote:

> I have posted this in the Atmosphere mailing list
> http://atmosphere-users-mailling-list.2493822.n2.nabble.com/
>   . But this
> mail list seems pretty dead. Almost no views an no replys.
>
> I have now also tried to deploy on tomcat (instead of GlassFish) with the
> same result. No error and a blank page is shown in the browser with the
> following source contents. So the Wicket machenery is never called.
>
> 
> 
>  http-equiv=Content-Type>
> 
>
> It's really sad, but I have to give up Wicket now and start to look for
> some
> other framework that we can use. We need the possibility to push out
> information to the user (Atmosphere). The goal with this was to create a
> new
> user interface for DeLavals milking robots and would have fit nicly into
> our
> java framework :-(
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Test-project-tp4653437p4653613.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com 


Re: Test project

2012-10-29 Thread Martin Grigorov
Hi,

Better ask this question in Atmosphere mailing list.
They know more about the internals of how Jetty/Tomcat/GF/... should work.

On Mon, Oct 29, 2012 at 12:52 PM, Mats  wrote:
> Hi all,
>
> There is no problen to open this Maven project in NetBeans and use the start
> class to launch it on the bundled jetty server...
> The quickstart:  https://github.com/papegaaij/wicket-atmosphere-quickstart
> 
>
> I have created a simple NetBeans Web project with the same source files. Can
> someone open it and try to run it. The application is deployed on the
> GlassFish server without any errors, but the app is not started correct.
> What is wrong?
> My project:  https://www.dropbox.com/s/2si4vvbmxo4fqxg/TestUI.zip
> 
>
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Test-project-tp4653437.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: test pages with selenuim

2011-04-17 Thread Per Newgro

Am 17.04.2011 19:54, schrieb shetc:

I use WicketTester on its own now. Will it help me to also use Selenium to
test Wicket as well?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/test-pages-with-selenuim-tp3452652p3455847.html
Sent from the Users forum mailing list archive at Nabble.com.

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


With selenium you get more "browser-like" testing. It is a library 
executing browser tasks by an action script.
With wicket tester you do a more "component-oriented" testing. So 
wickettester is more usable for unit-testing

and selenium for acceptance / integration testing.

The decision if you have to use selenium in your tests to depends on 
your development process. If you do a more
behavior - driven - developement process you can simply define your 
"action script" and run it in selenium.
So you will get a big picture (What else has to  be done to achieve my 
task / goal).
If you like it more to do it unit-test driven then maybe you have so 
many tests that adding selenium is not

nessecary.

Hth
Per

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



Re: test pages with selenuim

2011-04-17 Thread shetc
I use WicketTester on its own now. Will it help me to also use Selenium to
test Wicket as well?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/test-pages-with-selenuim-tp3452652p3455847.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: test pages with selenuim

2011-04-17 Thread Per Newgro

Am 16.04.2011 22:11, schrieb shetc:

What is advantage of Wicket Page Test over WicketTester?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/test-pages-with-selenuim-tp3452652p3454541.html
Sent from the Users forum mailing list archive at Nabble.com.

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


As he stated in his heading - he was looking for integrating selenium 
and wicket testing.
This library could help on that task. Or did i miss something in your 
question?


Cheers
Per

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



Re: test pages with selenuim

2011-04-16 Thread shetc
What is advantage of Wicket Page Test over WicketTester?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/test-pages-with-selenuim-tp3452652p3454541.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: test pages with selenuim

2011-04-16 Thread Per Newgro

Am 15.04.2011 20:04, schrieb fachhoch:

I am trying to test my  wicket application  using  selenuim , I had no
success , did anybody try ?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/test-pages-with-selenuim-tp3452652p3452652.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Did you know
http://wicketpagetest.sourceforge.net/

Cheers
Per

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



Re: test pages with selenuim

2011-04-15 Thread YK
Do you know that wicket provides a page tester ?

If not take a look at 
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/util/tester/WicketTester.html
WicketTester 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/test-pages-with-selenuim-tp3452652p3452716.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: test pages with selenuim

2011-04-15 Thread William Sargent

On Apr 15, 2011, at 11:04 AM, fachhoch wrote:

> I am trying to test my  wicket application  using  selenuim , I had no
> success , did anybody try ?
> 

Yeah.  I use Selenium with a ruby solution, just because that's how I was 
introduced to it.  

http://tersesystems.com/2010/10/05/simplest-possible-acceptance-test

If you want to integrate Selenium tests into a continous integration server 
running on Linux, you'll probably want the "headless" mode enabled, which is 
typically done with Xvfb.

http://blog.kabisa.nl/2010/05/24/headless-cucumbers-and-capybaras-with-selenium-and-hudson/


Will.

Re: TEST

2011-03-01 Thread Zoltán Nagy
Thanks! I turn off formating.

2011/3/1 Martijn Dashorst 
>
> HTML email raises the score pretty much.
>
> Martijn
>

--
Zoltán Nagy

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



Re: TEST

2011-03-01 Thread Martijn Dashorst
HTML email raises the score pretty much.

Martijn

On Tue, Mar 1, 2011 at 1:45 PM, Zoltán Nagy  wrote:
> Hi!
>
> I've received this message when I tried to answer a question:
>
> Delivery to the following recipient failed permanently:
>>
>>     users@wicket.apache.org
>>
>> Technical details of permanent failure:
>> Google tried to deliver your message, but it was rejected by the recipient
>> domain. We recommend contacting the other email provider for further
>> information about the cause of this error. The error that the other server
>> returned was: 552 552 spam score (5.0) exceeded threshold
>> (FREEMAIL_ENVFROM_END_DIGIT,
>> FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX
>> (state 18).
>>
>
>
> It seems to be something serious error with the mailing server if I could
> trigger the spam filter only with 2 sentences.
>
> --
> Zoltán Nagy
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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



Re: Test

2011-02-25 Thread Jim Goodwin

In my case it turned out that (A) I was pasting in a snippet of XML;
(B) my mail client (Thunderbird ) decided therefore to send the
whole message as HTML; (C) apache's SpamAssassin has rules about
HTML and decided it was spam.

The fix (in TBird) was to edit the Contact record for 
users@wicket.apache.org.
There is a preference for plaintext/HTML. I had as usual left it at the 
default,

which lets TBird guess. Setting it to plaintext solved the problem.

(FWIW: Along the way I think I figured out also that the SpamAssassin rules
that Apache is using also award penalty points for email addresses that end
in digits, like mine or yours (Josh), as well as free email services like
gmail, and even my non-free ISP comcast, and email addresses with no
real username in brackets. It just didn't love me. But getting rid of the
HTML lowered my score enough to get through.)


On 2/25/2011 3:44 AM, Josh Kamau wrote:

I have been having the same problem for the last 2 weeks. Every time i send
a mail or a reply, i get a mail delivery failure.  Today it however seemed
to be working. I have been able to send a reply. If this gets through, i
will conclude that the issue has been resolved or resolved its self.

Josh.

On Fri, Feb 25, 2011 at 12:49 AM, Jim Goodwin  wrote:


Everything I send to this list is being bounced by a  spam-filter
at the list-serv end. Just testing a very simple text-only message.
Very sorry if this actually goes through, nothing else would


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





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



Re: Test

2011-02-25 Thread Josh Kamau
I have been having the same problem for the last 2 weeks. Every time i send
a mail or a reply, i get a mail delivery failure.  Today it however seemed
to be working. I have been able to send a reply. If this gets through, i
will conclude that the issue has been resolved or resolved its self.

Josh.

On Fri, Feb 25, 2011 at 12:49 AM, Jim Goodwin  wrote:

> Everything I send to this list is being bounced by a  spam-filter
> at the list-serv end. Just testing a very simple text-only message.
> Very sorry if this actually goes through, nothing else would
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Test

2011-02-24 Thread Jeremy Thomerson
Oh, it worked!  :)

On Thu, Feb 24, 2011 at 3:49 PM, Jim Goodwin  wrote:

> Everything I send to this list is being bounced by a  spam-filter
> at the list-serv end. Just testing a very simple text-only message.
> Very sorry if this actually goes through, nothing else would
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


Re: Test CheckBoxMultipleChoice or CheckGroup

2010-12-15 Thread Anton Bessonov

Thanks, I will try!


Use getters:

https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html

   



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



Re: Test CheckBoxMultipleChoice or CheckGroup

2010-12-15 Thread Martin Makundi
Use getters:

https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html

2010/12/15 Anton Bessonov :
> Hello list,
>
> I'm trying to set checkboxes with junit but without significant success. My
> trouble is to find checkboxes. I've not found any way to access it if I use
> CheckBoxMultipleChoice. With CheckGroup I get access with Visitor
>
> tester.getLastRenderedPage().visitChildren(Check.class, new
>            IVisitor() {
>                public Object component(Component component) {
>                    if(component.getDefaultModelObject().equals("TestLabel"))
> [...]
>
> but it's very ugly way. Any suggestions?
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Grotzke
Great, it's working now. I didn't use exactly the same formTester which
was used for selecting the second dropdown before, that was the reason
why it didn't work.

Thanx for your help,
cheers,
Martin


On Tue, 2009-12-01 at 16:03 +0200, Martin Makundi wrote:
> > However, I already had tested this and it doesn't make any difference -
> > the test still fails with the same error.
> 
> I am not sure what you are doing. Do like this
> 
> {
>   // Operation 1
>   FormTester f1 = tester.newFormTester (...);
>   f1.setValue
>   tester.execute ...
> }
> 
> {
>   // Operation 2
>   FormTester f1 = tester.newFormTester (...);
>   f1.setValue
>   f1.submit
> }
> 
> 
> **
> Martin
> 
> >
> > Thanx && cheers,
> > Martin
> >
> >
> >>
> >> **
> >> Martin
> >>
> >> 2009/12/1 Martin Grotzke :
> >> > On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
> >> >> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 
> >> >> > which
> >> >> > shows the test?
> >> >>
> >> >> Ofcourse I didn't look ;)
> >> >>
> >> >> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED 
> >> >> ONLY ONCE!
> >> >>
> >> >> If you want to use it another time, you need to call newFormTester 
> >> >> again.
> >> > Thanx, this fixed the issue!
> >> >
> >> > Now I extended the test to make sure that the previously selected make
> >> > and model are still selected after the final submit - and this fails
> >> > with the second drop down (the model): this returns null from
> >> > dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
> >> > shows these changes.
> >> >
> >> > Is there another thing that needs to be changed in the test?
> >> >
> >> > Cheers,
> >> > Martin
> >> >
> >> >
> >> >>
> >> >> **
> >> >> Martin
> >> >> >
> >> >> >
> >> >> >>
> >> >> >> **
> >> >> >> Martin
> >> >> >>
> >> >> >> >
> >> >> >> > This issue was already reported some time ago without a final 
> >> >> >> > result:
> >> >> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >> >> >> >
> >> >> >> >
> >> >> >> > I created an example project that shows this issue:
> >> >> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >> >> >> >
> >> >> >> > This is the short link to the failing test case (on github): 
> >> >> >> > http://is.gd/58mq3
> >> >> >> > This is the tested page class: http://is.gd/58mDm
> >> >> >> >
> >> >> >> > I'm using wicket 1.4.3.
> >> >> >> >
> >> >> >> > Is there any error in the test? Can I do anything to work around 
> >> >> >> > this,
> >> >> >> > or is it a bug?
> >> >> >> >
> >> >> >> > Thanx && cheers,
> >> >> >> > Martin
> >> >> >> >
> >> >> >> > --
> >> >> >> > Martin Grotzke
> >> >> >> > http://www.javakaffee.de/blog/
> >> >> >> >
> >> >> >>
> >> >> >> -
> >> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >> >>
> >> >> > --
> >> >> > Martin Grotzke
> >> >> > http://www.javakaffee.de/blog/
> >> >> >
> >> >>
> >> >> -
> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >>
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


signature.asc
Description: This is a digitally signed message part


Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Makundi
> However, I already had tested this and it doesn't make any difference -
> the test still fails with the same error.

I am not sure what you are doing. Do like this

{
  // Operation 1
  FormTester f1 = tester.newFormTester (...);
  f1.setValue
  tester.execute ...
}

{
  // Operation 2
  FormTester f1 = tester.newFormTester (...);
  f1.setValue
  f1.submit
}


**
Martin

>
> Thanx && cheers,
> Martin
>
>
>>
>> **
>> Martin
>>
>> 2009/12/1 Martin Grotzke :
>> > On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
>> >> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
>> >> > shows the test?
>> >>
>> >> Ofcourse I didn't look ;)
>> >>
>> >> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED 
>> >> ONLY ONCE!
>> >>
>> >> If you want to use it another time, you need to call newFormTester again.
>> > Thanx, this fixed the issue!
>> >
>> > Now I extended the test to make sure that the previously selected make
>> > and model are still selected after the final submit - and this fails
>> > with the second drop down (the model): this returns null from
>> > dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
>> > shows these changes.
>> >
>> > Is there another thing that needs to be changed in the test?
>> >
>> > Cheers,
>> > Martin
>> >
>> >
>> >>
>> >> **
>> >> Martin
>> >> >
>> >> >
>> >> >>
>> >> >> **
>> >> >> Martin
>> >> >>
>> >> >> >
>> >> >> > This issue was already reported some time ago without a final result:
>> >> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>> >> >> >
>> >> >> >
>> >> >> > I created an example project that shows this issue:
>> >> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>> >> >> >
>> >> >> > This is the short link to the failing test case (on github): 
>> >> >> > http://is.gd/58mq3
>> >> >> > This is the tested page class: http://is.gd/58mDm
>> >> >> >
>> >> >> > I'm using wicket 1.4.3.
>> >> >> >
>> >> >> > Is there any error in the test? Can I do anything to work around 
>> >> >> > this,
>> >> >> > or is it a bug?
>> >> >> >
>> >> >> > Thanx && cheers,
>> >> >> > Martin
>> >> >> >
>> >> >> > --
>> >> >> > Martin Grotzke
>> >> >> > http://www.javakaffee.de/blog/
>> >> >> >
>> >> >>
>> >> >> -
>> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >> >>
>> >> > --
>> >> > Martin Grotzke
>> >> > http://www.javakaffee.de/blog/
>> >> >
>> >>
>> >> -
>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>

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



Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Grotzke
On Tue, 2009-12-01 at 15:46 +0200, Martin Makundi wrote:
> Line 63 you are re-using the same formTester. Cannot work.
Wow, really fast! :)

However, I already had tested this and it doesn't make any difference -
the test still fails with the same error.

FWIW, I updated and pushed the test so that you can see what I actually
changed.

Thanx && cheers,
Martin


> 
> **
> Martin
> 
> 2009/12/1 Martin Grotzke :
> > On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
> >> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> >> > shows the test?
> >>
> >> Ofcourse I didn't look ;)
> >>
> >> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY 
> >> ONCE!
> >>
> >> If you want to use it another time, you need to call newFormTester again.
> > Thanx, this fixed the issue!
> >
> > Now I extended the test to make sure that the previously selected make
> > and model are still selected after the final submit - and this fails
> > with the second drop down (the model): this returns null from
> > dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
> > shows these changes.
> >
> > Is there another thing that needs to be changed in the test?
> >
> > Cheers,
> > Martin
> >
> >
> >>
> >> **
> >> Martin
> >> >
> >> >
> >> >>
> >> >> **
> >> >> Martin
> >> >>
> >> >> >
> >> >> > This issue was already reported some time ago without a final result:
> >> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >> >> >
> >> >> >
> >> >> > I created an example project that shows this issue:
> >> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >> >> >
> >> >> > This is the short link to the failing test case (on github): 
> >> >> > http://is.gd/58mq3
> >> >> > This is the tested page class: http://is.gd/58mDm
> >> >> >
> >> >> > I'm using wicket 1.4.3.
> >> >> >
> >> >> > Is there any error in the test? Can I do anything to work around this,
> >> >> > or is it a bug?
> >> >> >
> >> >> > Thanx && cheers,
> >> >> > Martin
> >> >> >
> >> >> > --
> >> >> > Martin Grotzke
> >> >> > http://www.javakaffee.de/blog/
> >> >> >
> >> >>
> >> >> -
> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >>
> >> > --
> >> > Martin Grotzke
> >> > http://www.javakaffee.de/blog/
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


signature.asc
Description: This is a digitally signed message part


Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Makundi
Line 63 you are re-using the same formTester. Cannot work.

**
Martin

2009/12/1 Martin Grotzke :
> On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
>> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
>> > shows the test?
>>
>> Ofcourse I didn't look ;)
>>
>> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY 
>> ONCE!
>>
>> If you want to use it another time, you need to call newFormTester again.
> Thanx, this fixed the issue!
>
> Now I extended the test to make sure that the previously selected make
> and model are still selected after the final submit - and this fails
> with the second drop down (the model): this returns null from
> dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
> shows these changes.
>
> Is there another thing that needs to be changed in the test?
>
> Cheers,
> Martin
>
>
>>
>> **
>> Martin
>> >
>> >
>> >>
>> >> **
>> >> Martin
>> >>
>> >> >
>> >> > This issue was already reported some time ago without a final result:
>> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>> >> >
>> >> >
>> >> > I created an example project that shows this issue:
>> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>> >> >
>> >> > This is the short link to the failing test case (on github): 
>> >> > http://is.gd/58mq3
>> >> > This is the tested page class: http://is.gd/58mDm
>> >> >
>> >> > I'm using wicket 1.4.3.
>> >> >
>> >> > Is there any error in the test? Can I do anything to work around this,
>> >> > or is it a bug?
>> >> >
>> >> > Thanx && cheers,
>> >> > Martin
>> >> >
>> >> > --
>> >> > Martin Grotzke
>> >> > http://www.javakaffee.de/blog/
>> >> >
>> >>
>> >> -
>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>
>> > --
>> > Martin Grotzke
>> > http://www.javakaffee.de/blog/
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>

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



Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Grotzke
On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> > shows the test?
> 
> Ofcourse I didn't look ;)
> 
> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY 
> ONCE!
> 
> If you want to use it another time, you need to call newFormTester again.
Thanx, this fixed the issue!

Now I extended the test to make sure that the previously selected make
and model are still selected after the final submit - and this fails
with the second drop down (the model): this returns null from
dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
shows these changes.

Is there another thing that needs to be changed in the test?

Cheers,
Martin


> 
> **
> Martin
> >
> >
> >>
> >> **
> >> Martin
> >>
> >> >
> >> > This issue was already reported some time ago without a final result:
> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >> >
> >> >
> >> > I created an example project that shows this issue:
> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >> >
> >> > This is the short link to the failing test case (on github): 
> >> > http://is.gd/58mq3
> >> > This is the tested page class: http://is.gd/58mDm
> >> >
> >> > I'm using wicket 1.4.3.
> >> >
> >> > Is there any error in the test? Can I do anything to work around this,
> >> > or is it a bug?
> >> >
> >> > Thanx && cheers,
> >> > Martin
> >> >
> >> > --
> >> > Martin Grotzke
> >> > http://www.javakaffee.de/blog/
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> > --
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


signature.asc
Description: This is a digitally signed message part


Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Makundi
> Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> shows the test?

Ofcourse I didn't look ;)

Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!

If you want to use it another time, you need to call newFormTester again.

**
Martin
>
>
>>
>> **
>> Martin
>>
>> >
>> > This issue was already reported some time ago without a final result:
>> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>> >
>> >
>> > I created an example project that shows this issue:
>> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>> >
>> > This is the short link to the failing test case (on github): 
>> > http://is.gd/58mq3
>> > This is the tested page class: http://is.gd/58mDm
>> >
>> > I'm using wicket 1.4.3.
>> >
>> > Is there any error in the test? Can I do anything to work around this,
>> > or is it a bug?
>> >
>> > Thanx && cheers,
>> > Martin
>> >
>> > --
>> > Martin Grotzke
>> > http://www.javakaffee.de/blog/
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
> --
> Martin Grotzke
> http://www.javakaffee.de/blog/
>

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



Re: test for dropdownchoice with ajax - response is homepage always

2009-12-01 Thread Martin Grotzke
On Tue, 2009-12-01 at 08:32 +0200, Martin Makundi wrote:
> Hi!
> 
> > When I test a page like this
> > http://www.wicket-library.com/wicket-examples/ajax/choice
> > with wicket tester and submit the form, the response page is the
> > HomePage instead of the expected page (ChoicePage).
> 
> Do you use a formtester? The wicket tester executeajax does not
> properly submit the form values so what we do is we create a dummy
> formtester before calling executeajaxevent. That might help.
Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
shows the test?

Yes, I'm using a formTester. What is your actual advice how to work
around? I didn't get this :)

Cheers,
Martin


> 
> **
> Martin
> 
> >
> > This issue was already reported some time ago without a final result:
> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >
> >
> > I created an example project that shows this issue:
> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >
> > This is the short link to the failing test case (on github): 
> > http://is.gd/58mq3
> > This is the tested page class: http://is.gd/58mDm
> >
> > I'm using wicket 1.4.3.
> >
> > Is there any error in the test? Can I do anything to work around this,
> > or is it a bug?
> >
> > Thanx && cheers,
> > Martin
> >
> > --
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


signature.asc
Description: This is a digitally signed message part


Re: test for dropdownchoice with ajax - response is homepage always

2009-11-30 Thread Martin Makundi
Hi!

> When I test a page like this
> http://www.wicket-library.com/wicket-examples/ajax/choice
> with wicket tester and submit the form, the response page is the
> HomePage instead of the expected page (ChoicePage).

Do you use a formtester? The wicket tester executeajax does not
properly submit the form values so what we do is we create a dummy
formtester before calling executeajaxevent. That might help.

**
Martin

>
> This issue was already reported some time ago without a final result:
> http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>
>
> I created an example project that shows this issue:
> http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>
> This is the short link to the failing test case (on github): 
> http://is.gd/58mq3
> This is the tested page class: http://is.gd/58mDm
>
> I'm using wicket 1.4.3.
>
> Is there any error in the test? Can I do anything to work around this,
> or is it a bug?
>
> Thanx && cheers,
> Martin
>
> --
> Martin Grotzke
> http://www.javakaffee.de/blog/
>

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



Re: test

2009-10-14 Thread Jeremy Thomerson
Test test?

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Oct 14, 2009 at 11:03 PM,  wrote:

>
>


Re: test

2009-06-04 Thread Daniele

Johan Compagner ha scritto:

so the message exactly tells you what the problem is

" (message too big for system) "

  


I try to cut alot of message, but nothing appened, so, as you can see in 
my last message "Re: TreeTable with image" I edit message "as new" and retry


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



Re: test

2009-06-04 Thread Johan Compagner
so the message exactly tells you what the problem is

" (message too big for system) "


On Thu, Jun 4, 2009 at 17:23, Daniele  wrote:

> Johan Compagner ha scritto:
>
>> nope doesnt work
>>
>> On Thu, Jun 4, 2009 at 17:18, Daniele  wrote:
>>
>>
>>
>
>
> I have problem sendind response to post another post:
>
> Delivery Status Notification
>
> - These recipients of your message have been processed by the mail server:
> users@wicket.apache.org; Failed; 5.3.4 (message too big for system)
>
>   Remote MTA mx1.us.apache.org: network error
>
>
> - SMTP protocol diagnostic: 552 spam score (6.9) exceeded threshold
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: test

2009-06-04 Thread Daniele

Johan Compagner ha scritto:

nope doesnt work

On Thu, Jun 4, 2009 at 17:18, Daniele  wrote:

  



I have problem sendind response to post another post:

Delivery Status Notification

- These recipients of your message have been processed by the mail server:
users@wicket.apache.org; Failed; 5.3.4 (message too big for system)

   Remote MTA mx1.us.apache.org: network error


- SMTP protocol diagnostic: 552 spam score (6.9) exceeded threshold



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



Re: test

2009-06-04 Thread Johan Compagner
nope doesnt work

On Thu, Jun 4, 2009 at 17:18, Daniele  wrote:

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


Re: test page rendering

2009-03-11 Thread Igor Vaynberg
see IResourceSettings#setThrowExceptionOnMissingResource(boolean)

-igor

On Wed, Mar 11, 2009 at 8:57 AM, Swanthe Lindgren <
swanthe.lindg...@megasol.se> wrote:

> Is there a similar way to ensure that all wicket:message key resources
> exist?
>
> //Swanthe
>
>
> Igor Vaynberg wrote:
>
>> if you want the removal of wicket:id to fail turn on component use
>> check in debug settings.
>>
>> -igor
>>
>> On Tue, Mar 10, 2009 at 3:12 AM, Swanthe Lindgren
>>  wrote:
>>
>>
>>> Hi all
>>> I have begun unit testing my wicket pages and one of the most basic tests
>>> I
>>> want to do is to make sure each and every page can render properly. The
>>> WicketTester.assertRenderedPage() looks like a good approach but it
>>> doesnt
>>> seam to care about the HTML. If I remove a wicket:id from the markupfile,
>>> the test is still passed.
>>> Is this correct or might there be something else I have done wrong?
>>>
>>> //Swanthe
>>>
>>>
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: test page rendering

2009-03-11 Thread Swanthe Lindgren
Is there a similar way to ensure that all wicket:message key resources 
exist?


//Swanthe

Igor Vaynberg wrote:

if you want the removal of wicket:id to fail turn on component use
check in debug settings.

-igor

On Tue, Mar 10, 2009 at 3:12 AM, Swanthe Lindgren
 wrote:
  

Hi all
I have begun unit testing my wicket pages and one of the most basic tests I
want to do is to make sure each and every page can render properly. The
WicketTester.assertRenderedPage() looks like a good approach but it doesnt
seam to care about the HTML. If I remove a wicket:id from the markupfile,
the test is still passed.
Is this correct or might there be something else I have done wrong?

//Swanthe




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





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


  




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



Re: test page rendering

2009-03-10 Thread Igor Vaynberg
if you want the removal of wicket:id to fail turn on component use
check in debug settings.

-igor

On Tue, Mar 10, 2009 at 3:12 AM, Swanthe Lindgren
 wrote:
> Hi all
> I have begun unit testing my wicket pages and one of the most basic tests I
> want to do is to make sure each and every page can render properly. The
> WicketTester.assertRenderedPage() looks like a good approach but it doesnt
> seam to care about the HTML. If I remove a wicket:id from the markupfile,
> the test is still passed.
> Is this correct or might there be something else I have done wrong?
>
> //Swanthe
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



RE: test page rendering

2009-03-10 Thread Jeremy Thomerson
Yes - it simply makes sure THAT page rendered. Removing the wicket:id doesn't 
make the page fail to render.  However, try the inverse of that - remove the 
component from the java and it will fail.

Jeremy Thomerson
http://www.wickettraining.com
-- sent from a wireless device


-Original Message-
From: Swanthe Lindgren 
Sent: Tuesday, March 10, 2009 5:12 AM
To: users@wicket.apache.org
Subject: test page rendering

Hi all
I have begun unit testing my wicket pages and one of the most basic 
tests I want to do is to make sure each and every page can render 
properly. The WicketTester.assertRenderedPage() looks like a good 
approach but it doesnt seam to care about the HTML. If I remove a 
wicket:id from the markupfile, the test is still passed.
Is this correct or might there be something else I have done wrong?

//Swanthe




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



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



Re: Test failures due to "incorrect" order of attributes

2008-03-01 Thread Henrik Lundahl
Hi

Thanks for clearing this out. I've filed
https://issues.apache.org/jira/browse/WICKET-1389 on this.


Regards,
Henrik Lundahl


2008/3/1, James Carman <[EMAIL PROTECTED]>:
> Maybe it should use a TreeMap instead?
>
>
>  On 3/1/08, Gerolf Seitz <[EMAIL PROTECTED]> wrote:
>  > Yes, this is a known issue, because the ordering of HashMaps(?)
>  >  changed in java6 (or something like that).
>  >
>  >  the tests should pass fine with java5.
>  >
>  >   Gerolf
>  >
>  >  On Sat, Mar 1, 2008 at 5:45 PM, Henrik Lundahl <[EMAIL PROTECTED]>
>  >  wrote:
>  >
>  >
>  >  > Hi
>  >  >
>  >  > When building wicket-1.3-SNAPSHOT I get some test failures with
>  >  > messages all similar to this:
>  >  >
>  >  > < 

Re: Test failures due to "incorrect" order of attributes

2008-03-01 Thread James Carman
Maybe it should use a TreeMap instead?

On 3/1/08, Gerolf Seitz <[EMAIL PROTECTED]> wrote:
> Yes, this is a known issue, because the ordering of HashMaps(?)
>  changed in java6 (or something like that).
>
>  the tests should pass fine with java5.
>
>   Gerolf
>
>  On Sat, Mar 1, 2008 at 5:45 PM, Henrik Lundahl <[EMAIL PROTECTED]>
>  wrote:
>
>
>  > Hi
>  >
>  > When building wicket-1.3-SNAPSHOT I get some test failures with
>  > messages all similar to this:
>  >
>  > < 

Re: Test failures due to "incorrect" order of attributes

2008-03-01 Thread Gerolf Seitz
Yes, this is a known issue, because the ordering of HashMaps(?)
changed in java6 (or something like that).

the tests should pass fine with java5.

  Gerolf

On Sat, Mar 1, 2008 at 5:45 PM, Henrik Lundahl <[EMAIL PROTECTED]>
wrote:

> Hi
>
> When building wicket-1.3-SNAPSHOT I get some test failures with
> messages all similar to this:
>
> <