You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2006/02/10 19:13:25 UTC
svn commit: r376783 [1/2] -
/struts/el/trunk/src/test/org/apache/strutsel/taglib/html/
Author: husted
Date: Fri Feb 10 10:13:22 2006
New Revision: 376783
URL: http://svn.apache.org/viewcvs?rev=376783&view=rev
Log:
Checkstyle Roundup
* EL package reformatted with latest Jalopy settings. Stylistic changes only.
Modified:
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELBaseTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELButtonTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCancelTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCheckboxTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELErrorsTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELFileTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELFormTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELFrameTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELHiddenTag.java
struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELHtmlTag.java
Modified: struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELBaseTag.java
URL: http://svn.apache.org/viewcvs/struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELBaseTag.java?rev=376783&r1=376782&r2=376783&view=diff
==============================================================================
--- struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELBaseTag.java (original)
+++ struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELBaseTag.java Fri Feb 10 10:13:22 2006
@@ -1,29 +1,22 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.strutsel.taglib.html;
-import java.util.HashMap;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspException;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -32,22 +25,25 @@
import org.apache.strutsel.taglib.utils.TestHelper;
import org.w3c.dom.Element;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspException;
+
+import java.util.HashMap;
-public class TestELBaseTag
- extends JspTagTestCase {
- protected static final String REQUIRED_HREF_VALUE_KEY =
- "RequiredHRefValue";
- protected static final String REQUIRED_TARGET_VALUE_KEY =
- "RequiredTargetValue";
- protected ELBaseTag elBaseTag = null;
+public class TestELBaseTag extends JspTagTestCase {
+ protected static final String REQUIRED_HREF_VALUE_KEY = "RequiredHRefValue";
+ protected static final String REQUIRED_TARGET_VALUE_KEY =
+ "RequiredTargetValue";
+ protected ELBaseTag elBaseTag = null;
public TestELBaseTag(String theName) {
super(theName);
}
public static void main(String[] args) {
- junit.awtui.TestRunner.main(
- new String[] { TestELBaseTag.class.getName() });
+ junit.awtui.TestRunner.main(new String[] { TestELBaseTag.class.getName() });
}
public static Test suite() {
@@ -66,21 +62,22 @@
/**
* Method to get the required value of the "href" attribute, based on
* values in the request. This is taken directly from
- * "BaseTag.doStartTag()", which is exactly what we're testing, so they had
- * better match.
+ * "BaseTag.doStartTag()", which is exactly what we're testing, so they
+ * had better match.
*/
private String getRequiredHrefValue(HttpServletRequest request) {
// This sequence of assignments is taken from
// "BaseTag.doStartTag(), so it'd better match.
StringBuffer sb = new StringBuffer();
+
sb.append(request.getScheme());
sb.append("://");
sb.append(request.getServerName());
- if ((request.getScheme().equals("http") &&
- (request.getServerPort() != 80)) ||
- (request.getScheme().equals("https") &&
- (request.getServerPort() != 443))) {
+ if ((request.getScheme().equals("http")
+ && (request.getServerPort() != 80))
+ || (request.getScheme().equals("https")
+ && (request.getServerPort() != 443))) {
sb.append(":");
sb.append(request.getServerPort());
}
@@ -96,16 +93,18 @@
* Tests the value of the "href" attribute, based on the values in the
* request.
*/
- public void testHref()
- throws ServletException, JspException {
- HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
- String requiredHrefValue = getRequiredHrefValue(request);
+ public void testHref() throws ServletException, JspException {
+ HttpServletResponse response =
+ (HttpServletResponse) pageContext.getResponse();
+ String requiredHrefValue = getRequiredHrefValue(request);
+
System.out.println("requiredHrefValue[" + requiredHrefValue + "]");
response.addHeader(REQUIRED_HREF_VALUE_KEY, requiredHrefValue);
response.addHeader("abc", "def");
response.addHeader("ghi", "jkl");
response.addHeader("mno", "pqr");
-// response.addHeader("stuvwx", requiredHrefValue);
+
+ // response.addHeader("stuvwx", requiredHrefValue);
response.addHeader("stuvwx", "abc");
int startTagReturn = elBaseTag.doStartTag();
@@ -116,18 +115,22 @@
TestHelper.printResponse(testResponse);
Element docElement = testResponse.getDOM().getDocumentElement();
+
DOMHelper.printNode(docElement);
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/head/base", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap, new String[] { "href" },
- false);
- String header =
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/head/base", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap, new String[] { "href" },
+ false);
+
+ String header =
testResponse.getHeaderField(REQUIRED_HREF_VALUE_KEY);
+
System.out.println("[header[" + header + "]]");
- checkAttrValue(attrMap, testResponse, REQUIRED_HREF_VALUE_KEY,
- "base", "href");
+ checkAttrValue(attrMap, testResponse, REQUIRED_HREF_VALUE_KEY,
+ "base", "href");
} catch (Exception ex) {
ex.printStackTrace();
fail();
@@ -138,13 +141,15 @@
* Tests the "target" attribute, based on a particular value set into the
* target property, using the EL engine to evalute the property value.
*/
- public void testTarget()
- throws ServletException, JspException {
- HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
- String requiredTargetValue = "flork";
+ public void testTarget() throws ServletException, JspException {
+ HttpServletResponse response =
+ (HttpServletResponse) pageContext.getResponse();
+ String requiredTargetValue = "flork";
+
response.addHeader(REQUIRED_TARGET_VALUE_KEY, requiredTargetValue);
String varName = "targetVar";
+
pageContext.setAttribute(varName, requiredTargetValue);
elBaseTag.setTargetExpr("${" + varName + "}");
@@ -156,16 +161,17 @@
TestHelper.printResponse(testResponse);
Element docElement = testResponse.getDOM().getDocumentElement();
+
DOMHelper.printNode(docElement);
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/head/base", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] { "href", "target" },
- false);
- checkAttrValue(attrMap, testResponse, REQUIRED_TARGET_VALUE_KEY,
- "base", "target");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/head/base", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "href", "target" }, false);
+ checkAttrValue(attrMap, testResponse, REQUIRED_TARGET_VALUE_KEY,
+ "base", "target");
} catch (Exception ex) {
ex.printStackTrace();
fail();
@@ -178,33 +184,38 @@
* result in an empty "target" attribute in the output.
*/
public void testNonexistentVariable()
- throws ServletException, JspException {
- HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
- String requiredTargetValue = "";
+ throws ServletException, JspException {
+ HttpServletResponse response =
+ (HttpServletResponse) pageContext.getResponse();
+ String requiredTargetValue = "";
+
response.addHeader(REQUIRED_TARGET_VALUE_KEY, requiredTargetValue);
String varName = "targetVar";
+
pageContext.setAttribute(varName, "flork");
elBaseTag.setTargetExpr("${" + varName + "x" + "}");
int startTagReturn = elBaseTag.doStartTag();
}
- public void endNonexistentVariable(com.meterware.httpunit.WebResponse testResponse) {
+ public void endNonexistentVariable(
+ com.meterware.httpunit.WebResponse testResponse) {
try {
TestHelper.printResponse(testResponse);
Element docElement = testResponse.getDOM().getDocumentElement();
+
DOMHelper.printNode(docElement);
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/head/base", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] { "href", "target" },
- false);
- checkAttrValue(attrMap, testResponse, REQUIRED_TARGET_VALUE_KEY,
- "base", "target");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/head/base", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "href", "target" }, false);
+ checkAttrValue(attrMap, testResponse, REQUIRED_TARGET_VALUE_KEY,
+ "base", "target");
} catch (Exception ex) {
ex.printStackTrace();
fail();
Modified: struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELButtonTag.java
URL: http://svn.apache.org/viewcvs/struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELButtonTag.java?rev=376783&r1=376782&r2=376783&view=diff
==============================================================================
--- struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELButtonTag.java (original)
+++ struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELButtonTag.java Fri Feb 10 10:13:22 2006
@@ -1,28 +1,22 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.strutsel.taglib.html;
-import java.util.HashMap;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspException;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -31,31 +25,33 @@
import org.apache.strutsel.taglib.utils.JspTagTestCase;
import org.apache.strutsel.taglib.utils.TestHelper;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspException;
+
+import java.util.HashMap;
-public class TestELButtonTag
- extends JspTagTestCase {
- protected static final String REQUIRED_DISABLED_VALUE_KEY =
- "RequiredDisabledValue";
- protected static final String REQUIRED_TYPE_VALUE_KEY =
- "RequiredTypeValue";
- protected static final String REQUIRED_VALUE_VALUE_KEY =
- "RequiredValueValue";
- protected ELButtonTag elButtonTag = null;
-
- protected static String[] eventHandlers =
- {
- "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onkeydown",
- "onkeypress", "onkeyup", "onmousedown", "onmousemove", "onmouseout",
- "onmouseover", "onmouseup"
- };
+public class TestELButtonTag extends JspTagTestCase {
+ protected static final String REQUIRED_DISABLED_VALUE_KEY =
+ "RequiredDisabledValue";
+ protected static final String REQUIRED_TYPE_VALUE_KEY = "RequiredTypeValue";
+ protected static final String REQUIRED_VALUE_VALUE_KEY =
+ "RequiredValueValue";
+ protected static String[] eventHandlers =
+ {
+ "onblur", "onchange", "onclick", "ondblclick", "onfocus",
+ "onkeydown", "onkeypress", "onkeyup", "onmousedown", "onmousemove",
+ "onmouseout", "onmouseover", "onmouseup"
+ };
+ protected ELButtonTag elButtonTag = null;
public TestELButtonTag(String theName) {
super(theName);
}
public static void main(String[] args) {
- junit.awtui.TestRunner.main(
- new String[] { TestELButtonTag.class.getName() });
+ junit.awtui.TestRunner.main(new String[] { TestELButtonTag.class
+ .getName() });
}
public static Test suite() {
@@ -74,19 +70,20 @@
/**
* Tests a plain "button" tag, with all default attribute values.
*/
- public void testPlain()
- throws ServletException, JspException {
- HttpServletResponse response =
- (HttpServletResponse)pageContext.getResponse();
- String requiredTypeValue = "button";
+ public void testPlain() throws ServletException, JspException {
+ HttpServletResponse response =
+ (HttpServletResponse) pageContext.getResponse();
+ String requiredTypeValue = "button";
+
response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
String requiredValueValue = "Click";
+
response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
- int startTagReturn = elButtonTag.doStartTag();
+ int startTagReturn = elButtonTag.doStartTag();
int afterBodyReturn = elButtonTag.doAfterBody();
- int endTagReturn = elButtonTag.doEndTag();
+ int endTagReturn = elButtonTag.doEndTag();
}
public void endPlain(com.meterware.httpunit.WebResponse testResponse) {
@@ -94,18 +91,19 @@
TestHelper.printResponse(testResponse);
org.w3c.dom.Document document = testResponse.getDOM();
+
DOMHelper.printNode(document.getDocumentElement());
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/body/input", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] { "type", "value" },
- false);
- checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
- "button", "type");
- checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
- "button", "value");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/body/input", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "type", "value" }, false);
+ checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
+ "button", "type");
+ checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
+ "button", "value");
} catch (Exception ex) {
ex.printStackTrace();
fail();
@@ -116,16 +114,16 @@
* Tests the "disabled" attribute.
*/
public void testDisabled()
- throws ServletException, JspException {
-
+ throws ServletException, JspException {
elButtonTag.setDisabledExpr("true");
String requiredDisabledValue = "disabled";
+
response.addHeader(REQUIRED_DISABLED_VALUE_KEY, requiredDisabledValue);
- int startTagReturn = elButtonTag.doStartTag();
+ int startTagReturn = elButtonTag.doStartTag();
int afterBodyReturn = elButtonTag.doAfterBody();
- int endTagReturn = elButtonTag.doEndTag();
+ int endTagReturn = elButtonTag.doEndTag();
}
public void endDisabled(com.meterware.httpunit.WebResponse testResponse) {
@@ -133,16 +131,17 @@
TestHelper.printResponse(testResponse);
org.w3c.dom.Document document = testResponse.getDOM();
+
DOMHelper.printNode(document.getDocumentElement());
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/body/input", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] { "disabled" },
- true);
- checkAttrValue(attrMap, testResponse, REQUIRED_DISABLED_VALUE_KEY,
- "button", "disabled");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/body/input", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "disabled" }, true);
+ checkAttrValue(attrMap, testResponse, REQUIRED_DISABLED_VALUE_KEY,
+ "button", "disabled");
} catch (Exception ex) {
ex.printStackTrace();
fail();
@@ -150,12 +149,12 @@
}
public void testEventHandlers()
- throws ServletException, JspException
- {
- LabelValueBean bean = new LabelValueBean("junk", "stuff");
+ throws ServletException, JspException {
+ LabelValueBean bean = new LabelValueBean("junk", "stuff");
+
pageContext.setAttribute("testFormBean", bean);
- String expr = "${" + "testFormBean.value" + "}";
+ String expr = "${" + "testFormBean.value" + "}";
elButtonTag.setOnblurExpr(expr);
elButtonTag.setOnchangeExpr(expr);
@@ -171,30 +170,31 @@
elButtonTag.setOnmouseoverExpr(expr);
elButtonTag.setOnmouseupExpr(expr);
- int startTagReturn = elButtonTag.doStartTag();
+ int startTagReturn = elButtonTag.doStartTag();
int afterBodyReturn = elButtonTag.doAfterBody();
- int endTagReturn = elButtonTag.doEndTag();
+ int endTagReturn = elButtonTag.doEndTag();
}
- public void
- endEventHandlers(com.meterware.httpunit.WebResponse testResponse) {
+ public void endEventHandlers(
+ com.meterware.httpunit.WebResponse testResponse) {
try {
TestHelper.printResponse(testResponse);
org.w3c.dom.Document document = testResponse.getDOM();
+
DOMHelper.printNode(document.getDocumentElement());
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/body/input", attrMap);
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/body/input", attrMap);
DOMHelper.verifyAttributesPresent(attrMap, eventHandlers, true);
- for (int ctr = 0; ctr < eventHandlers.length; ++ ctr) {
- if (!((String) attrMap.get(eventHandlers[ctr])).
- equals("stuff")) {
+
+ for (int ctr = 0; ctr < eventHandlers.length; ++ctr) {
+ if (!((String) attrMap.get(eventHandlers[ctr])).equals("stuff")) {
fail();
}
}
-
} catch (Exception ex) {
ex.printStackTrace();
fail();
Modified: struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCancelTag.java
URL: http://svn.apache.org/viewcvs/struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCancelTag.java?rev=376783&r1=376782&r2=376783&view=diff
==============================================================================
--- struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCancelTag.java (original)
+++ struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCancelTag.java Fri Feb 10 10:13:22 2006
@@ -1,28 +1,22 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.strutsel.taglib.html;
-import java.util.HashMap;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspException;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -30,28 +24,29 @@
import org.apache.strutsel.taglib.utils.JspTagTestCase;
import org.apache.strutsel.taglib.utils.TestHelper;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspException;
-public class TestELCancelTag
- extends JspTagTestCase {
+import java.util.HashMap;
- protected static final String PROPERTY_ATTR_VALUE = "stuff";
- protected static final String REQUIRED_DISABLED_VALUE_KEY =
- "RequiredDisabledValue";
- protected static final String REQUIRED_TYPE_VALUE_KEY =
- "RequiredTypeValue";
- protected static final String REQUIRED_VALUE_VALUE_KEY =
- "RequiredValueValue";
- protected static final String REQUIRED_NAME_VALUE_KEY =
- "RequiredNameValue";
- protected ELCancelTag elCancelTag = null;
+public class TestELCancelTag extends JspTagTestCase {
+ protected static final String PROPERTY_ATTR_VALUE = "stuff";
+ protected static final String REQUIRED_DISABLED_VALUE_KEY =
+ "RequiredDisabledValue";
+ protected static final String REQUIRED_TYPE_VALUE_KEY = "RequiredTypeValue";
+ protected static final String REQUIRED_VALUE_VALUE_KEY =
+ "RequiredValueValue";
+ protected static final String REQUIRED_NAME_VALUE_KEY = "RequiredNameValue";
+ protected ELCancelTag elCancelTag = null;
public TestELCancelTag(String theName) {
super(theName);
}
public static void main(String[] args) {
- junit.awtui.TestRunner.main(
- new String[] { TestELCancelTag.class.getName() });
+ junit.awtui.TestRunner.main(new String[] { TestELCancelTag.class
+ .getName() });
}
public static Test suite() {
@@ -71,21 +66,25 @@
/**
* Tests a plain "cancel" tag, with all default attribute values.
*/
- public void testPlain()
- throws ServletException, JspException {
- HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
+ public void testPlain() throws ServletException, JspException {
+ HttpServletResponse response =
+ (HttpServletResponse) pageContext.getResponse();
+
+ String requiredNameValue = PROPERTY_ATTR_VALUE;
- String requiredNameValue = PROPERTY_ATTR_VALUE;
response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
- String requiredTypeValue = "submit";
+
+ String requiredTypeValue = "submit";
+
response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
String requiredValueValue = "Cancel";
+
response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
- int startTagReturn = elCancelTag.doStartTag();
+ int startTagReturn = elCancelTag.doStartTag();
int afterBodyReturn = elCancelTag.doAfterBody();
- int endTagReturn = elCancelTag.doEndTag();
+ int endTagReturn = elCancelTag.doEndTag();
}
public void endPlain(com.meterware.httpunit.WebResponse testResponse) {
@@ -93,22 +92,22 @@
TestHelper.printResponse(testResponse);
org.w3c.dom.Document document = testResponse.getDOM();
+
DOMHelper.printNode(document.getDocumentElement());
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/body/input", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] {
- "name", "type", "value", "onclick" },
- false);
-
- checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
- "cancel", "name");
- checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
- "cancel", "type");
- checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
- "cancel", "value");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/body/input", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "name", "type", "value", "onclick" }, false);
+
+ checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
+ "cancel", "name");
+ checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
+ "cancel", "type");
+ checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
+ "cancel", "value");
} catch (Exception ex) {
ex.printStackTrace();
fail();
@@ -119,16 +118,16 @@
* Tests the "disabled" attribute.
*/
public void testDisabled()
- throws ServletException, JspException {
-
+ throws ServletException, JspException {
elCancelTag.setDisabledExpr("true");
String requiredDisabledValue = "disabled";
+
response.addHeader(REQUIRED_DISABLED_VALUE_KEY, requiredDisabledValue);
- int startTagReturn = elCancelTag.doStartTag();
+ int startTagReturn = elCancelTag.doStartTag();
int afterBodyReturn = elCancelTag.doAfterBody();
- int endTagReturn = elCancelTag.doEndTag();
+ int endTagReturn = elCancelTag.doEndTag();
}
public void endDisabled(com.meterware.httpunit.WebResponse testResponse) {
@@ -136,16 +135,17 @@
TestHelper.printResponse(testResponse);
org.w3c.dom.Document document = testResponse.getDOM();
+
DOMHelper.printNode(document.getDocumentElement());
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/body/input", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] { "disabled" },
- true);
- checkAttrValue(attrMap, testResponse, REQUIRED_DISABLED_VALUE_KEY,
- "cancel", "disabled");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/body/input", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "disabled" }, true);
+ checkAttrValue(attrMap, testResponse, REQUIRED_DISABLED_VALUE_KEY,
+ "cancel", "disabled");
} catch (Exception ex) {
ex.printStackTrace();
fail();
Modified: struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCheckboxTag.java
URL: http://svn.apache.org/viewcvs/struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCheckboxTag.java?rev=376783&r1=376782&r2=376783&view=diff
==============================================================================
--- struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCheckboxTag.java (original)
+++ struts/el/trunk/src/test/org/apache/strutsel/taglib/html/TestELCheckboxTag.java Fri Feb 10 10:13:22 2006
@@ -1,28 +1,22 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.strutsel.taglib.html;
-import java.util.HashMap;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspException;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -31,29 +25,32 @@
import org.apache.strutsel.taglib.utils.TestFormBean;
import org.apache.strutsel.taglib.utils.TestHelper;
-public class TestELCheckboxTag
- extends JspTagTestCase {
- protected static final String PROPERTY_ATTR_VALUE =
- "stringProperty";
- protected static final String REQUIRED_CHECKED_VALUE_KEY =
- "RequiredCheckedValue";
- protected static final String REQUIRED_DISABLED_VALUE_KEY =
- "RequiredDisabledValue";
- protected static final String REQUIRED_NAME_VALUE_KEY =
- "RequiredNameValue";
- protected static final String REQUIRED_TYPE_VALUE_KEY =
- "RequiredTypeValue";
- protected static final String REQUIRED_VALUE_VALUE_KEY =
- "RequiredValueValue";
- protected ELCheckboxTag elCheckboxTag = null;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspException;
+
+import java.util.HashMap;
+
+public class TestELCheckboxTag extends JspTagTestCase {
+ protected static final String PROPERTY_ATTR_VALUE = "stringProperty";
+ protected static final String REQUIRED_CHECKED_VALUE_KEY =
+ "RequiredCheckedValue";
+ protected static final String REQUIRED_DISABLED_VALUE_KEY =
+ "RequiredDisabledValue";
+ protected static final String REQUIRED_NAME_VALUE_KEY = "RequiredNameValue";
+ protected static final String REQUIRED_TYPE_VALUE_KEY = "RequiredTypeValue";
+ protected static final String REQUIRED_VALUE_VALUE_KEY =
+ "RequiredValueValue";
+ protected ELCheckboxTag elCheckboxTag = null;
public TestELCheckboxTag(String theName) {
super(theName);
}
public static void main(String[] args) {
- junit.awtui.TestRunner.main(
- new String[] { TestELCheckboxTag.class.getName() });
+ junit.awtui.TestRunner.main(new String[] {
+ TestELCheckboxTag.class.getName()
+ });
}
public static Test suite() {
@@ -74,26 +71,30 @@
* Tests a plain "checkbox" tag, with the "property" attribute set to a
* plain value.
*/
- public void testPlain()
- throws ServletException, JspException {
- HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
- String requiredNameValue = PROPERTY_ATTR_VALUE;
+ public void testPlain() throws ServletException, JspException {
+ HttpServletResponse response =
+ (HttpServletResponse) pageContext.getResponse();
+ String requiredNameValue = PROPERTY_ATTR_VALUE;
+
response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
String requiredTypeValue = "checkbox";
+
response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
String requiredValueValue = "on";
+
response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
TestFormBean formBean = new TestFormBean();
+
pageContext.setAttribute("testFormBean", formBean);
elCheckboxTag.setNameExpr("testFormBean");
- int startTagReturn = elCheckboxTag.doStartTag();
+ int startTagReturn = elCheckboxTag.doStartTag();
int afterBodyReturn = elCheckboxTag.doAfterBody();
- int endTagReturn = elCheckboxTag.doEndTag();
+ int endTagReturn = elCheckboxTag.doEndTag();
}
public void endPlain(com.meterware.httpunit.WebResponse testResponse) {
@@ -102,232 +103,197 @@
DOMHelper.printNode(testResponse.getDOM().getDocumentElement());
HashMap attrMap = new HashMap();
- DOMHelper.recordFoundAttributes(testResponse.getDOM(),
- "/html/body/input", attrMap);
- DOMHelper.verifyAttributesPresent(attrMap,
- new String[] {
- "name", "type", "value"
- }, false);
- checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
- "checkbox", "name");
- checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
- "checkbox", "type");
- checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
- "checkbox", "value");
+
+ DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ "/html/body/input", attrMap);
+ DOMHelper.verifyAttributesPresent(attrMap,
+ new String[] { "name", "type", "value" }, false);
+ checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
+ "checkbox", "name");
+ checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
+ "checkbox", "type");
+ checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
+ "checkbox", "value");
} catch (Exception ex) {
ex.printStackTrace();
fail();
}
}
-// /**
-// * Tests the "property" attribute referencing an indexed value, verifying
-// * it emits the "checked" attribute.
-// */
-// public void testCollectionProperty()
-// throws ServletException, JspException {
-// HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
-// elCheckboxTag.setName(PROPERTY_ATTR_VALUE + "[1]");
-
-// String requiredNameValue = PROPERTY_ATTR_VALUE + "[1]";
-// response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
-
-// String requiredTypeValue = "checkbox";
-// response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
-
-// String requiredValueValue = "on";
-// response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
-
-// String requiredCheckedValue = "checked";
-// response.addHeader(REQUIRED_CHECKED_VALUE_KEY, requiredCheckedValue);
-
-// ArrayList list = new ArrayList();
-// list.add("off");
-// list.add("on");
-// pageContext.setAttribute(PROPERTY_ATTR_VALUE, list,
-// PageContext.PAGE_SCOPE);
-
-// int startTagReturn = elCheckboxTag.doStartTag();
-// int afterBodyReturn = elCheckboxTag.doAfterBody();
-// int endTagReturn = elCheckboxTag.doEndTag();
-// }
-
-// public void endCollectionProperty(com.meterware.httpunit.WebResponse testResponse) {
-// try {
-// TestHelper.printResponse(testResponse);
-
-// Element docElement = testResponse.getDOM().getDocumentElement();
-// DOMHelper.printNode(docElement);
-
-// HashMap attrMap = new HashMap();
-// DOMHelper.recordFoundAttributes(testResponse.getDOM(),
-// "/html/body/input", attrMap);
-// DOMHelper.verifyAttributesPresent(attrMap,
-// new String[] {
-// "name", "type", "value", "checked"
-// }, false);
-// checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
-// "checkbox", "name");
-// checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
-// "checkbox", "type");
-// checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
-// "checkbox", "value");
-// checkAttrValue(attrMap, testResponse, REQUIRED_CHECKED_VALUE_KEY,
-// "checkbox", "checked");
-// } catch (Exception ex) {
-// ex.printStackTrace();
-// fail();
-// }
-// }
-
-// /**
-// * Tests the "property" attribute referencing an indexed value, verifying
-// * it does not emit the "checked" attribute.
-// */
-// public void testCollectionPropertyNotChecked()
-// throws ServletException,
-// JspException {
-// HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
-// elCheckboxTag.setName(PROPERTY_ATTR_VALUE + "[0]");
-
-// String requiredNameValue = PROPERTY_ATTR_VALUE + "[0]";
-// response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
-
-// String requiredTypeValue = "checkbox";
-// response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
-
-// String requiredValueValue = "on";
-// response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
-
-// ArrayList list = new ArrayList();
-// list.add("off");
-// list.add("on");
-// pageContext.setAttribute(PROPERTY_ATTR_VALUE, list,
-// PageContext.PAGE_SCOPE);
-
-// int startTagReturn = elCheckboxTag.doStartTag();
-// int afterBodyReturn = elCheckboxTag.doAfterBody();
-// int endTagReturn = elCheckboxTag.doEndTag();
-// }
-
-// public void endCollectionPropertyNotChecked(com.meterware.httpunit.WebResponse testResponse) {
-// try {
-// TestHelper.printResponse(testResponse);
-
-// Element docElement = testResponse.getDOM().getDocumentElement();
-// DOMHelper.printNode(docElement);
-
-// HashMap attrMap = new HashMap();
-// DOMHelper.recordFoundAttributes(testResponse.getDOM(),
-// "/html/body/input", attrMap);
-// DOMHelper.verifyAttributesPresent(attrMap,
-// new String[] {
-// "name", "type", "value"
-// }, false);
-// DOMHelper.verifyAttributesNotPresent(attrMap,
-// new String[] { "checked" });
-// checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
-// "checkbox", "name");
-// checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
-// "checkbox", "type");
-// checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
-// "checkbox", "value");
-// } catch (Exception ex) {
-// ex.printStackTrace();
-// fail();
-// }
-// }
-
-// /**
-// * Tests the "disabled" attribute.
-// */
-// public void testDisabled()
-// throws ServletException, JspException {
-
-// elCheckboxTag.setDisabled(true);
-
-// String requiredDisabledValue = "disabled";
-// response.addHeader(REQUIRED_DISABLED_VALUE_KEY, requiredDisabledValue);
-// elCheckboxTag.setName("flork");
-
-// int startTagReturn = elCheckboxTag.doStartTag();
-// int afterBodyReturn = elCheckboxTag.doAfterBody();
-// int endTagReturn = elCheckboxTag.doEndTag();
-// }
-
-// public void endDisabled(com.meterware.httpunit.WebResponse testResponse) {
-// try {
-// TestHelper.printResponse(testResponse);
-
-// Element docElement = testResponse.getDOM().getDocumentElement();
-// DOMHelper.printNode(docElement);
-
-// HashMap attrMap = new HashMap();
-// DOMHelper.recordFoundAttributes(testResponse.getDOM(),
-// "/html/body/input", attrMap);
-// DOMHelper.verifyAttributesPresent(attrMap,
-// new String[] { "disabled" },
-// true);
-// checkAttrValue(attrMap, testResponse, REQUIRED_DISABLED_VALUE_KEY,
-// "checkbox", "disabled");
-// } catch (Exception ex) {
-// ex.printStackTrace();
-// fail();
-// }
-// }
-
-// /**
-// * Tests the "property" and "checked" attributes, using a simple value in
-// * page scope.
-// */
-// public void testProperty()
-// throws ServletException, JspException {
-// HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
-// String requiredNameValue = PROPERTY_ATTR_VALUE;
-// response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
-
-// String requiredTypeValue = "checkbox";
-// response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
-
-// String requiredValueValue = "on";
-// response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
-
-// String requiredCheckedValue = "checked";
-// response.addHeader(REQUIRED_CHECKED_VALUE_KEY, requiredCheckedValue);
-// pageContext.setAttribute(PROPERTY_ATTR_VALUE, "on",
-// PageContext.PAGE_SCOPE);
-
-// int startTagReturn = elCheckboxTag.doStartTag();
-// int afterBodyReturn = elCheckboxTag.doAfterBody();
-// int endTagReturn = elCheckboxTag.doEndTag();
-// }
-
-// public void endProperty(com.meterware.httpunit.WebResponse testResponse) {
-// try {
-// TestHelper.printResponse(testResponse);
-
-// Element docElement = testResponse.getDOM().getDocumentElement();
-// DOMHelper.printNode(docElement);
-
-// HashMap attrMap = new HashMap();
-// DOMHelper.recordFoundAttributes(testResponse.getDOM(),
-// "/html/body/input", attrMap);
-// DOMHelper.verifyAttributesPresent(attrMap,
-// new String[] {
-// "name", "type", "value", "checked"
-// }, false);
-
-// checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
-// "checkbox", "name");
-// checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
-// "checkbox", "type");
-// checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
-// "checkbox", "value");
-// checkAttrValue(attrMap, testResponse, REQUIRED_CHECKED_VALUE_KEY,
-// "checkbox", "checked");
-// } catch (Exception ex) {
-// ex.printStackTrace();
-// fail();
-// }
-// }
+ // /**
+ // * Tests the "property" attribute referencing an indexed value, verifying
+ // * it emits the "checked" attribute.
+ // */
+ // public void testCollectionProperty()
+ // throws ServletException, JspException {
+ // HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
+ // elCheckboxTag.setName(PROPERTY_ATTR_VALUE + "[1]");
+ // String requiredNameValue = PROPERTY_ATTR_VALUE + "[1]";
+ // response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
+ // String requiredTypeValue = "checkbox";
+ // response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
+ // String requiredValueValue = "on";
+ // response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
+ // String requiredCheckedValue = "checked";
+ // response.addHeader(REQUIRED_CHECKED_VALUE_KEY, requiredCheckedValue);
+ // ArrayList list = new ArrayList();
+ // list.add("off");
+ // list.add("on");
+ // pageContext.setAttribute(PROPERTY_ATTR_VALUE, list,
+ // PageContext.PAGE_SCOPE);
+ // int startTagReturn = elCheckboxTag.doStartTag();
+ // int afterBodyReturn = elCheckboxTag.doAfterBody();
+ // int endTagReturn = elCheckboxTag.doEndTag();
+ // }
+ // public void endCollectionProperty(com.meterware.httpunit.WebResponse testResponse) {
+ // try {
+ // TestHelper.printResponse(testResponse);
+ // Element docElement = testResponse.getDOM().getDocumentElement();
+ // DOMHelper.printNode(docElement);
+ // HashMap attrMap = new HashMap();
+ // DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ // "/html/body/input", attrMap);
+ // DOMHelper.verifyAttributesPresent(attrMap,
+ // new String[] {
+ // "name", "type", "value", "checked"
+ // }, false);
+ // checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
+ // "checkbox", "name");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
+ // "checkbox", "type");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
+ // "checkbox", "value");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_CHECKED_VALUE_KEY,
+ // "checkbox", "checked");
+ // } catch (Exception ex) {
+ // ex.printStackTrace();
+ // fail();
+ // }
+ // }
+ // /**
+ // * Tests the "property" attribute referencing an indexed value, verifying
+ // * it does not emit the "checked" attribute.
+ // */
+ // public void testCollectionPropertyNotChecked()
+ // throws ServletException,
+ // JspException {
+ // HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
+ // elCheckboxTag.setName(PROPERTY_ATTR_VALUE + "[0]");
+ // String requiredNameValue = PROPERTY_ATTR_VALUE + "[0]";
+ // response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
+ // String requiredTypeValue = "checkbox";
+ // response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
+ // String requiredValueValue = "on";
+ // response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
+ // ArrayList list = new ArrayList();
+ // list.add("off");
+ // list.add("on");
+ // pageContext.setAttribute(PROPERTY_ATTR_VALUE, list,
+ // PageContext.PAGE_SCOPE);
+ // int startTagReturn = elCheckboxTag.doStartTag();
+ // int afterBodyReturn = elCheckboxTag.doAfterBody();
+ // int endTagReturn = elCheckboxTag.doEndTag();
+ // }
+ // public void endCollectionPropertyNotChecked(com.meterware.httpunit.WebResponse testResponse) {
+ // try {
+ // TestHelper.printResponse(testResponse);
+ // Element docElement = testResponse.getDOM().getDocumentElement();
+ // DOMHelper.printNode(docElement);
+ // HashMap attrMap = new HashMap();
+ // DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ // "/html/body/input", attrMap);
+ // DOMHelper.verifyAttributesPresent(attrMap,
+ // new String[] {
+ // "name", "type", "value"
+ // }, false);
+ // DOMHelper.verifyAttributesNotPresent(attrMap,
+ // new String[] { "checked" });
+ // checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
+ // "checkbox", "name");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
+ // "checkbox", "type");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
+ // "checkbox", "value");
+ // } catch (Exception ex) {
+ // ex.printStackTrace();
+ // fail();
+ // }
+ // }
+ // /**
+ // * Tests the "disabled" attribute.
+ // */
+ // public void testDisabled()
+ // throws ServletException, JspException {
+ // elCheckboxTag.setDisabled(true);
+ // String requiredDisabledValue = "disabled";
+ // response.addHeader(REQUIRED_DISABLED_VALUE_KEY, requiredDisabledValue);
+ // elCheckboxTag.setName("flork");
+ // int startTagReturn = elCheckboxTag.doStartTag();
+ // int afterBodyReturn = elCheckboxTag.doAfterBody();
+ // int endTagReturn = elCheckboxTag.doEndTag();
+ // }
+ // public void endDisabled(com.meterware.httpunit.WebResponse testResponse) {
+ // try {
+ // TestHelper.printResponse(testResponse);
+ // Element docElement = testResponse.getDOM().getDocumentElement();
+ // DOMHelper.printNode(docElement);
+ // HashMap attrMap = new HashMap();
+ // DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ // "/html/body/input", attrMap);
+ // DOMHelper.verifyAttributesPresent(attrMap,
+ // new String[] { "disabled" },
+ // true);
+ // checkAttrValue(attrMap, testResponse, REQUIRED_DISABLED_VALUE_KEY,
+ // "checkbox", "disabled");
+ // } catch (Exception ex) {
+ // ex.printStackTrace();
+ // fail();
+ // }
+ // }
+ // /**
+ // * Tests the "property" and "checked" attributes, using a simple value in
+ // * page scope.
+ // */
+ // public void testProperty()
+ // throws ServletException, JspException {
+ // HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
+ // String requiredNameValue = PROPERTY_ATTR_VALUE;
+ // response.addHeader(REQUIRED_NAME_VALUE_KEY, requiredNameValue);
+ // String requiredTypeValue = "checkbox";
+ // response.addHeader(REQUIRED_TYPE_VALUE_KEY, requiredTypeValue);
+ // String requiredValueValue = "on";
+ // response.addHeader(REQUIRED_VALUE_VALUE_KEY, requiredValueValue);
+ // String requiredCheckedValue = "checked";
+ // response.addHeader(REQUIRED_CHECKED_VALUE_KEY, requiredCheckedValue);
+ // pageContext.setAttribute(PROPERTY_ATTR_VALUE, "on",
+ // PageContext.PAGE_SCOPE);
+ // int startTagReturn = elCheckboxTag.doStartTag();
+ // int afterBodyReturn = elCheckboxTag.doAfterBody();
+ // int endTagReturn = elCheckboxTag.doEndTag();
+ // }
+ // public void endProperty(com.meterware.httpunit.WebResponse testResponse) {
+ // try {
+ // TestHelper.printResponse(testResponse);
+ // Element docElement = testResponse.getDOM().getDocumentElement();
+ // DOMHelper.printNode(docElement);
+ // HashMap attrMap = new HashMap();
+ // DOMHelper.recordFoundAttributes(testResponse.getDOM(),
+ // "/html/body/input", attrMap);
+ // DOMHelper.verifyAttributesPresent(attrMap,
+ // new String[] {
+ // "name", "type", "value", "checked"
+ // }, false);
+ // checkAttrValue(attrMap, testResponse, REQUIRED_NAME_VALUE_KEY,
+ // "checkbox", "name");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_TYPE_VALUE_KEY,
+ // "checkbox", "type");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_VALUE_VALUE_KEY,
+ // "checkbox", "value");
+ // checkAttrValue(attrMap, testResponse, REQUIRED_CHECKED_VALUE_KEY,
+ // "checkbox", "checked");
+ // } catch (Exception ex) {
+ // ex.printStackTrace();
+ // fail();
+ // }
+ // }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org