Re: WicketTester and error messages

2011-05-27 Thread Mathilde Pellerin
no, it doesn't work. I have this error :
org.apache.wicket.WicketRuntimeException: No AjaxEventBehavior found on
component: ajaxSubmitLogin which matches the event: onClick

And it is true that I have not add AjaxEventBehavior to my AjaxButton : I
just override the onSubmit method of my Ajax Button.

2011/5/26 Per Newgro per.new...@gmx.ch

 As far as i understood this, FormTester submit is only for pushing the data
 from
 component to model. If you wait for the component to be executed the js
 event
 has to be executed.

 Is it working if you do an WicketTester.executeAjaxEvent(id, onclick);
 ?

 Cheers
 Per


  Hi all,

 I am testing a form with FormTester and WicketTester.
 When I test error messages which are send by form validation, test works
 well :
 tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
 obligatoire.});

 but when I test error message which is send by my submit ajaxButton, test
 fail : no error is sent.
 When I test application manually, this error appears in feedBackPanel.
 I don't understand why error is not sent when application is used by
 wicketTester.

 This is my submit button code :
 AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {

 @Override
 protected void onSubmit(AjaxRequestTarget target, Form?
  form)
 {
 Membre modelObject = (Membre) form.getModelObject();
 Membre membre;

 membre = serviceIdentif.identifier(modelObject.getId(),
 modelObject.getPassword());
 if(membre == null)
 error(Identifiant ou mot de passe incorrect);
 else
 setResponsePage(TableauBordPage.class);
 }

 @Override
 protected void onError(AjaxRequestTarget target, Form?
  form) {
 target.addComponent(feedBackPanel);
 }
 }

 and my test code
 FormTester formTester =
 tester.newFormTester(loginForm.getPageRelativePath());
 formTester.setValue(membreId, benj);
 formTester.setValue(password, password);
 formTester.submit(ajaxSubmitLogin);

 tester.assertErrorMessages(new String[] {Identifiant ou mot de
 passe incorrect});



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




-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/Mes
liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
http://fr.linkedin.com/in/mathildepellerin


Re: WicketTester and error messages

2011-05-27 Thread Martin Grigorov
AjaxButton has AjaxFormSubmitBehavior which is AjaxEventBehavior
It should be able to find it

On Fri, May 27, 2011 at 10:17 AM, Mathilde Pellerin
mathilde.pelle...@gmail.com wrote:
 no, it doesn't work. I have this error :
 org.apache.wicket.WicketRuntimeException: No AjaxEventBehavior found on
 component: ajaxSubmitLogin which matches the event: onClick

 And it is true that I have not add AjaxEventBehavior to my AjaxButton : I
 just override the onSubmit method of my Ajax Button.

 2011/5/26 Per Newgro per.new...@gmx.ch

 As far as i understood this, FormTester submit is only for pushing the data
 from
 component to model. If you wait for the component to be executed the js
 event
 has to be executed.

 Is it working if you do an WicketTester.executeAjaxEvent(id, onclick);
 ?

 Cheers
 Per


  Hi all,

 I am testing a form with FormTester and WicketTester.
 When I test error messages which are send by form validation, test works
 well :
 tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
 obligatoire.});

 but when I test error message which is send by my submit ajaxButton, test
 fail : no error is sent.
 When I test application manually, this error appears in feedBackPanel.
 I don't understand why error is not sent when application is used by
 wicketTester.

 This is my submit button code :
         AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {

             @Override
             protected void onSubmit(AjaxRequestTarget target, Form?
  form)
 {
                 Membre modelObject = (Membre) form.getModelObject();
                 Membre membre;

                 membre = serviceIdentif.identifier(modelObject.getId(),
 modelObject.getPassword());
                 if(membre == null)
                     error(Identifiant ou mot de passe incorrect);
                 else
                     setResponsePage(TableauBordPage.class);
             }

             @Override
             protected void onError(AjaxRequestTarget target, Form?
  form) {
                 target.addComponent(feedBackPanel);
             }
         }

 and my test code
         FormTester formTester =
 tester.newFormTester(loginForm.getPageRelativePath());
         formTester.setValue(membreId, benj);
         formTester.setValue(password, password);
         formTester.submit(ajaxSubmitLogin);

         tester.assertErrorMessages(new String[] {Identifiant ou mot de
 passe incorrect});



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




 --
  Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
 06.60.78.79.03   E-mail
 : mathilde.pelle...@gmail.com   Mon CV en ligne :
 http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/    Mes
 liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
 http://fr.linkedin.com/in/mathildepellerin




-- 
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: WicketTester and error messages

2011-05-27 Thread Mathilde Pellerin
Yeah ! it's work : my mistake, I wrote onClick and not onclick...

