You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2006/06/26 08:31:49 UTC
svn commit: r417129 - in /beehive/trunk/netui/test:
src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/
src/junitTests/org/apache/beehive/netui/test/servlet/
webapps/drt/src/controls/pfbeancontext/
webapps/drt/src/org/apache/beehive/netui/te...
Author: crogers
Date: Sun Jun 25 23:31:48 2006
New Revision: 417129
URL: http://svn.apache.org/viewvc?rev=417129&view=rev
Log:
Add a new ScopedRequest junit test and a TestRecorder test of a form bean that extends the Struts ActionForm and overrides validate().
Also add missing copyright to some test src and minor cleanup.
tests: NetUI BVT (winXP pass)
Added:
beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/
beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/ScopedRequestTest.java (with props)
beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/
beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/Controller.java (with props)
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateActionForm.xml (with props)
beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/
beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/index.jsp (with props)
Modified:
beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/servlet/HttpServletRequestHandler.java
beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java
beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControl.java
beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControlImpl.java
beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
beehive/trunk/netui/test/webapps/drt/web/miniTests/validation/Controller.java
Added: beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/ScopedRequestTest.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/ScopedRequestTest.java?rev=417129&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/ScopedRequestTest.java (added)
+++ beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/ScopedRequestTest.java Sun Jun 25 23:31:48 2006
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.pageflow.scoping;
+
+import java.util.Enumeration;
+import javax.servlet.http.HttpServletRequest;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.beehive.netui.test.servlet.ServletFactory;
+import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
+import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+
+public class ScopedRequestTest extends TestCase {
+
+ private HttpServletRequest _fauxRequest = null;
+ private ScopedRequest _fauxScopedRequest = null;
+ protected String _servletPath = "/somePageFlow/begin.do";
+ protected String _scopeId = "_scopeTest";
+ protected String _paramNameA = "scopedParamA";
+ protected String _paramValueA = "foo";
+ protected String _paramNameB = "scopedParamB";
+ protected String _paramValueB = "bar";
+ protected String _outerParamName = "outerParam";
+ protected String _outerParamValue = "foobar";
+ protected String _query = _outerParamName + "=" + _outerParamValue + "&"
+ + _scopeId + _paramNameA + "=" + _paramValueA
+ + "&" + _scopeId + _paramNameB + "=" + _paramValueB;
+ protected String _attrNameA = "scopedAttrA";
+ protected String _attrValueA = "scopedAttrValueA";
+ protected String _outerAttrName = "outerAttr";
+ protected String _outerAttrValue = "outerAttrValue";
+
+ public ScopedRequestTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return new TestSuite(ScopedRequestTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+
+ public HttpServletRequest getRequest() {
+ return _fauxRequest;
+ }
+
+ public ScopedRequest getScopedRequest() {
+ return _fauxScopedRequest;
+ }
+
+ protected void setUp() {
+ _fauxRequest = ServletFactory.getServletRequest(_query);
+ _fauxRequest.setAttribute(_outerAttrName, _outerAttrValue);
+
+ String requestUri = _fauxRequest.getContextPath() + _servletPath;
+ boolean seeOuterRequestAttributes = false;
+ _fauxScopedRequest = ScopedServletUtils.getScopedRequest(_fauxRequest, requestUri, null, _scopeId, seeOuterRequestAttributes);
+ _fauxScopedRequest.setAttribute(_attrNameA, _attrValueA);
+ }
+
+ protected void tearDown() {
+ }
+
+ public void testScopedRequest() {
+ ScopedRequest scopedRequest = getScopedRequest();
+ assertEquals(getRequest(), scopedRequest.getOuterRequest());
+
+ assertEquals(getRequest().getContextPath(), scopedRequest.getContextPath());
+ String requestUri = getRequest().getContextPath() + _servletPath;
+ assertEquals(requestUri, scopedRequest.getRequestURI());
+ assertEquals(_servletPath, scopedRequest.getServletPath());
+ assertEquals(_query, scopedRequest.getQueryString());
+
+ String newServletPath = "/someOtherPageFlow/begin.do";
+ requestUri = getRequest().getContextPath() + newServletPath;
+ scopedRequest.setRequestURI(requestUri);
+ assertEquals(requestUri, scopedRequest.getRequestURI());
+ assertEquals(newServletPath, scopedRequest.getServletPath());
+ assertEquals(_query, scopedRequest.getQueryString());
+ }
+
+ public void testScopedRequestScopeKey() {
+ ScopedRequest scopedRequest = getScopedRequest();
+ assertEquals(_scopeId, scopedRequest.getScopeKey());
+ String name = "MyName";
+ assertEquals(_scopeId + name, scopedRequest.getScopedName(name));
+
+ String newScopeId = "newScopeId";
+ scopedRequest.renameScope(newScopeId);
+ assertEquals(newScopeId, scopedRequest.getScopeKey());
+ assertEquals(newScopeId + name, scopedRequest.getScopedName(name));
+ }
+
+ public void testScopedRequestParameters() {
+ HttpServletRequest request = getRequest();
+ assertEquals(_outerParamValue, request.getParameter(_outerParamName));
+ assertNull(request.getParameter(_paramNameA));
+ assertNull(request.getParameter(_paramNameB));
+
+ ScopedRequest scopedRequest = getScopedRequest();
+ assertNull(scopedRequest.getParameter(_outerParamName));
+ assertEquals(_paramValueA, scopedRequest.getParameter(_paramNameA));
+ assertEquals(_paramValueB, scopedRequest.getParameter(_paramNameB));
+
+ // the setUp() should only give us two scoped params
+ Enumeration names = scopedRequest.getParameterNames();
+ assertNotNull("The scoped request parameter names was returned as null", names);
+ int count = 0;
+ if (names != null) {
+ while (names.hasMoreElements()) {
+ count++;
+ String name = (String) names.nextElement();
+ String[] values = scopedRequest.getParameterValues(name);
+ assertNotNull("The scoped request parameter values returned null", values);
+ if (values != null && values.length > 0) {
+ if (name.equals(_paramNameA)) {
+ assertEquals(_paramValueA, values[0]);
+ }
+ else if (name.equals(_paramNameB)) {
+ assertEquals(_paramValueB, values[0]);
+ }
+ else {
+ fail("Incorrect parameter value returned");
+ }
+ }
+ else {
+ fail("the test should return parameter values");
+ }
+ }
+ }
+ assertEquals(2, count);
+ }
+
+ public void testScopedRequestAttributes() {
+ HttpServletRequest request = getRequest();
+ assertEquals(_outerAttrValue, request.getAttribute(_outerAttrName));
+ assertNull(request.getAttribute(_attrNameA));
+
+ ScopedRequest scopedRequest = getScopedRequest();
+ assertNull(scopedRequest.getAttribute(_outerAttrName));
+ assertEquals(_attrValueA, scopedRequest.getAttribute(_attrNameA));
+
+ // the setUp() should only give us one scoped attribute
+ java.util.Enumeration names = scopedRequest.getAttributeNames();
+ assertNotNull("The scoped request attribute names was returned as null", names);
+ int count = 0;
+ if (names != null) {
+ while (names.hasMoreElements()) {
+ count++;
+ String name = (String) names.nextElement();
+ Object value = scopedRequest.getAttribute(name);
+ assertNotNull("The scoped request attribute value returned null", value);
+ if (name.equals(_attrNameA)) {
+ assertEquals(_attrValueA, value);
+ }
+ else {
+ fail("Incorrect attribute value returned");
+ }
+ }
+ }
+ assertEquals(1, count);
+
+ String attrName = "myReqAttr";
+ Object attrValue = new StringBuffer("Attribute Value Object");
+ request.setAttribute(attrName, attrValue);
+ String scopedAttrName = "myScopedReqAttr";
+ Object scopedAttrValue = new StringBuffer("Scoped Attr Value Object");
+ scopedRequest.setAttribute(scopedAttrName, scopedAttrValue);
+ assertEquals(attrValue, request.getAttribute(attrName));
+ assertNull(request.getAttribute(scopedAttrName));
+ assertNull(scopedRequest.getAttribute(attrName));
+ assertEquals(scopedAttrValue, scopedRequest.getAttribute(scopedAttrName));
+
+ scopedRequest.removeAttribute(attrName);
+ assertEquals(attrValue, request.getAttribute(attrName));
+ scopedRequest.removeAttribute(scopedAttrName);
+ assertNull(scopedRequest.getAttribute(scopedAttrName));
+
+ scopedRequest.registerOuterAttribute(attrName);
+ assertEquals(attrValue, scopedRequest.getAttribute(attrName));
+ }
+
+ public void testSeeOuterRequestAttributes() {
+ HttpServletRequest request = ServletFactory.getServletRequest(_query);
+ request.setAttribute(_outerAttrName, _outerAttrValue);
+ String requestUri = request.getContextPath() + _servletPath;
+ ScopedRequest scopedRequest = ScopedServletUtils.getScopedRequest(request, requestUri, null, _scopeId, true);
+ scopedRequest.setAttribute(_attrNameA, _attrValueA);
+ assertEquals(_outerAttrValue, request.getAttribute(_outerAttrName));
+ assertNull(request.getAttribute(_attrNameA));
+ assertEquals(_outerAttrValue, scopedRequest.getAttribute(_outerAttrName));
+ assertEquals(_attrValueA, scopedRequest.getAttribute(_attrNameA));
+ }
+}
Propchange: beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/pageflow/scoping/ScopedRequestTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/servlet/HttpServletRequestHandler.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/servlet/HttpServletRequestHandler.java?rev=417129&r1=417128&r2=417129&view=diff
==============================================================================
--- beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/servlet/HttpServletRequestHandler.java (original)
+++ beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/servlet/HttpServletRequestHandler.java Sun Jun 25 23:31:48 2006
@@ -127,6 +127,8 @@
return _session;
else if(method.getName().equals("getContentType"))
return null;
+ else if(method.getName().equals("getCharacterEncoding"))
+ return "utf-8";
else if(method.getName().equals("getMethod"))
return "POST";
else if(method.getName().equals("getParameterMap")) {
Modified: beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java?rev=417129&r1=417128&r2=417129&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java Sun Jun 25 23:31:48 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Header:$
+ */
package controls.pfbeancontext;
import javax.servlet.http.HttpSession;
Modified: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControl.java?rev=417129&r1=417128&r2=417129&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControl.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControl.java Sun Jun 25 23:31:48 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Header:$
+ */
package org.apache.beehive.netui.test.controls.pfcontainer;
import org.apache.beehive.netui.pageflow.FlowController;
Modified: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControlImpl.java?rev=417129&r1=417128&r2=417129&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControlImpl.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/pfcontainer/PageFlowContextControlImpl.java Sun Jun 25 23:31:48 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Header:$
+ */
package org.apache.beehive.netui.test.controls.pfcontainer;
import org.apache.beehive.controls.api.context.Context;
Added: beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/Controller.java?rev=417129&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/Controller.java Sun Jun 25 23:31:48 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Header:$
+ */
+package validation.actionForm;
+
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.struts.action.ActionError;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionErrors;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.Serializable;
+
+// This test uses a form bean that extends the Struts ActionForm and overrides
+// the validate() method to ensure we support this user code path.
+// It is similar to the Struts Validatable interface test,
+// miniTests.validation.Controller
+@Jpf.Controller(
+ messageBundles = {
+ @Jpf.MessageBundle(
+ bundlePath = "resources.application")
+ })
+public class Controller extends PageFlowController
+{
+ public static class Form extends ActionForm implements Serializable
+ {
+ private String _text;
+ public String getText() {
+ return _text;
+ }
+ public void setText(String text) {
+ _text = text;
+ }
+
+ public ActionErrors validate(ActionMapping mapping,
+ HttpServletRequest request) {
+ ActionErrors errors = new ActionErrors();
+ if (_text == null || !_text.equals("pass")) {
+ errors.add("text", new ActionError("error.text.validate"));
+ }
+ return errors;
+ }
+ }
+
+ @Jpf.Action(
+ validationErrorForward = @Jpf.Forward(
+ name="validationFailure",
+ path="index.jsp"),
+ forwards = {
+ @Jpf.Forward(
+ name = "linkOne",
+ path = "index.jsp")
+ })
+ public Forward testValidate(Form form)
+ {
+ return new Forward("linkOne");
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "begin",
+ path = "index.jsp")
+ })
+ public Forward begin()
+ {
+ return new Forward("begin");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/validation/actionForm/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?rev=417129&r1=417128&r2=417129&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Sun Jun 25 23:31:48 2006
@@ -8568,6 +8568,20 @@
</features>
</test>
<test>
+ <name>ValidateActionForm</name>
+ <description>Test a form bean that extends the Struts ActionForm and overrides validate().</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>bvt.struts11</category>
+ <category>corePageFlow</category>
+ </categories>
+ <features>
+ <feature>Form</feature>
+ <feature>Validation</feature>
+ </features>
+ </test>
+ <test>
<name>ValidateCustom</name>
<description>Test of the @Jpf.ValidateCustom annotation, for user custom validation rules.</description>
<webapp>coreWeb</webapp>
Added: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateActionForm.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateActionForm.xml?rev=417129&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateActionForm.xml (added)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateActionForm.xml Sun Jun 25 23:31:48 2006
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<recorderSession xmlns="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+<sessionName>ValidateActionForm</sessionName>
+<tester>crogers</tester>
+<startDate>19 Jun 2006, 02:58:59.493 PM MDT</startDate>
+<description>Test a form bean that extends the Struts ActionForm and overrides validate()</description>
+<tests>
+<test>
+<testNumber>1</testNumber>
+<request>
+<protocol>HTTP</protocol>
+<protocolVersion>1.1</protocolVersion>
+<host>localhost</host>
+<port>8080</port>
+<uri>/coreWeb/validation/actionForm/begin.do</uri>
+<method>GET</method>
+<parameters>
+</parameters>
+<cookies>
+<cookie>
+<name>JSESSIONID</name>
+<value>5DCDC228064944277B7A798B348DED22</value>
+</cookie>
+</cookies>
+<headers>
+<header>
+<name>accept</name>
+<value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</value>
+</header>
+<header>
+<name>accept-charset</name>
+<value>UTF-8,*</value>
+</header>
+<header>
+<name>accept-encoding</name>
+<value>gzip,deflate</value>
+</header>
+<header>
+<name>accept-language</name>
+<value>en-us,en;q=0.5</value>
+</header>
+<header>
+<name>connection</name>
+<value>keep-alive</value>
+</header>
+<header>
+<name>cookie</name>
+<value>JSESSIONID=5DCDC228064944277B7A798B348DED22</value>
+</header>
+<header>
+<name>host</name>
+<value>localhost:8080</value>
+</header>
+<header>
+<name>keep-alive</name>
+<value>300</value>
+</header>
+<header>
+<name>user-agent</name>
+<value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4</value>
+</header>
+</headers>
+</request>
+<response>
+<statusCode>200</statusCode>
+<reason></reason>
+<responseBody>
+<![CDATA[<html>
+<head>
+ <title>ActionForm Validation Test</title>
+</head>
+<body>
+ <form action="/coreWeb/validation/actionForm/testValidate.do" method="post">
+ Text: <input type="text" name="{actionForm.text}">
+ <input type="submit" value="Submit">
+ </form>
+
+</body>
+</html>]]>
+</responseBody>
+</response>
+</test>
+<test>
+<testNumber>2</testNumber>
+<request>
+<protocol>HTTP</protocol>
+<protocolVersion>1.1</protocolVersion>
+<host>localhost</host>
+<port>8080</port>
+<uri>/coreWeb/validation/actionForm/testValidate.do</uri>
+<method>POST</method>
+<parameters>
+<parameter>
+<name>{actionForm.text}</name>
+<value>Error</value>
+</parameter>
+</parameters>
+<cookies>
+<cookie>
+<name>JSESSIONID</name>
+<value>5DCDC228064944277B7A798B348DED22</value>
+</cookie>
+</cookies>
+<headers>
+<header>
+<name>accept</name>
+<value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</value>
+</header>
+<header>
+<name>accept-charset</name>
+<value>UTF-8,*</value>
+</header>
+<header>
+<name>accept-encoding</name>
+<value>gzip,deflate</value>
+</header>
+<header>
+<name>accept-language</name>
+<value>en-us,en;q=0.5</value>
+</header>
+<header>
+<name>connection</name>
+<value>keep-alive</value>
+</header>
+<header>
+<name>content-length</name>
+<value>27</value>
+</header>
+<header>
+<name>content-type</name>
+<value>application/x-www-form-urlencoded</value>
+</header>
+<header>
+<name>cookie</name>
+<value>JSESSIONID=5DCDC228064944277B7A798B348DED22</value>
+</header>
+<header>
+<name>host</name>
+<value>localhost:8080</value>
+</header>
+<header>
+<name>keep-alive</name>
+<value>300</value>
+</header>
+<header>
+<name>referer</name>
+<value>http://localhost:8080/coreWeb/validation/actionForm/begin.do</value>
+</header>
+<header>
+<name>user-agent</name>
+<value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4</value>
+</header>
+</headers>
+</request>
+<response>
+<statusCode>200</statusCode>
+<reason></reason>
+<responseBody>
+<![CDATA[<html>
+<head>
+ <title>ActionForm Validation Test</title>
+</head>
+<body>
+ <form action="/coreWeb/validation/actionForm/testValidate.do" method="post">
+ Text: <input type="text" name="{actionForm.text}" value="Error">
+ <input type="submit" value="Submit">
+ </form>
+ Validation Error, type in "pass"
+
+</body>
+</html>]]>
+</responseBody>
+</response>
+</test>
+<test>
+<testNumber>3</testNumber>
+<request>
+<protocol>HTTP</protocol>
+<protocolVersion>1.1</protocolVersion>
+<host>localhost</host>
+<port>8080</port>
+<uri>/coreWeb/validation/actionForm/testValidate.do</uri>
+<method>POST</method>
+<parameters>
+<parameter>
+<name>{actionForm.text}</name>
+<value>pass</value>
+</parameter>
+</parameters>
+<cookies>
+<cookie>
+<name>JSESSIONID</name>
+<value>5DCDC228064944277B7A798B348DED22</value>
+</cookie>
+</cookies>
+<headers>
+<header>
+<name>accept</name>
+<value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</value>
+</header>
+<header>
+<name>accept-charset</name>
+<value>UTF-8,*</value>
+</header>
+<header>
+<name>accept-encoding</name>
+<value>gzip,deflate</value>
+</header>
+<header>
+<name>accept-language</name>
+<value>en-us,en;q=0.5</value>
+</header>
+<header>
+<name>connection</name>
+<value>keep-alive</value>
+</header>
+<header>
+<name>content-length</name>
+<value>26</value>
+</header>
+<header>
+<name>content-type</name>
+<value>application/x-www-form-urlencoded</value>
+</header>
+<header>
+<name>cookie</name>
+<value>JSESSIONID=5DCDC228064944277B7A798B348DED22</value>
+</header>
+<header>
+<name>host</name>
+<value>localhost:8080</value>
+</header>
+<header>
+<name>keep-alive</name>
+<value>300</value>
+</header>
+<header>
+<name>referer</name>
+<value>http://localhost:8080/coreWeb/validation/actionForm/testValidate.do</value>
+</header>
+<header>
+<name>user-agent</name>
+<value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4</value>
+</header>
+</headers>
+</request>
+<response>
+<statusCode>200</statusCode>
+<reason></reason>
+<responseBody>
+<![CDATA[<html>
+<head>
+ <title>ActionForm Validation Test</title>
+</head>
+<body>
+ <form action="/coreWeb/validation/actionForm/testValidate.do" method="post">
+ Text: <input type="text" name="{actionForm.text}" value="pass">
+ <input type="submit" value="Submit">
+ </form>
+
+</body>
+</html>]]>
+</responseBody>
+</response>
+</test>
+</tests>
+<endDate>19 Jun 2006, 02:59:53.871 PM MDT</endDate>
+<testCount>3</testCount>
+</recorderSession>
Propchange: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateActionForm.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/test/webapps/drt/web/miniTests/validation/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/web/miniTests/validation/Controller.java?rev=417129&r1=417128&r2=417129&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/miniTests/validation/Controller.java (original)
+++ beehive/trunk/netui/test/webapps/drt/web/miniTests/validation/Controller.java Sun Jun 25 23:31:48 2006
@@ -29,9 +29,6 @@
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
-/**
- * @jpf:message-resources resources="resources.application"
- */
@Jpf.Controller(
messageBundles = {
@Jpf.MessageBundle(
@@ -41,26 +38,22 @@
{
public static class Form implements Serializable, Validatable
{
- private String _text;
- public String getText() {
- return _text;
- }
- public void setText(String text) {
- _text = text;
- }
+ private String _text;
+ public String getText() {
+ return _text;
+ }
+ public void setText(String text) {
+ _text = text;
+ }
- public void validate(ActionMapping mapping, HttpServletRequest request, ActionMessages errors)
- {
- if (_text == null || !_text.equals("pass")) {
- errors.add("text", new ActionError("error.text.validate"));
- }
- }
+ public void validate(ActionMapping mapping, HttpServletRequest request, ActionMessages errors)
+ {
+ if (_text == null || !_text.equals("pass")) {
+ errors.add("text", new ActionError("error.text.validate"));
+ }
+ }
}
- /**
- * @jpf:action validation-error-page="Begin.jsp"
- * @jpf:forward name="linkOne" path="Begin.jsp"
- */
@Jpf.Action(
validationErrorForward = @Jpf.Forward(
name="validationFailure",
@@ -72,13 +65,9 @@
})
public Forward postback(Form form)
{
- return new Forward("linkOne");
+ return new Forward("linkOne");
}
- /**
- * @jpf:action
- * @jpf:forward name="begin" path="Begin.jsp"
- */
@Jpf.Action(
forwards = {
@Jpf.Forward(
Added: beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/index.jsp
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/index.jsp?rev=417129&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/index.jsp Sun Jun 25 23:31:48 2006
@@ -0,0 +1,15 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui" %>
+
+<html>
+<head>
+ <title>ActionForm Validation Test</title>
+</head>
+<body>
+ <netui:form action="testValidate">
+ Text: <netui:textBox dataSource="actionForm.text"/>
+ <netui:button type="submit">Submit</netui:button>
+ </netui:form>
+ <netui:errors />
+</body>
+</html>
Propchange: beehive/trunk/netui/test/webapps/drt/web/validation/actionForm/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native