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 com.gargoylesoftware.htmlunit.html.HtmlSpan;
23 import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
24 import junit.framework.Test;
25 import junit.framework.TestSuite;
26 import org.apache.shale.test.cargo.CargoTestSetup;
27
28 /***
29 * <p>Validate the "JNDI access" path through the application</p>
30 */
31 public class JndiTestCase extends AbstractTestCase {
32
33
34
35
36
37 /***
38 * <p>Construct a new instance of this test case.</p>
39 *
40 * @param name Name of the new test case
41 */
42 public JndiTestCase(String name) {
43
44 super(name);
45
46 }
47
48
49
50
51
52
53
54
55 /***
56 * <p>Set up the instance variables required for this test case.</p>
57 */
58 protected void setUp() throws Exception {
59
60 super.setUp();
61 page("/jndi/test.faces");
62
63 }
64
65
66 /***
67 * <p>Return the set of tests included in this test suite.</p>
68 */
69 public static Test suite() {
70
71 return new CargoTestSetup(new TestSuite(JndiTestCase.class));
72
73 }
74
75
76 /***
77 * <p>Tear down instance variables required by this test case.</p>
78 */
79 protected void tearDown() throws Exception {
80
81 super.tearDown();
82
83 }
84
85
86
87
88
89
90 /***
91 * <p>Execute the "Jndi Access" path.</p>
92 */
93 public void testExecute() throws Exception {
94
95 HtmlSpan span, expected, actual = null;
96 HtmlSubmitInput submit = null;
97
98
99 assertEquals("JNDI Test Title", title());
100
101
102 expected = (HtmlSpan) element("form:expected");
103 assertNotNull(expected);
104 actual = (HtmlSpan) element("form:actual");
105 assertNotNull(actual);
106 assertEquals(expected.asText(), actual.asText());
107
108
109 submit = (HtmlSubmitInput) element("form:finish");
110 assertNotNull(submit);
111 submit(submit);
112 assertEquals("Shale Framework Use Cases", title());
113
114 }
115
116
117 }