1
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
2
<%@page import="junit.framework.Assert"%>
3
<%@page import="org.apache.struts.Globals"%>
4
<%@page import="org.apache.struts.action.ActionMessage"%>
5
<%@page import="org.apache.struts.action.ActionMessages"%>
7
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
8
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
9
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
12
<logic:equal name="runTest" value="testPasswordPropertyReadonly">
13
<bean:define id="TEST_RESULTS" toScope="page">
14
<html:password property="string" readonly="true"/>
16
<bean:define id="EXPECTED_RESULTS" toScope="page">
17
<input type="password" name="string" value="Test Value" readonly="readonly">
21
<logic:equal name="runTest" value="testPasswordPropertySize">
22
<bean:define id="TEST_RESULTS" toScope="page">
23
<html:password property="string" size="10"/>
25
<bean:define id="EXPECTED_RESULTS" toScope="page">
26
<input type="password" name="string" size="10" value="Test Value">
30
<logic:equal name="runTest" value="testPasswordPropertyStyle">
31
<bean:define id="TEST_RESULTS" toScope="page">
32
<html:password property="string" style="Put something here" errorStyle="some error style"/>
34
<bean:define id="EXPECTED_RESULTS" toScope="page">
35
<input type="password" name="string" value="Test Value" style="Put something here">
39
<logic:equal name="runTest" value="testPasswordPropertyErrorStyle">
41
ActionMessages errors = new ActionMessages();
43
new ActionMessage("default.testing.errors.tag"));
44
request.setAttribute("ALT_ERROR_KEY", errors);
46
<bean:define id="TEST_RESULTS" toScope="page">
47
<html:password property="string" style="Put something here" errorStyle="some error style" errorKey="ALT_ERROR_KEY"/>
49
<bean:define id="EXPECTED_RESULTS" toScope="page">
50
<input type="password" name="string" value="Test Value" style="some error style">
54
<logic:equal name="runTest" value="testPasswordPropertyStyleClass">
55
<bean:define id="TEST_RESULTS" toScope="page">
56
<html:password property="string" styleClass="Put something here" errorStyleClass="some error style class"/>
58
<bean:define id="EXPECTED_RESULTS" toScope="page">
59
<input type="password" name="string" value="Test Value" class="Put something here">
63
<logic:equal name="runTest" value="testPasswordPropertyErrorStyleClass">
65
ActionMessages errors = new ActionMessages();
67
new ActionMessage("default.testing.errors.tag"));
68
request.setAttribute(Globals.ERROR_KEY, errors);
70
<bean:define id="TEST_RESULTS" toScope="page">
71
<html:password property="string" styleClass="Put something here" errorStyleClass="some error style class"/>
73
<bean:define id="EXPECTED_RESULTS" toScope="page">
74
<input type="password" name="string" value="Test Value" class="some error style class">
78
<logic:equal name="runTest" value="testPasswordPropertyStyleId">
79
<bean:define id="TEST_RESULTS" toScope="page">
80
<html:password property="string" styleId="Put something here" errorStyleId="some error style id"/>
82
<bean:define id="EXPECTED_RESULTS" toScope="page">
83
<input type="password" name="string" value="Test Value" id="Put something here">
87
<logic:equal name="runTest" value="testPasswordPropertyErrorStyleId">
89
ActionMessages errors = new ActionMessages();
91
new ActionMessage("default.testing.errors.tag"));
92
request.setAttribute(Globals.ERROR_KEY, errors);
94
<bean:define id="TEST_RESULTS" toScope="page">
95
<html:password property="string" styleId="Put something here" errorStyleId="some error style id"/>
97
<bean:define id="EXPECTED_RESULTS" toScope="page">
98
<input type="password" name="string" value="Test Value" id="some error style id">
102
<logic:equal name="runTest" value="testPasswordPropertyTitle">
103
<bean:define id="TEST_RESULTS" toScope="page">
104
<html:password property="string" title="Put something here"/>
106
<bean:define id="EXPECTED_RESULTS" toScope="page">
107
<input type="password" name="string" value="Test Value" title="Put something here">
111
<logic:equal name="runTest" value="testPasswordPropertyTitleKey">
112
<bean:define id="TEST_RESULTS" toScope="page">
113
<html:password property="string" titleKey="default.bundle.message"/>
115
<bean:define id="EXPECTED_RESULTS" toScope="page">
116
<input type="password" name="string" value="Test Value" title="Testing Message">
120
<logic:equal name="runTest" value="testPasswordPropertyTitleKey_fr">
121
<bean:define id="TEST_RESULTS" toScope="page">
122
<html:password property="string" titleKey="default.bundle.message"/>
124
<bean:define id="EXPECTED_RESULTS" toScope="page">
125
<input type="password" name="string" value="Test Value" title="Message D'Essai">
129
<logic:equal name="runTest" value="testPasswordPropertyValue">
130
<bean:define id="TEST_RESULTS" toScope="page">
131
<html:password property="string" value ="Put something here"/>
133
<bean:define id="EXPECTED_RESULTS" toScope="page">
134
<input type="password" name="string" value="Put something here">
138
<logic:equal name="runTest" value="testPasswordPropertyIndexedArray">
139
<bean:define id="TEST_RESULTS" toScope="page">
140
<logic:iterate id="indivItem" name="lst">
141
<html:password property="string" indexed="true"/>
144
<bean:define id="EXPECTED_RESULTS" toScope="page">
146
<input type="password" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
151
<logic:equal name="runTest" value="testPasswordPropertyIndexedArrayProperty">
152
<bean:define id="TEST_RESULTS" toScope="page">
153
<logic:iterate id="indivItem" name="lst" property="list">
154
<html:password property="string" indexed="true"/>
157
<bean:define id="EXPECTED_RESULTS" toScope="page">
159
<input type="password" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
164
<logic:equal name="runTest" value="testPasswordPropertyIndexedMap">
165
<bean:define id="TEST_RESULTS" toScope="page">
166
<logic:iterate id="indivItem" name="lst">
167
<html:password property="string" indexed="true"/>
170
<bean:define id="EXPECTED_RESULTS" toScope="page">
172
<input type="password" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
177
<logic:equal name="runTest" value="testPasswordPropertyIndexedMapProperty">
178
<bean:define id="TEST_RESULTS" toScope="page">
179
<logic:iterate id="indivItem" name="lst" property="map">
180
<html:password property="string" indexed="true"/>
183
<bean:define id="EXPECTED_RESULTS" toScope="page">
185
<input type="password" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
190
<logic:equal name="runTest" value="testPasswordPropertyIndexedEnumeration">
191
<bean:define id="TEST_RESULTS" toScope="page">
192
<logic:iterate id="indivItem" name="lst">
193
<html:password property="string" indexed="true"/>
196
<bean:define id="EXPECTED_RESULTS" toScope="page">
198
<input type="password" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
200
<input type="password" name="org.apache.struts.taglib.html.BEAN[1].string" value="Test Value">
205
<logic:equal name="runTest" value="testPasswordPropertyIndexedEnumerationProperty">
206
<bean:define id="TEST_RESULTS" toScope="page">
207
<logic:iterate id="indivItem" name="lst" property="enumeration">
208
<html:password property="string" indexed="true"/>
211
<bean:define id="EXPECTED_RESULTS" toScope="page">
213
<input type="password" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
215
<input type="password" name="org.apache.struts.taglib.html.BEAN[1].string" value="Test Value">
223
String expected = "";
224
String compareTo = "";
226
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
227
throw new javax.servlet.jsp.JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
229
expected=pageContext.getAttribute("EXPECTED_RESULTS").toString();
231
if (pageContext.getAttribute("TEST_RESULTS") != null){
232
compareTo=pageContext.getAttribute("TEST_RESULTS").toString();
235
Assert.assertEquals(expected, compareTo);