beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dolan...@apache.org
Subject svn commit: rev 46077 - in incubator/beehive/trunk/netui: src/tags-html/org/apache/beehive/netui/tags/html test/webapps/drt/coreWeb/tags/selectEmptyOption test/webapps/drt/testRecorder/config test/webapps/drt/testRecorder/tests
Date Wed, 15 Sep 2004 03:53:37 GMT
Author: dolander
Date: Tue Sep 14 20:53:35 2004
New Revision: 46077

Added:
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/Controller.jpf
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/index.jsp
   incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/SelectEmptyOption.xml
Modified:
   incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
   incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Log:
Fix a bug in the select.  In a repeating select, if the optionDataSource was an empty array,
the result was an 
exception in the iterator.  

Added a BVT.




Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
(original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
Tue Sep 14 20:53:35 2004
@@ -687,7 +687,13 @@
                 registerTagError(s, null);
                 return SKIP_BODY;
             }
-            _repCurItem = ((Iterator) _dynamicOptions).next();
+            Iterator it = (Iterator) _dynamicOptions;
+            if (!it.hasNext()) {
+                _repCurStage = STAGE_NULL;
+                return SKIP_BODY;
+
+            }
+            _repCurItem = it.next();
             _repCurStage = STAGE_OPTION;
 
             DataAccessProviderStack.addDataAccessProvider(this, pageContext);
@@ -911,17 +917,12 @@
             int realEnd = end + END_TOKEN.length() + 1;
             body.append(_saveBody.substring(pos,start));
             error.append(_saveBody.substring(start,realEnd));
-            System.err.println("Body:" + body);
-            System.err.println("Error:" + error);
             pos = realEnd;
         }
 
         // recreate the remainder of the body, everything not left
         body.append(_saveBody.substring(pos,len));
         _saveBody = body.toString();
-
-        System.err.println("Body:" + body);
-        System.err.println("Error:" + error);
 
         // return the error
         return error.toString();

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/Controller.jpf
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/Controller.jpf
Tue Sep 14 20:53:35 2004
@@ -0,0 +1,63 @@
+package tags.selectEmptyOption;
+
+import javax.servlet.http.HttpSession;
+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[] _opts = new String[0];
+    private String[] _select;
+    
+    public String[] getOptions() {
+        return _opts;
+    }
+    
+    public String[] getSelect() {
+        return _select;
+    }
+    public void setSelect(String[] select) {
+        _select = select;
+    }
+    
+    @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.ViewProperties(value = { 
+    "<!-- This data is auto-generated. Hand-editing this section is not recommended. -->",

+    "<view-properties>", 
+    "<pageflow-object id='pageflow:/bug/Controller.jpf'/>", 
+    "<pageflow-object id='page:index.jsp'><property value='220' name='x'/><property
value='100' name='y'/></pageflow-object>", 
+    "<pageflow-object id='action:begin.do'><property value='80' name='x'/><property
value='100' name='y'/></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>", 
+    "</view-properties>"
+})
+interface VIEW_PROPERTIES { }

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/index.jsp
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/selectEmptyOption/index.jsp
Tue Sep 14 20:53:35 2004
@@ -0,0 +1,23 @@
+<%@ 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>
+    <head>
+        <netui:base/>
+    </head>
+    <netui:body>
+    <h4>Select Empty OptionDataSource</h4>
+    <p style="color:green">This is a test of an empty array being used as an options
+    data source for a repeating select.  The result should be that the select has no content.
+    There should be an error either on the console or page.
+    </p>
+    <hr>
+        <netui:select dataSource="pageFlow.select" optionsDataSource="${pageFlow.options}"
repeater="true">
+            <netui:selectOption repeatingType="Option" value="${container.item}">
+            </netui:selectOption>
+        </netui:select>   
+    </netui:body>
+</netui:html>
+
+  
\ No newline at end of file

Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
==============================================================================
--- 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 Sep 14 20:53:35 2004
@@ -4487,6 +4487,19 @@
          </features>
       </test>
       <test>
+         <name>SelectEmptyOption</name>
+         <description>Repeating Select with an OptionDataSource that has an empty array.</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>tags</category>
+         </categories>
+         <features>
+            <feature>Select</feature>
+            <feature>OptionDataSource</feature>
+         </features>
+      </test>
+      <test>
          <name>SerializeXMLTag</name>
          <description>Tests the SerializeXML tag.</description>
          <webapp>coreWeb</webapp>

Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/SelectEmptyOption.xml
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/SelectEmptyOption.xml
Tue Sep 14 20:53:35 2004
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+   <ses:sessionName>SelectEmptyOption</ses:sessionName>
+   <ses:tester>Daryl</ses:tester>
+   <ses:startDate>14 Sep 2004, 09:20:23.112 PM MDT</ses:startDate>
+   <ses:description>test of an empty array in a repeating select.</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/tags/selectEmptyOption/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>1B8A12E51E46B375A8781175253E5A61</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  <ses:value>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*</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</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=1B8A12E51E46B375A8781175253E5A61</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>user-agent</ses:name>
+                  <ses:value>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
CLR 2.0.40607)</ses:value>
+               </ses:header>
+            </ses:headers>
+         </ses:request>
+         <ses:response>
+            <ses:statusCode>200</ses:statusCode>
+            <ses:reason/>
+            <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "//W3C//DTD HTML
4.01 Transitional//EN"
+	"http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+        <base href="http://localhost:8080/coreWeb/tags/selectEmptyOption/index.jsp">
+    </head>
+    <body>
+    <h4>Select Empty OptionDataSource</h4>
+    <p style="color:green">This is a test of an empty array being used as an options
+    data source for a repeating select.  The result should be that the select has no content.
+    There should be an error either on the console or page.
+    </p>
+    <hr>
+        <input type="hidden" name="wlw-select_key:{pageFlow.select}OldValue" value="true">
+<select name="wlw-select_key:{pageFlow.select}"></select>   
+    </body>
+</html>]]></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>14 Sep 2004, 09:20:28.901 PM MDT</ses:endDate>
+   <ses:testCount>1</ses:testCount>
+</ses:recorderSession>

Mime
View raw message