beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dolan...@apache.org
Subject svn commit: r124130 - in incubator/beehive/trunk/netui/test/webapps/drt: coreWeb/coretags/sc coreWeb/coretags/sc/scopeid testRecorder/config testRecorder/tests
Date Tue, 04 Jan 2005 17:27:10 GMT
Author: dolander
Date: Tue Jan  4 09:27:09 2005
New Revision: 124130

URL: http://svn.apache.org/viewcvs?view=rev&rev=124130
Log:
Add test of the ScriptContainer scope id support with nesting.


Added:
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/Controller.jpf
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/index.jsp
   incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtScScopeId.xml
Modified:
   incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/Controller.jpf
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/Controller.jpf?view=auto&rev=124130
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/Controller.jpf
Tue Jan  4 09:27:09 2005
@@ -0,0 +1,114 @@
+package coretags.sc.scopeid;
+
+import javax.servlet.http.HttpSession;
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * This is the default controller for a blank web application.
+ */
+@Jpf.Controller
+public class Controller extends PageFlowController
+{
+    private String _text;
+    public String getText() {
+        return _text;
+    }
+
+    private String _method;
+    public String getMethod() {
+        return _method;
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward begin()
+    {
+        return new Forward("index");
+    }
+
+
+    /**
+     * Callback that is invoked when this controller instance is created.
+     */
+    protected void onCreate()
+    {
+    }
+
+    /**
+     * Callback that is invoked when this controller instance is destroyed.
+     */
+    protected void onDestroy(HttpSession session)
+    {
+    }
+
+        
+    @Jpf.Action(forwards = { 
+        @Jpf.Forward(name = "success",
+                     path = "index.jsp")
+    })
+    protected Forward post(Bean form)
+    {
+        Forward forward = new Forward("success");
+        _text = form.getText1();
+        _method = "post";
+        return forward;
+    }
+
+    @Jpf.Action(forwards = { 
+        @Jpf.Forward(name = "success",
+                     path = "index.jsp")
+    })
+    protected Forward override(Bean form)
+    {
+        Forward forward = new Forward("success");
+        _text = form.getText1();
+        _method = "override";
+        return forward;
+    }
+                    
+    public static class Bean extends FormData
+    {
+        private String text1;
+        private String text2;
+        
+        public String getText1()
+        {
+            return text1;
+        }
+        
+        public void setText1(String value)
+        {
+            text1 = value;
+        }
+
+        public String getText2()
+        {
+            return text2;
+        }
+        
+        public void setText2(String value)
+        {
+            text2 = value;
+        }
+    }
+}
+
+@Jpf.ViewProperties(value= {"<!-- This data is auto-generated. Hand-editing this section
is not recommended. -->",
+"<view-properties>",
+"<pageflow-object id='pageflow:/coretags/imagebutton/id/Controller.jpf'/>",
+"<pageflow-object id='page:index.jsp'><property value='220' name='x'/><property
value='100' name='y'/></pageflow-object>",
+"<pageflow-object id='formbean:Bean'/>",
+"<pageflow-object id='action:begin.do'><property value='80' name='x'/><property
value='100' name='y'/></pageflow-object>",
+"<pageflow-object id='action:post.do#coretags.imagebutton.id.Controller.Bean'><property
name='x' value='340'/><property name='y' value='100'/></pageflow-object>",
+"<pageflow-object id='forward:path#index#index.jsp#@action:begin.do@'><property
value='116,140,140,164' name='elbowsX'/><property value='92,92,92,92' name='elbowsY'/><property
value='East_1' name='fromPort'/><property value='West_1' name='toPort'/><property
value='index' name='label'/></pageflow-object>",
+"<pageflow-object id='action-call:@page:index.jsp@#@action:post.do#coretags.imagebutton.id.Controller.Bean@'><property
name='elbowsX' value='256,280,280,304'/><property name='elbowsY' value='92,92,92,92'/><property
name='fromPort' value='East_1'/><property name='toPort' value='West_1'/></pageflow-object>",
+"<pageflow-object id='forward:path#success#index.jsp#@action:post.do#coretags.imagebutton.id.Controller.Bean@'><property
name='elbowsX' value='304,280,280,256'/><property name='elbowsY' value='103,103,103,103'/><property
name='fromPort' value='West_2'/><property name='toPort' value='East_2'/><property
name='label' value='success'/></pageflow-object>",
+"</view-properties>"
+})
+interface VIEW_PROPERTIES { }

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/index.jsp
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/index.jsp?view=auto&rev=124130
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sc/scopeid/index.jsp	Tue
Jan  4 09:27:09 2005
@@ -0,0 +1,73 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data" uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template" uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html scopeId="html">
+    <head>
+        <netui:base/>
+    </head>
+    <netui:body>
+        <p style="color:green">Test of the ScriptContainer tag with a scopeId set on
+	it.
+        </p>
+        <netui:scriptContainer scopeId="scopeOne">
+        <span id="scopeOneSpan" />
+        <netui:form tagId="form" action="post" focus="b1">
+            <table>
+                <tr valign="top">
+                    <td>Text:</td>
+                    <td>
+                    <netui:textBox tagId="t1" dataSource="actionForm.text1" /><br>
+                    <netui:textBox tagId="t2" dataSource="actionForm.text2" />
+                    </td>
+                </tr>
+            </table>
+            <br>
+            <netui:button tagId="b1" value="Submit" />&nbsp;
+            <netui:button tagId="b2" value="Override" action="override"/>&nbsp;
+
+        </netui:form>
+        </netui:scriptContainer>
+        <hr>
+        <netui:scriptContainer scopeId="Results">
+        Post Value: <netui:span tagId="postValue" value="${pageFlow.text}"/><br>
+        Method: <netui:span tagId="method" value="${pageFlow.method}"/>
+	</netui:scriptContainer>
+        <hr>
+        <p id="javaOut"></p>
+    </netui:body>
+    <script language="JavaScript" type="text/JavaScript">
+
+function getScopeId(tag)
+{
+   if (tag == null)
+      return "";
+   var attrVal = tag.getAttribute("scopeId");
+   if (attrVal != null)
+      return attrVal;
+   return getScopeId(tag.parentNode);
+}
+
+    var p = document.getElementById("javaOut");
+    var s = document.getElementById("scopeOneSpan");
+
+    var val = "<b>Document Access</b><br>";
+    val = val + "Form By Id is null: <b>" + (document.form == null) + "</b><br>";
+    val = val + "Form By Id is null: <b>" + (document["bean"] == null) + "</b><br>";
+
+    val = val + "<br><b>ScopeId value</b><br>";
+    val = val + "ScopeId: <b>" + getScopeId(s) + "</b><br>";
+
+    val = val + "<br><b>NetUI Access Methods</b><br>";
+    val = val + "TextBox 1 by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("t1",s)) == null) + "</b><br>";
+    val = val + "TextBox 1 by name is null: <b>" +
+        (document["bean"][lookupNameByTagId("t1",s)] == null) + "</b><br>";
+
+    p.innerHTML = val;
+    </script>
+</netui:html>
+
+  
\ No newline at end of file

Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=124130&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=124129&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=124130
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Tue Jan  4 09:27:09 2005
@@ -2049,6 +2049,19 @@
          </features>
       </test>
       <test>
+         <name>CtScScopeId</name>
+         <description>Test of nesting scope id</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>tags</category>
+         </categories>
+         <features>
+            <feature>ScriptContainer</feature>
+            <feature>ScopeId</feature>
+         </features>
+      </test>
+      <test>
          <name>CtTreeErrors</name>
          <description>Verification of the Errors produced by the Tree</description>
          <webapp>coreWeb</webapp>

Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtScScopeId.xml
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtScScopeId.xml?view=auto&rev=124130
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtScScopeId.xml	Tue
Jan  4 09:27:09 2005
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+   <ses:sessionName>CtScScopeId</ses:sessionName>
+   <ses:tester>Daryl</ses:tester>
+   <ses:startDate>04 Jan 2005, 10:02:52.410 AM MST</ses:startDate>
+   <ses:description>Test nesting of the scopeid within multiple script containers</ses:description>
+   <ses:tests>
+      <ses:test>
+         <ses:testNumber>1</ses:testNumber>
+         <ses:request>
+            <ses:protocol>HTTP</ses:protocol>
+            <ses:protocolVersion>1.1</ses:protocolVersion>
+            <ses:host>localhost</ses:host>
+            <ses:port>8080</ses:port>
+            <ses:uri>/coreWeb/coretags/sc/scopeid/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>A88A16C22DDCCBA9A329FF7511C2E7EB</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-charset</ses:name>
+                  <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-encoding</ses:name>
+                  <ses:value>gzip,deflate</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-language</ses:name>
+                  <ses:value>en-us,en;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>connection</ses:name>
+                  <ses:value>keep-alive</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>cookie</ses:name>
+                  <ses:value>JSESSIONID=A88A16C22DDCCBA9A329FF7511C2E7EB</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>keep-alive</ses:name>
+                  <ses:value>300</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>user-agent</ses:name>
+                  <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0</ses:value>
+               </ses:header>
+            </ses:headers>
+         </ses:request>
+         <ses:response>
+            <ses:statusCode>200</ses:statusCode>
+            <ses:reason/>
+            <ses:responseBody>&lt;!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN"
+	"http://www.w3.org/TR/html4/loose.dtd">
+&lt;html lang="en">
+&lt;div scopeId="html" >
+    &lt;head>
+        &lt;base href="http://localhost:8080/coreWeb/coretags/sc/scopeid/index.jsp">
+    &lt;/head>
+    &lt;body>
+        &lt;p style="color:green">Test of the ScriptContainer tag with a scopeId set
on
+	it.
+        &lt;/p>
+        &lt;div scopeId="scopeOne" >
+        &lt;span id="scopeOneSpan" />
+        &lt;form name="bean" id="form" action="/coreWeb/coretags/sc/scopeid/post.do"
method="post">
+            &lt;table>
+                &lt;tr valign="top">
+                    &lt;td>Text:&lt;/td>
+                    &lt;td>
+                    &lt;input type="text" name="{actionForm.text1}" id="html.scopeOne.t1">&lt;br>
+                    &lt;input type="text" name="{actionForm.text2}" id="html.scopeOne.t2">
+                    &lt;/td>
+                &lt;/tr>
+            &lt;/table>
+            &lt;br>
+            &lt;input type="submit" id="html.scopeOne.b1" value="Submit">&amp;nbsp;
+            &lt;input type="submit" name="actionOverride:override" id="html.scopeOne.b2"
value="Override">&amp;nbsp;
+
+        &lt;/form>
+        &lt;/div>
+
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
+
+// **** This section contains code that will run when the page is loaded ****
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_names == null)
+   var netui_names = new Object();
+netui_names.scopeOne__b1="html.scopeOne.b1"
+netui_names.scopeOne__t1="{actionForm.text1}"
+netui_names.scopeOne__form="form"
+netui_names.scopeOne__b2="actionOverride:override"
+netui_names.scopeOne__t2="{actionForm.text2}"
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_tagIdMap == null)
+   var netui_tagIdMap = new Object();
+netui_tagIdMap.scopeOne__b1="html.scopeOne.b1"
+netui_tagIdMap.scopeOne__t1="html.scopeOne.t1"
+netui_tagIdMap.scopeOne__b2="html.scopeOne.b2"
+netui_tagIdMap.scopeOne__t2="html.scopeOne.t2"
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_tagIdNameMap == null)
+   var netui_tagIdNameMap = new Object();
+netui_tagIdNameMap.scopeOne__t1="{actionForm.text1}"
+netui_tagIdNameMap.scopeOne__b2="actionOverride:override"
+netui_tagIdNameMap.scopeOne__t2="{actionForm.text2}"
+
+
+// **** This section contains functions typically run as events ****
+
+
+// method which will return a real id for a tagId,
+// the tag parameter will be used to find the scopeId for
+// containers that may scope their ids
+function getNetuiTagName(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_names[id];
+   else
+      return netui_names[scopeId  + "__" + id];
+}
+
+// lookup by tagId to "real id"
+function lookupIdByTagId(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_tagIdMap[id];
+   else
+      return netui_tagIdMap[scopeId  + "__" + id];
+}
+
+// lookup by tagId to "real name"
+function lookupNameByTagId(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_tagIdNameMap[id];
+   else
+      return netui_tagIdNameMap[scopeId  + "__" + id];
+}
+
+// This method will walk the hierarchy from the pass element looking for a scopeId.
+// The first scopeId found will be returned or the empty string if a scopeId is not found.
+function getScopeId(tag)
+{
+   if (tag == null)
+      return "";
+   var attrVal = tag.getAttribute("scopeId");
+   if (attrVal != null)
+      return attrVal;
+   return getScopeId(tag.parentNode);
+}
+-->
+&lt;/script>
+
+
+        &lt;hr>
+        &lt;div scopeId="Results" >
+        Post Value: &lt;span id="html.Results.postValue">&lt;/span>&lt;br>
+        Method: &lt;span id="html.Results.method">&lt;/span>
+	&lt;/div>
+
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
+
+// **** This section contains code that will run when the page is loaded ****
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_names == null)
+   var netui_names = new Object();
+netui_names.Results__postValue="html.Results.postValue"
+netui_names.Results__method="html.Results.method"
+
+-->
+&lt;/script>
+
+
+        &lt;hr>
+        &lt;p id="javaOut">&lt;/p>
+    &lt;/body>
+    &lt;script language="JavaScript" type="text/JavaScript">
+
+function getScopeId(tag)
+{
+   if (tag == null)
+      return "";
+   var attrVal = tag.getAttribute("scopeId");
+   if (attrVal != null)
+      return attrVal;
+   return getScopeId(tag.parentNode);
+}
+
+    var p = document.getElementById("javaOut");
+    var s = document.getElementById("scopeOneSpan");
+
+    var val = "&lt;b>Document Access&lt;/b>&lt;br>";
+    val = val + "Form By Id is null: &lt;b>" + (document.form == null) + "&lt;/b>&lt;br>";
+    val = val + "Form By Id is null: &lt;b>" + (document["bean"] == null) + "&lt;/b>&lt;br>";
+
+    val = val + "&lt;br>&lt;b>ScopeId value&lt;/b>&lt;br>";
+    val = val + "ScopeId: &lt;b>" + getScopeId(s) + "&lt;/b>&lt;br>";
+
+    val = val + "&lt;br>&lt;b>NetUI Access Methods&lt;/b>&lt;br>";
+    val = val + "TextBox 1 by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("t1",s)) == null) + "&lt;/b>&lt;br>";
+    val = val + "TextBox 1 by name is null: &lt;b>" +
+        (document["bean"][lookupNameByTagId("t1",s)] == null) + "&lt;/b>&lt;br>";
+
+    p.innerHTML = val;
+    &lt;/script>
+&lt;/div>
+&lt;/html></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>04 Jan 2005, 10:03:11.187 AM MST</ses:endDate>
+   <ses:testCount>1</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file

Mime
View raw message