Author: ekoneil
Date: Thu Aug 12 09:56:26 2004
New Revision: 36292

Added:
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/util/
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/util/assert.tag
   (contents, props changed)
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/Controller.jpf
   (contents, props changed)
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/index.jsp
   (contents, props changed)
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DataGridModelTest.xml
   (contents, props changed)
Modified:
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Log:
New data grid model test.

This test ensures that the JavaBean model objects dropped into the JspContext 
are present and missing at the correct times.

This is done through an "assert" .tag file which throws a JspException when the 
given test condition is violated .

BB: self
DRT: NetUI pass
     Data Grid suite pass



Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/util/assert.tag
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/util/assert.tag
   Thu Aug 12 09:56:26 2004
@@ -0,0 +1,12 @@
+<%@ tag body-content="empty" %>
+<%@ attribute name="test" required="true" type="java.lang.Boolean"%>
+<%@ attribute name="failureMessage" required="true" type="java.lang.String"%>
+
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
+<%
+Boolean attr = (Boolean)jspContext.getAttribute("test");
+String msg = (String)jspContext.getAttribute("failureMessage");
+if(!attr.booleanValue())
+  throw new JspException("JSP Tagfile Assert failed!  Message: " + msg);
+%>
+

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/Controller.jpf
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/Controller.jpf
    Thu Aug 12 09:56:26 2004
@@ -0,0 +1,42 @@
+/*
+ * B E A   S Y S T E M S
+ * Copyright 2002-2004  BEA Systems, Inc.
+ *
+ * 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 databinding.datagrid.model;
+
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ *
+ */
[EMAIL PROTECTED]
+public class Controller
+    extends PageFlowController
+{
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "success",
+                path = "index.jsp") 
+        })
+    public Forward begin()
+    {
+        return new Forward("success");
+    }
+}

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/index.jsp
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/datagrid/model/index.jsp
 Thu Aug 12 09:56:26 2004
@@ -0,0 +1,38 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="beehive-netui-tags-html.tld" prefix="netui"%>
+<%@ taglib uri="beehive-netui-tags-databinding.tld" prefix="netui-data"%>
+<%@ taglib uri="beehive-netui-tags-template.tld" prefix="netui-template"%>
+<%@ taglib prefix="netuitestutil" 
tagdir="/WEB-INF/tags/org/apache/beehive/netui/test/util" %>
+
+<netui-template:template templatePage="../site/template.jsp">
+    <netui-template:setAttribute name="title" value="Basic Data Grid"/>
+    <netui-template:section name="body">
+    <p>
+    <%@ include file="../util/portfolioXmlBean.jsp" %>
+    <br/>
+    <netui-data:dataGrid dataSource="pageScope.stocks" name="portfolio">
+        <netuitestutil:assert test="${dataGrid != null}" failureMessage="Data 
Grid Model was not found in the PageContext"/>
+        <netui-data:columns defaultSortable="true" defaultFilterable="false" 
sortAction="index.jsp" filterAction="index.jsp">
+            <netui-data:literalColumn headerText="Symbol" 
value="${container.item.symbol}" sortExpression="symbol">
+              <netuitestutil:assert test="${column != null}" 
failureMessage="Column Model was not found in the PageContext"/>
+              <netuitestutil:assert test="${column.headerText == 'Symbol'}" 
failureMessage="Column Model returned invalid header text"/>
+            </netui-data:literalColumn>
+            <netui-data:literalColumn sortable="false" headerText="Price" 
value="${container.item.price}">
+              <netuitestutil:assert test="${column != null}" 
failureMessage="Column Model was not found in the PageContext"/>
+              <netuitestutil:assert test="${column.headerText == 'Price'}" 
failureMessage="Column Model returned invalid header text"/>
+            </netui-data:literalColumn>
+            <netui-data:anchorColumn headerText="Web" 
href="${container.item.web}" value="${container.item.name}">
+              <netuitestutil:assert test="${column.headerText == 'Web'}" 
failureMessage="Column Model returned invalid header text"/>
+              <netui:parameter name="rowid" value="${container.index}"/>
+              <netui:parameter name="symbol" value="${container.item.symbol}"/>
+            </netui-data:anchorColumn>
+        </netui-data:columns>
+        <netuitestutil:assert test="${column == null}" failureMessage="Column 
Model found after it should have been removed"/>
+        <netuitestutil:assert test="${dataGrid != null}" failureMessage="Data 
Grid Model missing"/>
+    </netui-data:dataGrid>
+    <netuitestutil:assert test="${dataGrid == null}" failureMessage="Data Grid 
Model found after it should have been removed"/>
+    <netuitestutil:assert test="${column == null}" failureMessage="Column 
Model found after it should have been removed"/>
+    <br/>
+    </p>
+    </netui-template:section>
+</netui-template:template>

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
   Thu Aug 12 09:56:26 2004