Thanks a lot for your help !


2011/5/27 Martin Grigorov mgrigo...@apache.org

 AjaxButton has AjaxFormSubmitBehavior which is AjaxEventBehavior
 It should be able to find it

 On Fri, May 27, 2011 at 10:17 AM, Mathilde Pellerin
 mathilde.pelle...@gmail.com wrote:
  no, it doesn't work. I have this error :
  org.apache.wicket.WicketRuntimeException: No AjaxEventBehavior found on
  component: ajaxSubmitLogin which matches the event: onClick
 
  And it is true that I have not add AjaxEventBehavior to my AjaxButton : I
  just override the onSubmit method of my Ajax Button.
 
  2011/5/26 Per Newgro per.new...@gmx.ch
 
  As far as i understood this, FormTester submit is only for pushing the
 data
  from
  component to model. If you wait for the component to be executed the js
  event
  has to be executed.
 
  Is it working if you do an WicketTester.executeAjaxEvent(id,
 onclick);
  ?
 
  Cheers
  Per
 
 
   Hi all,
 
  I am testing a form with FormTester and WicketTester.
  When I test error messages which are send by form validation, test
 works
  well :
  tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
  obligatoire.});
 
  but when I test error message which is send by my submit ajaxButton,
 test
  fail : no error is sent.
  When I test application manually, this error appears in feedBackPanel.
  I don't understand why error is not sent when application is used by
  wicketTester.
 
  This is my submit button code :
  AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {
 
  @Override
  protected void onSubmit(AjaxRequestTarget target, Form?
   form)
  {
  Membre modelObject = (Membre) form.getModelObject();
  Membre membre;
 
  membre = serviceIdentif.identifier(modelObject.getId(),
  modelObject.getPassword());
  if(membre == null)
  error(Identifiant ou mot de passe incorrect);
  else
  setResponsePage(TableauBordPage.class);
  }
 
  @Override
  protected void onError(AjaxRequestTarget target, Form?
   form) {
  target.addComponent(feedBackPanel);
  }
  }
 
  and my test code
  FormTester formTester =
  tester.newFormTester(loginForm.getPageRelativePath());
  formTester.setValue(membreId, benj);
  formTester.setValue(password, password);
  formTester.submit(ajaxSubmitLogin);
 
  tester.assertErrorMessages(new String[] {Identifiant ou mot de
  passe incorrect});
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
   Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
  06.60.78.79.03   E-mail
  : mathilde.pelle...@gmail.com   Mon CV en ligne :
  http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/
  Mes
  liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
  http://fr.linkedin.com/in/mathildepellerin
 



 --
 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




-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/Mes
liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
http://fr.linkedin.com/in/mathildepellerin


Re: WicketTester and error messages

2011-05-26 Thread Martin Grigorov
Maybe you hit the problem in https://issues.apache.org/jira/browse/WICKET-3711

On Thu, May 26, 2011 at 3:30 PM, Mathilde Pellerin
mathilde.pelle...@gmail.com wrote:
 Hi all,

 I am testing a form with FormTester and WicketTester.
 When I test error messages which are send by form validation, test works
 well :
 tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
 obligatoire.});

 but when I test error message which is send by my submit ajaxButton, test
 fail : no error is sent.
 When I test application manually, this error appears in feedBackPanel.
 I don't understand why error is not sent when application is used by
 wicketTester.

 This is my submit button code :
        AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form? form)
 {
                Membre modelObject = (Membre) form.getModelObject();
                Membre membre;

                membre = serviceIdentif.identifier(modelObject.getId(),
 modelObject.getPassword());
                if(membre == null)
                    error(Identifiant ou mot de passe incorrect);
                else
                    setResponsePage(TableauBordPage.class);
            }

            @Override
            protected void onError(AjaxRequestTarget target, Form? form) {
                target.addComponent(feedBackPanel);
            }
        }

 and my test code
        FormTester formTester =
 tester.newFormTester(loginForm.getPageRelativePath());
        formTester.setValue(membreId, benj);
        formTester.setValue(password, password);
        formTester.submit(ajaxSubmitLogin);

        tester.assertErrorMessages(new String[] {Identifiant ou mot de
 passe incorrect});

 --
  Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
 06.60.78.79.03   E-mail
 : mathilde.pelle...@gmail.com   Mon CV en ligne :
 http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/    Mes
 liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
 http://fr.linkedin.com/in/mathildepellerin




-- 
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: WicketTester and error messages

2011-05-26 Thread Mathilde Pellerin
I don't know, it's possible... but honestly, I'm too newbie to judge that.
And I don't know how try patches which are proposed...


