You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2004/09/27 07:32:45 UTC

svn commit: rev 47275 - in incubator/beehive/trunk/netui: src/pageflow/org/apache/beehive/netui/script/common src/pageflow/org/apache/beehive/netui/script/el test/webapps/drt/coreWeb test/webapps/drt/coreWeb/databinding/globalApp/nojpf test/webapps/drt/testRecorder/tests

Author: ekoneil
Date: Sun Sep 26 22:32:44 2004
New Revision: 47275

Modified:
   incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
   incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIReadVariableResolver.java
   incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIUpdateVariableResolver.java
   incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIVariableResolver.java
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/SharedFlow.jpfs
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/globalApp/nojpf/index.jsp
   incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CellRepeaterError2.xml
   incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/GlobalAppNoJPFBinding.xml
Log:
Fix a problem where the "sharedFlow" object was not available to the dataSource EL for read or write.

Update a binding test to include this case.

BB: self
DRT: NetUI pass
BVT: NetUI pass



Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java	(original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java	Sun Sep 26 22:32:44 2004
@@ -128,6 +128,24 @@
         return bean;
     }
 
+    public static final SharedFlowController getSharedFlow(ServletRequest request, ServletResponse response)
+    {
+    	assert request instanceof HttpServletRequest;
+        assert response instanceof HttpServletResponse;
+
+        SharedFlowController sharedFlow = InternalUtils.ensureSharedFlow((HttpServletRequest)request, (HttpServletResponse)response);
+        if(sharedFlow == null)
+        {
+            // @todo: i18n
+            RuntimeException re = new RuntimeException("Can not create the sharedFlow binding context; the SharedFlow object is null.");
+            if(_logger.isErrorEnabled())
+                _logger.error("", re);
+
+            throw re;
+        }
+        else return sharedFlow;
+    }
+
     public static final PageFlowController getPageFlow(ServletRequest request, ServletResponse response)
     {
         assert request instanceof HttpServletRequest;
@@ -139,6 +157,7 @@
             return jpf;
         else 
         {
+            // @todo: i18n
             RuntimeException re = new RuntimeException("There is no current PageFlow for the expression.");
             if(_logger.isErrorEnabled()) _logger.error("", re);
             throw re;
@@ -147,13 +166,13 @@
 
     public static final GlobalApp getGlobalApp(ServletRequest request, ServletResponse response)
     {
-        HttpServletRequest hReq = (HttpServletRequest)request;
-        HttpServletResponse hResp = (HttpServletResponse)response;
+	assert request instanceof HttpServletRequest;
 
-        GlobalApp ga = PageFlowUtils.getGlobalApp(hReq);
+        GlobalApp ga = PageFlowUtils.getGlobalApp((HttpServletRequest)request);
         
         if(ga == null) 
         {
+            // @todo: i18n
             RuntimeException re = new RuntimeException("Can not create the globalApp binding context; the GlobalApp object is null.");
             if(_logger.isErrorEnabled()) _logger.error("", re);
             throw re;
@@ -175,6 +194,7 @@
 
         if(factory == null)
         {
+            // @todo: i18n
             String msg = "Could not resolve ContextFactory for binding context named \"" + name + "\"";
             if(_logger.isErrorEnabled()) _logger.error(msg);
             throw new RuntimeException(msg);

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIReadVariableResolver.java
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIReadVariableResolver.java	(original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIReadVariableResolver.java	Sun Sep 26 22:32:44 2004
@@ -86,22 +86,24 @@
             return getPageFlow(_pc.getRequest(), _pc.getResponse());
         else if(name.equals("globalApp"))
             return getGlobalApp(_pc.getRequest(), _pc.getResponse());
+        else if(name.equals("sharedFlow"))
+            return getSharedFlow(_pc.getRequest(), _pc.getResponse());
         else if(name.equals("bundle"))
             return getScriptableObject(_contextFactories, this, name);
         else if(name.equals("container"))
             return getScriptableObject(_contextFactories, this, name);
         else if(name.equals("pageInput"))
             return new ScriptablePageInput(_pc.getRequest());
-        // in order to look-up ContextFactories that are used to create ScriptableObjects, 
-        // need to call the contextFactory map to find those that aren't known about 
+        // in order to look-up ContextFactories that are used to create ScriptableObjects,
+        // need to call the contextFactory map to find those that aren't known about
         // explicitly here.  The statements above are used to look-up binding contexts
-        // that are well-known because it's faster than dropping into the 
+        // that are well-known because it's faster than dropping into the
         // ContextFactory map for each lookup -- optimizing for the common case.
         else if(_contextFactories != null && _contextFactories.containsKey(name))
         {
             return getScriptableObject(_contextFactories, this, name);
         }
-        else 
+        else
         {
             RuntimeException re = new RuntimeException("Could not resolve variable named \"" + name + "\"", new IllegalExpressionException());
             if(_logger.isErrorEnabled()) _logger.error("", re);

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIUpdateVariableResolver.java
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIUpdateVariableResolver.java	(original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIUpdateVariableResolver.java	Sun Sep 26 22:32:44 2004
@@ -57,6 +57,8 @@
             return getPageFlow(_request, _response);
         else if(name.equals("globalApp"))
             return getGlobalApp(_request, _response);
+        else if(name.equals("sharedFlow"))
+            return getSharedFlow(_request, _response);
         else if(name.equals("requestScope"))
         {
             if(_requestParameter == false)
@@ -69,13 +71,12 @@
                 return new SessionAttributeMap(((HttpServletRequest)_request).getSession());
             else throw new IllegalExpressionException("The session data binding context can not be updated from a request parameter.");
         }
-        // @bug: need to get the application from somewhere
+        // @bug: need to get the ServletContext from somewhere
         else if(name.equals("applicationScope"))
         {
             if(_requestParameter == false)
                 return null;
             else throw new IllegalExpressionException("The application data binding context can not be updated from a request parameter.");
-                                                      
         }
         else 
         {

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIVariableResolver.java
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIVariableResolver.java	(original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/el/NetUIVariableResolver.java	Sun Sep 26 22:32:44 2004
@@ -28,6 +28,7 @@
 
 import org.apache.beehive.netui.pageflow.GlobalApp;
 import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.SharedFlowController;
 
 import org.apache.beehive.netui.util.logging.Logger;
 
@@ -47,6 +48,11 @@
     }
 
     public abstract String[] getAvailableVariables();
+
+    protected SharedFlowController getSharedFlow(ServletRequest request, ServletResponse response)
+    {
+	    return ImplicitObjectUtil.getSharedFlow(request, response);
+    }
 
     protected PageFlowController getPageFlow(ServletRequest request, ServletResponse response)
     {

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/SharedFlow.jpfs
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/SharedFlow.jpfs	(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/SharedFlow.jpfs	Sun Sep 26 22:32:44 2004
@@ -36,6 +36,11 @@
         return "Hello World! -- the Global.app";
     }
 
+    public String[] getStrings()
+    {
+        return new String[] {"One", "Fish", "Two", "Fish"}; 
+    }
+
     public static class GlobalForm extends FormData
     {
 	String _search;

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/globalApp/nojpf/index.jsp
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/globalApp/nojpf/index.jsp	(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/globalApp/nojpf/index.jsp	Sun Sep 26 22:32:44 2004
@@ -1,5 +1,7 @@
 <%@ page language="java" %>
 <%@ taglib uri="beehive-netui-tags-html.tld" prefix="netui" %>
+<%@ taglib uri="beehive-netui-tags-databinding.tld" prefix="netui-data" %>
+
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
   <head>
@@ -10,7 +12,14 @@
     <b>Global App Binding -- no JPF</b>
 <br/>
 <br/>
+<b>JSP 2.0 EL</b>
 The Global.app says: <netui:span value="${sharedFlow.sayHello}"/>
+<br/>
+<br/>
+<b>NetUIEL</b><br/>
+<netui-data:repeater dataSource="sharedFlow.strings">
+    ${container.item}<br/>
+</netui-data:repeater>
 <br/>
 <br/>
   </body>

Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CellRepeaterError2.xml
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CellRepeaterError2.xml	(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CellRepeaterError2.xml	Sun Sep 26 22:32:44 2004
@@ -2,7 +2,7 @@
 <ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
    <ses:sessionName>CellRepeaterError2</ses:sessionName>
    <ses:tester>ekoneil</ses:tester>
-   <ses:startDate>15 Aug 2004, 09:29:40.830 AM MDT</ses:startDate>
+   <ses:startDate>26 Sep 2004, 11:08:40.527 PM MDT</ses:startDate>
    <ses:description>ekoneil</ses:description>
    <ses:tests>
       <ses:test>
@@ -15,7 +15,12 @@
             <ses:uri>/coreWeb/databinding/cellrepeatererror/index.jsp</ses:uri>
             <ses:method>GET</ses:method>
             <ses:parameters/>
-            <ses:cookies/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>40EE4AB857D01F27143B322AA189183F</ses:value>
+               </ses:cookie>
+            </ses:cookies>
             <ses:headers>
                <ses:header>
                   <ses:name>accept</ses:name>
@@ -38,6 +43,10 @@
                   <ses:value>keep-alive</ses:value>
                </ses:header>
                <ses:header>
+                  <ses:name>cookie</ses:name>
+                  <ses:value>$Version=0; JSESSIONID=40EE4AB857D01F27143B322AA189183F; $Path=/coreWeb</ses:value>
+               </ses:header>
+               <ses:header>
                   <ses:name>host</ses:name>
                   <ses:value>localhost:8080</ses:value>
                </ses:header>
@@ -47,7 +56,7 @@
                </ses:header>
                <ses:header>
                   <ses:name>testrecorder.playback.testid</ses:name>
-                  <ses:value>-4d7aedf6:fe62c47935:-7878</ses:value>
+                  <ses:value>-6c926bc5:ff3e1a193d:-6de6</ses:value>
                </ses:header>
                <ses:header>
                   <ses:name>user-agent</ses:name>
@@ -115,7 +124,7 @@
  <th>Errors</th><td colspan="2">1</td></tr>
  <tr><th>Expression Error</th><th>Attribute</th><td>dataSource</td>
  <th>Expression</th><td>{sharedFlow.noCellRepeaterProperty}</td></tr>
- <tr><th valign="top">Message</th><td colspan="4">Caught exception when evaluating expression "{sharedFlow.noCellRepeaterProperty}" with available binding contexts [actionForm, pageFlow, globalApp, request, session, application, pageContext, bundle, container, url, pageInput]. Root cause: org.apache.beehive.netui.script.IllegalExpressionException</td></tr>
+ <tr><th valign="top">Message</th><td colspan="4">Caught exception when evaluating expression "{sharedFlow.noCellRepeaterProperty}" with available binding contexts [actionForm, pageFlow, globalApp, request, session, application, pageContext, bundle, container, url, pageInput]. Root cause: java.lang.RuntimeException: Could not find property or field "noCellRepeaterProperty" on object of type "class webappRoot.SharedFlow"</td></tr>
 </table></span>
 
 
@@ -127,7 +136,7 @@
          </ses:testResults>
       </ses:test>
    </ses:tests>
-   <ses:endDate>15 Aug 2004, 09:29:41.091 AM MDT</ses:endDate>
+   <ses:endDate>26 Sep 2004, 11:08:41.228 PM MDT</ses:endDate>
    <ses:sessionStatus>fail</ses:sessionStatus>
    <ses:testCount>1</ses:testCount>
    <ses:passedCount>0</ses:passedCount>

Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/GlobalAppNoJPFBinding.xml
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/GlobalAppNoJPFBinding.xml	(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/GlobalAppNoJPFBinding.xml	Sun Sep 26 22:32:44 2004
@@ -1,72 +1,56 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<recorderSession xmlns="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
-
-  <sessionName>GlobalAppNoJPFBinding</sessionName>
-  <tester>ekoneil</tester>
-  <startDate>02 Dec 2003, 08:35:39.759 AM MST</startDate>
-  <description>Test binding an expression in a JSP to a public property of the Global.app without a JPF in the directory.</description>
-
-  <tests>
-  <test>
-    <testNumber>1</testNumber>
-
-    <request>
-
-      <protocol>HTTP</protocol>
-      <protocolVersion>1.1</protocolVersion>
-      <host>localhost</host>
-      <port>7001</port>
-      <uri>/coreWeb/databinding/globalApp/nojpf/index.jsp</uri>
-      <method>GET</method>
-
-      <parameters>
-      </parameters>
-
-      <cookies>
-        <cookie>
-          <name>JSESSIONID</name>
-          <value>1Mvu9a92i7iD6kOb8eqQcrfGTd0BOpJ11yHVdPYA8LS2gz7OQrKH!2062288931</value>
-        </cookie>
-      </cookies>
-
-      <headers>
-        <header>
-          <name>Accept</name>
-          <value>*/*</value>
-        </header>
-        <header>
-          <name>Accept-Encoding</name>
-          <value>gzip, deflate</value>
-        </header>
-        <header>
-          <name>Accept-Language</name>
-          <value>en-us</value>
-        </header>
-        <header>
-          <name>Connection</name>
-          <value>Keep-Alive</value>
-        </header>
-        <header>
-          <name>Cookie</name>
-          <value>JSESSIONID=1Mvu9a92i7iD6kOb8eqQcrfGTd0BOpJ11yHVdPYA8LS2gz7OQrKH!2062288931</value>
-        </header>
-        <header>
-          <name>Host</name>
-          <value>localhost:7001</value>
-        </header>
-        <header>
-          <name>User-Agent</name>
-          <value>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Feedreader; .NET CLR 1.1.4322)</value>
-        </header>
-      </headers>
-
-    </request>
-
-    <response>
-      <statusCode>200</statusCode>
-      <reason></reason>
-      <responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+   <ses:sessionName>GlobalAppNoJPFBinding</ses:sessionName>
+   <ses:tester>ekoneil</ses:tester>
+   <ses:startDate>26 Sep 2004, 10:18:21.465 PM MDT</ses:startDate>
+   <ses:description>ekoneil</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/databinding/globalApp/nojpf/index.jsp</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies/>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  <ses:value>*/*</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>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>testrecorder.playback.testid</ses:name>
+                  <ses:value>-6c926bc5:ff3e1a193d:-7ffa</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; Feedreader; .NET CLR 1.1.4322)</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">
 <html>
   <head>
     <title>Global App Binding -- no JPF</title>
@@ -76,18 +60,33 @@
     <b>Global App Binding -- no JPF</b>
 <br/>
 <br/>
+<b>JSP 2.0 EL</b>
 The Global.app says: <span>Hello World! -- the Global.app</span>
 <br/>
 <br/>
-  </body>
-</html>]]></responseBody>
+<b>NetUIEL</b><br/>
+
+    One<br/>
 
-    </response>
-  </test>
+    Fish<br/>
 
-  </tests>
+    Two<br/>
 
-  <endDate>02 Dec 2003, 08:35:48.992 AM MST</endDate>
-  <testCount>1</testCount>
+    Fish<br/>
 
-</recorderSession>
\ No newline at end of file
+<br/>
+<br/>
+  </body>
+</html>]]></ses:responseBody>
+         </ses:response>
+         <ses:testResults>
+            <ses:testStatus>fail</ses:testStatus>
+         </ses:testResults>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>26 Sep 2004, 10:18:22.537 PM MDT</ses:endDate>
+   <ses:sessionStatus>fail</ses:sessionStatus>
+   <ses:testCount>1</ses:testCount>
+   <ses:passedCount>0</ses:passedCount>
+   <ses:failedCount>1</ses:failedCount>
+</ses:recorderSession>
\ No newline at end of file