@@ -2127,6 +2127,21 @@
          </features>
       </test>
       <test>
+         <name>DataGridModelTest</name>
+         <description>DataGridModelTest</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>drt</category>
+            <category>datagrid</category>
+            <category>databinding</category>
+         </categories>
+         <features>
+            <feature>Databinding</feature>
+            <feature>Data Grid</feature>
+         </features>
+      </test>
+      <test>
          <name>DataGridPagerBasic</name>
          <description>DataGridPagerBasic</description>
          <webapp>coreWeb</webapp>

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DataGridModelTest.xml
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DataGridModelTest.xml
     Thu Aug 12 09:56:26 2004
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession 
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
+   <ses:sessionName>DataGridModelTest</ses:sessionName>
+   <ses:tester>ekoneil</ses:tester>
+   <ses:startDate>12 Aug 2004, 10:33:55.917 AM MDT</ses:startDate>
+   <ses:description>Test that the data grid's model lifecycle in the 
JspContext is correct.  This uses the NetUI assert tag file to check the 
conditions and throw a JspException if a condition is 
violated.</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/datagrid/model/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>84AC515C7F0CBFC5A7151B59F2AE0DC7</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=84AC515C7F0CBFC5A7151B59F2AE0DC7</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) Gecko/20040614 Firefox/0.9</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>
+    <title>NetUI Data Grid Samples</title>
+    <link rel="stylesheet" 
href="/coreWeb/databinding/datagrid/site/css/default.css" type="text/css"/>
+  </head>
+  <base 
href="http://localhost:8080/coreWeb/databinding/datagrid/model/index.jsp";>
+  <body>
+    <p>
+    <b>Basic Data Grid</b>
+    <table width="100%">
+    <tr><td></td></tr>
+    <tr><td>
+        
+    <p>
+    
+
+
+    <br/>
+    Page 1 of 1&nbsp;&nbsp;&nbsp;
+<table class="datagrid">
+<thead>
+<tr class="datagrid-header"><th class="datagrid-header-cell">Symbol</th>
+<th class="datagrid-header-cell">Price</th>
+<th class="datagrid-header-cell">Web</th>
+</tr>
+</thead>
+
+<tr class="datagrid-even"><td class="datagrid-data-cell">BEAS</td><td 
class="datagrid-data-cell">14.35</td><td class="datagrid-data-cell"><a 
href="http://www.bea.com?rowid=1&symbol=BEAS";><span>BEA 
Systems</span></a></td></tr>
+<tr class="datagrid-odd"><td class="datagrid-data-cell">CSCO</td><td 
class="datagrid-data-cell">19.42</td><td class="datagrid-data-cell"><a 
href="http://www.cisco.com?rowid=2&symbol=CSCO";><span>Cisco 
Systems</span></a></td></tr>
+<tr class="datagrid-even"><td class="datagrid-data-cell">GE</td><td 
class="datagrid-data-cell">59.42</td><td class="datagrid-data-cell"><a 
href="http://www.ge.com?rowid=3&symbol=GE";><span>General 
Electric</span></a></td></tr>
+<tr class="datagrid-odd"><td class="datagrid-data-cell">RHAT</td><td 
class="datagrid-data-cell">18.2</td><td class="datagrid-data-cell"><a 
href="http://www.redhat.com?rowid=4&symbol=RHAT";><span>RedHat 
Systems</span></a></td></tr>
+<tr class="datagrid-even"><td class="datagrid-data-cell">YHOO</td><td 
class="datagrid-data-cell">48.16</td><td class="datagrid-data-cell"><a 
href="http://www.yahoo.com?rowid=5&symbol=YHOO";><span>Yahoo 
Inc</span></a></td></tr>
+</table>
+
+    
+
+
+
+
+
+
+
+    
+
+
+
+
+
+
+
+    <br/>
+    </p>
+    
+    </td></tr>
+    </p>
+    <table>
+    <tr><td><a 
href="/netuiDRT/databinding/datagrid/basic/index.jsp">Home</a></td></tr>
+    </table>
+    </p>
+  </body>
+</html>]]></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>12 Aug 2004, 10:34:02.036 AM MDT</ses:endDate>
+   <ses:testCount>1</ses:testCount>
+</ses:recorderSession>

Reply via email to