Re: Re: Re: Re: Basic JUnit Test

2012-08-28 Thread JCoder
What exactly do you mean by 'quickstart' ?

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



Re: Re: Re: Re: Basic JUnit Test

2012-08-28 Thread Martin Grigorov
A mini application that reproduces the problem. See
http://wicket.apache.org/start/quickstart.html

On Tue, Aug 28, 2012 at 8:21 AM, JCoder i...@jcoder.de wrote:
 What exactly do you mean by 'quickstart' ?

 -
 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: Re: Re: Re: Re: Basic JUnit Test

2012-08-28 Thread JCoder
What exactly do you mean by 'quickstart' ?


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



Re: Re: Re: Basic JUnit Test

2012-08-20 Thread JCoder
Hi Vineet,

thanks for the reply. The line 
tester.getServletRequest().setParameter(myParam, testParam);
But now Im breaking my head with the next issue. If you look at my first post, 
Im trying to do a test where a second page is rendered after a submit on an 
AjaxButton. The test code looks like this:

1. FirstPage page = (FirstPage) tester.startPage(FirstPage.class, 
pageParameters);
2. tester.assertRenderedPage(FirstPage.class);
3. page.getActionForm().setType(1); // where actionForm is a property/attribute 
of FirstPage.
4. FormTester formTester = tester.newFormTester(myForm);
5. tester.getServletRequest().setParameter(myParam, testParam);
6. tester.executeAjaxEvent(myForm:myAjaxButton, onclick);
7. tester.assertRenderedPage(SecondPage.class); 

The the test fails within the onSubmit(AjaxRequestTarget target, Form? 
form) saying that the attribute/property actionForm is null...
Obviously the second (Ajax-) request is not shipped with the attribute/property 
values of his containing panel. Is this correct? Who can help me out here?

Regards,
Yusuf

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



Re: Re: Re: Basic JUnit Test

2012-08-20 Thread vineet semwal
that test looks ok to me ,please attach a quickstart

On Mon, Aug 20, 2012 at 12:23 PM, JCoder i...@jcoder.de wrote:
 Hi Vineet,

 thanks for the reply. The line 
 tester.getServletRequest().setParameter(myParam, testParam);
 But now Im breaking my head with the next issue. If you look at my first 
 post, Im trying to do a test where a second page is rendered after a submit 
 on an AjaxButton. The test code looks like this:

 1. FirstPage page = (FirstPage) tester.startPage(FirstPage.class, 
 pageParameters);
 2. tester.assertRenderedPage(FirstPage.class);
 3. page.getActionForm().setType(1); // where actionForm is a 
 property/attribute of FirstPage.
 4. FormTester formTester = tester.newFormTester(myForm);
 5. tester.getServletRequest().setParameter(myParam, testParam);
 6. tester.executeAjaxEvent(myForm:myAjaxButton, onclick);
 7. tester.assertRenderedPage(SecondPage.class);

 The the test fails within the onSubmit(AjaxRequestTarget target, Form? 
 form) saying that the attribute/property actionForm is null...
 Obviously the second (Ajax-) request is not shipped with the 
 attribute/property values of his containing panel. Is this correct? Who can 
 help me out here?

 Regards,
 Yusuf

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




-- 
regards,

Vineet Semwal

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



Re: Re: Basic JUnit Test

2012-08-17 Thread JCoder
Hi Vineet,

wickettester#ajaxEvent(button,onclick)  is what I already tried. And it 
worked better but not finally finsihed.
The cause of the next problem is that I need to provide some request parameter 
for this request since my application reads request and throws an exception if 
it can't find special parameters.
Then I changed my code to provide some ajax request parameter because the 
button click is an instance of AjaxButton:


Component comp = tester

.getComponentFromLastRenderedPage(myForm:myAjaxButton);
AjaxEventBehavior behavior = new 
AjaxFormSubmitBehavior(onclick) {

@Override
protected void onSubmit(AjaxRequestTarget target) {
System.out.println(hh);
}

@Override
protected void onError(AjaxRequestTarget target) {
// TODO Auto-generated method stub

}
};

comp.add(behavior);
tester.executeAjaxEvent(comp, onclick);


Is this the correct to provide ajax request parameter?
If so, I guess I need to chance something in onSubmit(AjaxRequestTarget), 
true ?

Regards,
Y

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



Re: Re: Basic JUnit Test

2012-08-17 Thread vineet semwal
 why are you attaching a new ajaxformsubmitbehavior to an ajaxbutton
,it already has it's own ?
 if you want to pass some request parameter  ,you can set it to the
request by tester.getRequest().setParameter(key,value)

On Fri, Aug 17, 2012 at 12:09 PM, JCoder i...@jcoder.de wrote:
 Hi Vineet,

 wickettester#ajaxEvent(button,onclick)  is what I already tried. And it 
 worked better but not finally finsihed.
 The cause of the next problem is that I need to provide some request 
 parameter for this request since my application reads request and throws an 
 exception if it can't find special parameters.
 Then I changed my code to provide some ajax request parameter because the 
 button click is an instance of AjaxButton:

 
 Component comp = tester
 
 .getComponentFromLastRenderedPage(myForm:myAjaxButton);
 AjaxEventBehavior behavior = new 
 AjaxFormSubmitBehavior(onclick) {

 @Override
 protected void onSubmit(AjaxRequestTarget target) {
 System.out.println(hh);
 }

 @Override
 protected void onError(AjaxRequestTarget target) {
 // TODO Auto-generated method stub

 }
 };

 comp.add(behavior);
 tester.executeAjaxEvent(comp, onclick);
 

 Is this the correct to provide ajax request parameter?
 If so, I guess I need to chance something in onSubmit(AjaxRequestTarget), 
 true ?

 Regards,
 Y

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




-- 
regards,

Vineet Semwal

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