KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > web > JsfTabbedTest


1 package com.tonbeller.wcf.web;
2
3 import com.meterware.httpunit.GetMethodWebRequest;
4 import com.meterware.httpunit.SubmitButton;
5 import com.meterware.httpunit.WebForm;
6
7 /**
8  * tests integration of JSF with WCF
9  *
10  * @author av
11  */

12 public class JsfTabbedTest extends HttpUnitTestCase {
13   
14   public JsfTabbedTest(String JavaDoc arg0) {
15     super(arg0);
16   }
17
18   /** juint complains if this file is empty */
19   public void testNothing() {
20   }
21
22   
23   /**
24    * panel1 and panel2 contain an integer input field that is bound
25    * to the same java bean property.
26    * <p />
27    * JSF is no longer supported - so this test is skipped
28    */

29   public void dont_testJsfForm() throws Exception JavaDoc {
30     wc.sendRequest(new GetMethodWebRequest(servletUrl + "/jsftabbed.faces"));
31     WebForm wf = wc.getCurrentPage().getFormWithID("form01");
32     
33     // there is no submit button for the curren panel
34
SubmitButton button = wf.getSubmitButton("tabbedForm.panel1");
35     assertNull(button);
36     
37     // there is a submit button for the next panel
38
button = wf.getSubmitButton("tabbedForm.panel2");
39     assertNotNull(button);
40
41     // add invalid int number
42
wf.setParameter("tabbedForm.int1", "xxx");
43     // try to switch to panel 2
44
wf = wf.submit(button).getFormWithID("form01");
45     // make sure the panel has not switched because of the error
46
button = wf.getSubmitButton("tabbedForm.panel2");
47     assertNotNull(button);
48     assertEquals("xxx", wf.getParameterValue("tabbedForm.int1"));
49
50     // add valid int number
51
wf.setParameter("tabbedForm.int1", "888");
52     // successful switch to panel 2
53
button = wf.getSubmitButton("tabbedForm.panel2");
54     wf = wf.submit(button).getFormWithID("form01");
55
56     button = wf.getSubmitButton("tabbedForm.panel2");
57     assertNull(button);
58
59     assertEquals("888", wf.getParameterValue("tabbedForm.int2"));
60     
61   }
62
63 }
64
Popular Tags