2011/5/26 Martin Grigorov mgrigo...@apache.org

 Maybe you hit the problem in
 https://issues.apache.org/jira/browse/WICKET-3711

 On Thu, May 26, 2011 at 3:30 PM, Mathilde Pellerin
 mathilde.pelle...@gmail.com wrote:
  Hi all,
 
  I am testing a form with FormTester and WicketTester.
  When I test error messages which are send by form validation, test works
  well :
  tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
  obligatoire.});
 
  but when I test error message which is send by my submit ajaxButton, test
  fail : no error is sent.
  When I test application manually, this error appears in feedBackPanel.
  I don't understand why error is not sent when application is used by
  wicketTester.
 
  This is my submit button code :
 AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {
 
 @Override
 protected void onSubmit(AjaxRequestTarget target, Form?
 form)
  {
 Membre modelObject = (Membre) form.getModelObject();
 Membre membre;
 
 membre = serviceIdentif.identifier(modelObject.getId(),
  modelObject.getPassword());
 if(membre == null)
 error(Identifiant ou mot de passe incorrect);
 else
 setResponsePage(TableauBordPage.class);
 }
 
 @Override
 protected void onError(AjaxRequestTarget target, Form? form)
 {
 target.addComponent(feedBackPanel);
 }
 }
 
  and my test code
 FormTester formTester =
  tester.newFormTester(loginForm.getPageRelativePath());
 formTester.setValue(membreId, benj);
 formTester.setValue(password, password);
 formTester.submit(ajaxSubmitLogin);
 
 tester.assertErrorMessages(new String[] {Identifiant ou mot de
  passe incorrect});
 
  --
   Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
  06.60.78.79.03   E-mail
  : mathilde.pelle...@gmail.com   Mon CV en ligne :
  http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/
  Mes
  liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
  http://fr.linkedin.com/in/mathildepellerin
 



 --
 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




-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/Mes
liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
http://fr.linkedin.com/in/mathildepellerin


Re: WicketTester and error messages

2011-05-26 Thread Martin Grigorov
Create a mini application that reproduces the problem (a.k.a.
quickstart) and attach it to this ticket.
We will take it into account when we apply this patch.

Until then you'll have to find a workaround. Or you Wicket 1.5 RC4.2
where this problem is solved...

On Thu, May 26, 2011 at 3:49 PM, Mathilde Pellerin
mathilde.pelle...@gmail.com wrote:
 I don't know, it's possible... but honestly, I'm too newbie to judge that.
 And I don't know how try patches which are proposed...


 2011/5/26 Martin Grigorov mgrigo...@apache.org

 Maybe you hit the problem in
 https://issues.apache.org/jira/browse/WICKET-3711

 On Thu, May 26, 2011 at 3:30 PM, Mathilde Pellerin
 mathilde.pelle...@gmail.com wrote:
  Hi all,
 
  I am testing a form with FormTester and WicketTester.
  When I test error messages which are send by form validation, test works
  well :
  tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
  obligatoire.});
 
  but when I test error message which is send by my submit ajaxButton, test
  fail : no error is sent.
  When I test application manually, this error appears in feedBackPanel.
  I don't understand why error is not sent when application is used by
  wicketTester.
 
  This is my submit button code :
         AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {
 
             @Override
             protected void onSubmit(AjaxRequestTarget target, Form?
 form)
  {
                 Membre modelObject = (Membre) form.getModelObject();
                 Membre membre;
 
                 membre = serviceIdentif.identifier(modelObject.getId(),
  modelObject.getPassword());
                 if(membre == null)
                     error(Identifiant ou mot de passe incorrect);
                 else
                     setResponsePage(TableauBordPage.class);
             }
 
             @Override
             protected void onError(AjaxRequestTarget target, Form? form)
 {
                 target.addComponent(feedBackPanel);
             }
         }
 
  and my test code
         FormTester formTester =
  tester.newFormTester(loginForm.getPageRelativePath());
         formTester.setValue(membreId, benj);
         formTester.setValue(password, password);
         formTester.submit(ajaxSubmitLogin);
 
         tester.assertErrorMessages(new String[] {Identifiant ou mot de
  passe incorrect});
 
  --
   Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
  06.60.78.79.03   E-mail
  : mathilde.pelle...@gmail.com   Mon CV en ligne :
  http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/
  Mes
  liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
  http://fr.linkedin.com/in/mathildepellerin
 



 --
 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




 --
  Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
 06.60.78.79.03   E-mail
 : mathilde.pelle...@gmail.com   Mon CV en ligne :
 http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/    Mes
 liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
 http://fr.linkedin.com/in/mathildepellerin




-- 
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: WicketTester and error messages

2011-05-26 Thread Mathilde Pellerin
OK, I will try to create a quickstart.

thanks for your answer.


