2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.usecases.systest;
19
20 import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
21 import com.gargoylesoftware.htmlunit.html.HtmlForm;
22 import junit.framework.Test;
23 import junit.framework.TestSuite;
24 import org.apache.shale.test.cargo.CargoTestSetup;
25
26 /***
27 * <p>Simple integration test to validate access to the main menu.</p>
28 */
29 public class UseCasesTestCase extends AbstractTestCase {
30
31
32
33
34
35 /***
36 * <p>Construct a new instance of this test case.</p>
37 *
38 * @param name Name of the new test case
39 */
40 public UseCasesTestCase(String name) {
41
42 super(name);
43
44 }
45
46
47
48
49
50
51
52
53 /***
54 * <p>Set up the instance variables required for this test case.</p>
55 */
56 protected void setUp() throws Exception {
57
58 super.setUp();
59 page("/usecases.faces");
60
61 }
62
63
64 /***
65 * <p>Return the set of tests included in this test suite.</p>
66 */
67 public static Test suite() {
68
69 return new CargoTestSetup(new TestSuite(UseCasesTestCase.class));
70
71 }
72
73
74 /***
75 * <p>Tear down instance variables required by this test case.</p>
76 */
77 protected void tearDown() throws Exception {
78
79 super.tearDown();
80
81 }
82
83
84
85
86
87
88 /***
89 * <p>Verify the availability of an appropriate form.</p>
90 */
91 public void testForm() throws Exception {
92
93 HtmlForm form = (HtmlForm) element("usecasesForm");
94 assertNotNull(form);
95 assertEquals("", form.getAcceptAttribute());
96 assertEquals("", form.getAcceptCharsetAttribute());
97 String action = form.getActionAttribute();
98 int semicolon = action.indexOf(";jsessionid=");
99 if (semicolon >= 0) {
100 action = action.substring(0, semicolon);
101 }
102 assertEquals("/shale-usecases/usecases.faces", action);
103 assertEquals("application/x-www-form-urlencoded", form.getEnctypeAttribute());
104 assertEquals("", form.getLangAttribute());
105 assertEquals("post", form.getMethodAttribute());
106
107 assertEquals("", form.getOnResetAttribute());
108 assertEquals("", form.getOnSubmitAttribute());
109 assertEquals("", form.getTargetAttribute());
110
111 }
112
113
114 /***
115 * <p>Verify the availability of an appropriate subview hyperlink.</p>
116 */
117 public void testSubview() throws Exception {
118
119 HtmlAnchor anchor = (HtmlAnchor) element("usecasesForm:subview");
120 assertNotNull(anchor);
121 assertEquals("", anchor.getAccessKeyAttribute());
122 assertEquals("", anchor.getCharsetAttribute());
123 assertEquals("", anchor.getCoordsAttribute());
124
125 assertEquals("", anchor.getHrefLangAttribute());
126 assertEquals("", anchor.getNameAttribute());
127 assertEquals("", anchor.getRelAttribute());
128 assertEquals("", anchor.getRevAttribute());
129 assertEquals("", anchor.getShapeAttribute());
130 assertEquals("", anchor.getTabIndexAttribute());
131 assertEquals("", anchor.getTargetAttribute());
132 assertEquals("", anchor.getTypeAttribute());
133 assertEquals("Subview Processing", anchor.asText());
134
135 }
136
137
138 /***
139 * <p>Verify the title of the returned page.</p>
140 */
141 public void testTitle() throws Exception {
142
143 assertEquals("Shale Framework Use Cases", title());
144
145 }
146
147
148 }