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.view.impl;
19
20 import junit.framework.Test;
21 import junit.framework.TestCase;
22 import junit.framework.TestSuite;
23
24 /***
25 * <p>Test case for <code>DefaultViewControllerMapper</code>.</p>
26 */
27 public class DefaultViewControllerMapperTestCase extends TestCase {
28
29
30
31
32
33
34 public DefaultViewControllerMapperTestCase(String name) {
35 super(name);
36 }
37
38
39
40
41
42
43 protected void setUp() throws Exception {
44
45 super.setUp();
46
47
48 dvcm = new DefaultViewControllerMapper();
49
50 }
51
52
53
54 public static Test suite() {
55
56 return (new TestSuite(DefaultViewControllerMapperTestCase.class));
57
58 }
59
60
61
62 protected void tearDown() throws Exception {
63
64 dvcm = null;
65 super.tearDown();
66
67 }
68
69
70
71
72
73
74 DefaultViewControllerMapper dvcm = null;
75
76
77 String reserved[] = {
78 "applicationScope", "cookie", "facesContext", "header", "headerValues",
79 "initParam", "param", "paramValues", "requestScope", "sessionScope", "view",
80 };
81
82
83
84
85
86 public void testMultiple() {
87
88 assertEquals("foo$bar", dvcm.mapViewId("/foo/bar.jsp"));
89 assertEquals("foo$bar", dvcm.mapViewId("/foo/bar.xxx"));
90 assertEquals("foo$bar", dvcm.mapViewId("foo/bar.jsp"));
91 assertEquals("foo$bar", dvcm.mapViewId("foo/bar.xxx"));
92
93 }
94
95
96
97 public void testNumeric() {
98
99
100 assertEquals("_1$a", dvcm.mapViewId("/1/a.jsp"));
101 assertEquals("_1$1$a", dvcm.mapViewId("/1/1/a.jsp"));
102
103
104 assertEquals("a$1$b", dvcm.mapViewId("/a/1/b.jsp"));
105
106 }
107
108
109
110
111 public void testPristine() {
112
113 ;
114
115 }
116
117
118
119 public void testReserved() {
120
121 for (int i = 0; i < reserved.length; i++) {
122 assertEquals(reserved[i],
123 "_" + reserved[i],
124 dvcm.mapViewId("/" + reserved[i] + ".jsp"));
125 }
126
127 }
128
129
130
131 public void testSingle() {
132
133 assertEquals("foo", dvcm.mapViewId("/foo.jsp"));
134 assertEquals("foo", dvcm.mapViewId("/foo.xxx"));
135 assertEquals("foo", dvcm.mapViewId("foo.jsp"));
136 assertEquals("foo", dvcm.mapViewId("foo.xxx"));
137
138 }
139
140
141 }