2011/5/26 Martin Grigorov mgrigo...@apache.org

 Create a mini application that reproduces the problem (a.k.a.
 quickstart) and attach it to this ticket.
 We will take it into account when we apply this patch.


 Until then you'll have to find a workaround. Or you Wicket 1.5 RC4.2
 where this problem is solved...


 On Thu, May 26, 2011 at 3:49 PM, Mathilde Pellerin
 mathilde.pelle...@gmail.com wrote:
  I don't know, it's possible... but honestly, I'm too newbie to judge
 that.
  And I don't know how try patches which are proposed...
 
 
  2011/5/26 Martin Grigorov mgrigo...@apache.org
 
  Maybe you hit the problem in
  https://issues.apache.org/jira/browse/WICKET-3711
 
  On Thu, May 26, 2011 at 3:30 PM, Mathilde Pellerin
  mathilde.pelle...@gmail.com wrote:
   Hi all,
  
   I am testing a form with FormTester and WicketTester.
   When I test error messages which are send by form validation, test
 works
   well :
   tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
   obligatoire.});
  
   but when I test error message which is send by my submit ajaxButton,
 test
   fail : no error is sent.
   When I test application manually, this error appears in feedBackPanel.
   I don't understand why error is not sent when application is used by
   wicketTester.
  
   This is my submit button code :
  AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {
  
  @Override
  protected void onSubmit(AjaxRequestTarget target, Form?
  form)
   {
  Membre modelObject = (Membre) form.getModelObject();
  Membre membre;
  
  membre = serviceIdentif.identifier(modelObject.getId(),
   modelObject.getPassword());
  if(membre == null)
  error(Identifiant ou mot de passe incorrect);
  else
  setResponsePage(TableauBordPage.class);
  }
  
  @Override
  protected void onError(AjaxRequestTarget target, Form?
 form)
  {
  target.addComponent(feedBackPanel);
  }
  }
  
   and my test code
  FormTester formTester =
   tester.newFormTester(loginForm.getPageRelativePath());
  formTester.setValue(membreId, benj);
  formTester.setValue(password, password);
  formTester.submit(ajaxSubmitLogin);
  
  tester.assertErrorMessages(new String[] {Identifiant ou mot de
   passe incorrect});
  
   --
Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
   06.60.78.79.03   E-mail
   : mathilde.pelle...@gmail.com   Mon CV en ligne :
   http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/
   Mes
   liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
   http://fr.linkedin.com/in/mathildepellerin
  
 
 
 
  --
  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
 
 
 
 
  --
   Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
  06.60.78.79.03   E-mail
  : mathilde.pelle...@gmail.com   Mon CV en ligne :
  http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/
  Mes
  liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
  http://fr.linkedin.com/in/mathildepellerin
 



 --
 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




-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
http://www.mathilde-pellerin.fr/ http://www.mathilde-pellerin.fr/Mes
liens :  http://www.viadeo.com/fr/profile/mathilde.pellerin
http://fr.linkedin.com/in/mathildepellerin


Re: WicketTester and error messages

2011-05-26 Thread Per Newgro
As far as i understood this, FormTester submit is only for pushing the 
data from
component to model. If you wait for the component to be executed the js 
event

has to be executed.

Is it working if you do an WicketTester.executeAjaxEvent(id, onclick); ?

Cheers
Per


Hi all,

I am testing a form with FormTester and WicketTester.
When I test error messages which are send by form validation, test works
well :
tester.assertErrorMessages(new String[] {Le champ 'Identifiant' est
obligatoire.});

but when I test error message which is send by my submit ajaxButton, test
fail : no error is sent.
When I test application manually, this error appears in feedBackPanel.
I don't understand why error is not sent when application is used by
wicketTester.

This is my submit button code :
 AjaxButton submitbutton = new AjaxButton(ajaxSubmitLogin) {

 @Override
 protected void onSubmit(AjaxRequestTarget target, Form?  form)
{
 Membre modelObject = (Membre) form.getModelObject();
 Membre membre;

 membre = serviceIdentif.identifier(modelObject.getId(),
modelObject.getPassword());
 if(membre == null)
 error(Identifiant ou mot de passe incorrect);
 else
 setResponsePage(TableauBordPage.class);
 }

 @Override
 protected void onError(AjaxRequestTarget target, Form?  form) {
 target.addComponent(feedBackPanel);
 }
 }

and my test code
 FormTester formTester =
tester.newFormTester(loginForm.getPageRelativePath());
 formTester.setValue(membreId, benj);
 formTester.setValue(password, password);
 formTester.submit(ajaxSubmitLogin);

 tester.assertErrorMessages(new String[] {Identifiant ou mot de
passe incorrect});




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