shale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject svn commit: r471997 - in /shale/framework/trunk/shale-apps: ./ shale-test-core/ shale-test-core/src/ shale-test-core/src/main/ shale-test-core/src/main/assembly/ shale-test-core/src/main/java/ shale-test-core/src/main/java/org/ shale-test-core/src/main...
Date Tue, 07 Nov 2006 05:59:53 GMT
Author: craigmcc
Date: Mon Nov  6 21:59:52 2006
New Revision: 471997

URL: http://svn.apache.org/viewvc?view=rev&rev=471997
Log:
Establish a system integrtation test webapp for the shale-core library,
initially focused on investigating reported bugs with the token processor
(SHALE-287).  The baseline tests verify that submitting good data works with
the current code, as well as submitting bad data following good data.  The
remaining scenario to validate is attempts to resubmit the same page ... that
will be the next step.

Added:
    shale/framework/trunk/shale-apps/shale-test-core/   (with props)
    shale/framework/trunk/shale-apps/shale-test-core/pom.xml
      - copied, changed from r471643, shale/framework/trunk/shale-apps/shale-test-view/pom.xml
    shale/framework/trunk/shale-apps/shale-test-core/src/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/assembly/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/assembly/dep.xml
      - copied unchanged from r471643, shale/framework/trunk/shale-apps/shale-test-view/src/main/assembly/dep.xml
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/core/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/core/Recorder.java
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java
    shale/framework/trunk/shale-apps/shale-test-core/src/main/resources/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/
      - copied from r471643, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/faces-config.xml
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/web.xml
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/index.jsp
      - copied unchanged from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/index.jsp
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/menu.jsp
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token1.jsp
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp
    shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token2.jsp
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp
    shale/framework/trunk/shale-apps/shale-test-core/src/site/
    shale/framework/trunk/shale-apps/shale-test-core/src/site/site.xml
      - copied unchanged from r471643, shale/framework/trunk/shale-apps/shale-test-view/src/site/site.xml
    shale/framework/trunk/shale-apps/shale-test-core/src/site/xdoc/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/systest/
    shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/systest/IntegrationTestCase.java
      - copied, changed from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java
Modified:
    shale/framework/trunk/shale-apps/pom.xml

Modified: shale/framework/trunk/shale-apps/pom.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/pom.xml?view=diff&rev=471997&r1=471996&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/pom.xml (original)
+++ shale/framework/trunk/shale-apps/pom.xml Mon Nov  6 21:59:52 2006
@@ -334,6 +334,7 @@
         <module>shale-mailreader</module>
         <module>shale-usecases</module>
         <module>shale-clay-usecases</module>
+        <module>shale-test-core</module>
         <module>shale-test-dialog-basic</module>
         <module>shale-test-dialog-scxml</module>
         <module>shale-test-view</module>

Propchange: shale/framework/trunk/shale-apps/shale-test-core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov  6 21:59:52 2006
@@ -0,0 +1 @@
+target

Copied: shale/framework/trunk/shale-apps/shale-test-core/pom.xml (from r471643, shale/framework/trunk/shale-apps/shale-test-view/pom.xml)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/pom.xml?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/pom.xml&r1=471643&p2=shale/framework/trunk/shale-apps/shale-test-core/pom.xml&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/pom.xml (original)
+++ shale/framework/trunk/shale-apps/shale-test-core/pom.xml Mon Nov  6 21:59:52 2006
@@ -28,9 +28,9 @@
         <version>1.0.4-SNAPSHOT</version>
     </parent>
 
-    <artifactId>shale-test-view</artifactId>
+    <artifactId>shale-test-core</artifactId>
     <packaging>war</packaging>
-    <name>Shale Test App (View Controller)</name>
+    <name>Shale Test App (Core Library)</name>
 
     <dependencies>
 
@@ -85,7 +85,7 @@
 
         <dependency>
             <groupId>org.apache.shale</groupId>
-            <artifactId>shale-view</artifactId>
+            <artifactId>shale-core</artifactId>
             <version>${version}</version>
         </dependency>
 

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/core/Recorder.java
(from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/core/Recorder.java?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/core/Recorder.java&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java
(original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/main/java/org/apache/shale/examples/test/core/Recorder.java
Mon Nov  6 21:59:52 2006
@@ -17,7 +17,7 @@
  * $Id$
  */
 
-package org.apache.shale.examples.test.view;
+package org.apache.shale.examples.test.core;
 
 /**
  * <p>Simple bean to record and play back event messages.</p>

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/faces-config.xml
(from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/faces-config.xml&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/faces-config.xml
Mon Nov  6 21:59:52 2006
@@ -32,95 +32,21 @@
     <navigation-rule>
         <from-view-id>*</from-view-id>
         <navigation-case>
-            <from-outcome>lifecycle2</from-outcome>
-            <to-view-id>/lifecycle2.jsp</to-view-id>
-        </navigation-case>
-        <navigation-case>
             <from-outcome>menu</from-outcome>
             <to-view-id>/menu.jsp</to-view-id>
         </navigation-case>
         <navigation-case>
-            <from-outcome>standard</from-outcome>
-            <to-view-id>/standard.jsp</to-view-id>
-        </navigation-case>
-        <navigation-case>
-            <from-outcome>status</from-outcome>
-            <to-view-id>/status.jsp</to-view-id>
+            <from-outcome>token2</from-outcome>
+            <to-view-id>/token2.jsp</to-view-id>
         </navigation-case>
     </navigation-rule>
 
-    <!-- ========== View Controller Beans ========== -->
-
-    <managed-bean>
-        <managed-bean-name>lifecycle1</managed-bean-name>
-        <managed-bean-class>
-            org.apache.shale.examples.test.view.Lifecycle1
-        </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
-        <managed-property>
-            <property-name>recorder</property-name>
-            <value>#{recorder}</value>
-        </managed-property>
-    </managed-bean>
-
-    <managed-bean>
-        <managed-bean-name>lifecycle2</managed-bean-name>
-        <managed-bean-class>
-            org.apache.shale.examples.test.view.Lifecycle2
-        </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
-        <managed-property>
-            <property-name>recorder</property-name>
-            <value>#{recorder}</value>
-        </managed-property>
-    </managed-bean>
-
-    <managed-bean>
-        <managed-bean-name>standard</managed-bean-name>
-        <managed-bean-class>
-            org.apache.shale.examples.test.view.Standard
-        </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
-    </managed-bean>
-
-    <managed-bean>
-        <managed-bean-name>status</managed-bean-name>
-        <managed-bean-class>
-            org.apache.shale.examples.test.view.Status
-        </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
-    </managed-bean>
-
-    <managed-bean>
-        <managed-bean-name>subview1</managed-bean-name>
-        <managed-bean-class>
-            org.apache.shale.examples.test.view.Subview1
-        </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
-        <managed-property>
-            <property-name>recorder</property-name>
-            <value>#{recorder}</value>
-        </managed-property>
-    </managed-bean>
-
-    <managed-bean>
-        <managed-bean-name>subview2</managed-bean-name>
-        <managed-bean-class>
-            org.apache.shale.examples.test.view.Subview2
-        </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
-        <managed-property>
-            <property-name>recorder</property-name>
-            <value>#{recorder}</value>
-        </managed-property>
-    </managed-bean>
-
-    <!-- ========== Other Managed Beans ========== -->
+    <!-- ========== Managed Beans ========== -->
 
     <managed-bean>
         <managed-bean-name>recorder</managed-bean-name>
         <managed-bean-class>
-            org.apache.shale.examples.test.view.Recorder
+            org.apache.shale.examples.test.core.Recorder
         </managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/web.xml (from
r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/web.xml?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/web.xml&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml (original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/WEB-INF/web.xml Mon Nov
 6 21:59:52 2006
@@ -26,7 +26,7 @@
                       version="2.4">
 
   <!-- Display name for this application -->
-  <display-name>Shale Test App (View Controller)</display-name>
+  <display-name>Shale Test App (Core Library)</display-name>
 
   <!-- Select JSF State Saving Mode -->
   <context-param>

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/menu.jsp (from r471966,
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/menu.jsp?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/menu.jsp&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp (original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/menu.jsp Mon Nov  6 21:59:52
2006
@@ -25,17 +25,14 @@
 <f:view>
 <html>
 <head>
-    <title>Shale Test App (View Controller)</title>
+    <title>Shale Test App (Core Library)</title>
 </head>
 <body>
 
-    <h3>Shale Test App (View Controller)</h3>
+    <h3>Shale Test App (Core Library)</h3>
 
     <ul>
-        <li><a href="lifecycle1.faces">Lifecyle Navigation Events</a></li>
-        <li><a href="standard.faces">Standard ViewController Lifecycle Events</a></li>
-        <li><a href="status.faces">Static Status Information</a></li>
-        <li><a href="subview1.faces">Subview Lifecycle Events</a></li>
+        <li><a href="token1.faces">Token Processor</a></li>
     </ul>
 
 

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token1.jsp (from
r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token1.jsp?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token1.jsp&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp (original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token1.jsp Mon Nov  6
21:59:52 2006
@@ -21,42 +21,49 @@
 
 <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
 <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
+<%@ taglib prefix="s" uri="http://shale.apache.org/core" %>
 
 <f:view>
 <html>
 <head>
-    <title>Lifecycle Navigation Test (Page 1)</title>
+    <title>Token Processor Test (Page 1)</title>
 </head>
 <body>
 
-    <h3>Lifecycle Navigation Test (Page 1)</h3>
+    <h3>Token Processor Test (Page 1)</h3>
 
-    <table cellspacing="5">
-        <tr>
-            <th align="center">Name</th>
-            <th align="center">Value</th>
-        </tr>
-        <tr>
-            <th align="right">recorder.events</th>
-            <td><h:outputText id="recorderEvents"
-                           value="#{recorder.events}"/></td>
-        </tr>
-    </table>
-
-    <h:form id="form">
-      <h:commandLink id="navigate" value="Navigate" action="lifecycle2"/>
+    <h:form                          id="form">
+        <h:messages                  id="global"
+                             globalOnly="true"/>
+        <h:panelGrid                 id="grid"
+                                columns="3">
+
+            <h:outputLabel          for="input"
+                                  value="Input:"/>
+            <h:inputText             id="input"
+                               required="true"/>
+            <h:message               id="local"
+                                    for="input"/>
+
+            <h:outputText         value=""/>
+            <s:token                 id="token"/>
+            <h:message               id="message"
+                                    for="token"/>
+
+        </h:panelGrid>
+        <h:commandButton             id="submit"
+                                  value="Submit"
+                                 action="token2"/>
     </h:form>
 
     <h3>Test Description</h3>
 
-    <p>Displays the lifecycle events that have been recorded so far.
-    When this page is initially navigated to, it should be
-    "init1/prerender1/".  When you press the Navigate button, you
-    should advance to page 2, where the event listing should be
-    "init1/preprocess1/init2/prerender2/".</p>
-
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>Displays a form with a single input field that has its
+    "required" attribute set to "true".  Attempts to submit with
+    a blank value (even repeatedly) should fail with a validation
+    error message, but should eventually succeed if a valid
+    value is submitted.  Any later attempt
+    to use the Back Arrow and resubmit, though, should fail.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token2.jsp (from
r471966, shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token2.jsp?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token2.jsp&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp (original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/main/webapp/token2.jsp Mon Nov  6
21:59:52 2006
@@ -21,38 +21,52 @@
 
 <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
 <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
+<%@ taglib prefix="s" uri="http://shale.apache.org/core" %>
 
 <f:view>
 <html>
 <head>
-    <title>Lifecycle Navigation Test (Page 2)</title>
+    <title>Token Processor Test (Page 2)</title>
 </head>
 <body>
 
-    <h3>Lifecycle Navigation Test (Page 2)</h3>
+    <h3>Token Processor Test (Page 2)</h3>
 
-    <table cellspacing="5">
-        <tr>
-            <th align="center">Name</th>
-            <th align="center">Value</th>
-        </tr>
-        <tr>
-            <th align="right">recorder.events</th>
-            <td><h:outputText id="recorderEvents"
-                           value="#{recorder.events}"/></td>
-        </tr>
-    </table>
+    <h:form                          id="form">
+        <h:messages                  id="global"
+                             globalOnly="true"/>
+        <h:panelGrid                 id="grid"
+                                columns="3">
+
+            <h:outputLabel          for="input"
+                                  value="Input:"/>
+            <h:inputText             id="input">
+              <f:validateLength minimum="3"
+                                maximum="5"/>
+            </h:inputText>
+            <h:message               id="local"
+                                    for="input"/>
+
+            <h:outputText         value=""/>
+            <s:token                 id="token"/>
+            <h:message               id="message"
+                                    for="token"/>
+
+        </h:panelGrid>
+        <h:commandButton             id="submit"
+                                  value="Submit"
+                                 action="menu"/>
+    </h:form>
 
-    <h3>Test Description</h3>
 
-    <p>Displays the lifecycle events that have been recorded so far.
-    When this page is initially navigated to, it should be
-    "init1/prerender1/".  When you press the Navigate button, you
-    should advance to page 2, where the event listing should be
-    "init1/preprocess1/init2/prerender2/".</p>
+    <h3>Test Description</h3>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>Displays a form with a single input field that has a length
+    validator checking for 3-5 characters.  Attempts to submit with
+    a invalid value (even repeatedly) should fail with a validation
+    error message, but should eventually succeed if a valid value
+    is submitted.  Any later attempt
+    to use the Back Arrow and resubmit, though, should fail.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Copied: shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/systest/IntegrationTestCase.java
(from r471966, shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java)
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/systest/IntegrationTestCase.java?view=diff&rev=471997&p1=shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java&r1=471966&p2=shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/systest/IntegrationTestCase.java&r2=471997
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java
(original)
+++ shale/framework/trunk/shale-apps/shale-test-core/src/test/java/org/apache/shale/examples/test/core/systest/IntegrationTestCase.java
Mon Nov  6 21:59:52 2006
@@ -17,17 +17,19 @@
  * $Id$
  */
 
-package org.apache.shale.examples.test.view.systest;
+package org.apache.shale.examples.test.core.systest;
 
 import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
 import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.apache.shale.test.cargo.CargoTestSetup;
 import org.apache.shale.test.htmlunit.AbstractHtmlUnitTestCase;
 
 /**
- * <p>Integration tests for the Shale View Controller.</p>
+ * <p>Integration tests for the Shale Core Library.</p>
  */
 public class IntegrationTestCase extends AbstractHtmlUnitTestCase {
     
@@ -85,155 +87,109 @@
     // ------------------------------------------------- Individual Test Methods
 
 
-    // Test /lifecycle1.jsp and /lifecycle2.jsp
-    public void testLifecycle() throws Exception {
-
-        HtmlElement element;
-        page("/lifecycle1.faces");
-        assertEquals("Lifecycle Navigation Test (Page 1)", title());
-
-        // Validate values for initial non-postback call
-        
-        element = element("recorderEvents");
-        assertNotNull(element);
-        assertEquals("init1/prerender1/", element.asText());
-
-        // Click the navigate hyperlink
-
-        HtmlAnchor anchor = (HtmlAnchor) element("form:navigate");
-        assertNotNull(anchor);
-        link(anchor);
-
-        // Validate values for subsequent postback call
-        
-        assertEquals("Lifecycle Navigation Test (Page 2)", title());
-
-        element = element("recorderEvents");
-        assertNotNull(element);
-        assertEquals("init1/preprocess1/init2/prerender2/", element.asText());
-
-    }
-
-
     // Test /menu.jsp
     public void testMenu() throws Exception {
 
-        assertEquals("Shale Test App (View Controller)", title());
+        assertEquals("Shale Test App (Core Library)", title());
 
     }
 
 
-    // Test /standard.jsp
-    public void testStandard() throws Exception {
-
-        HtmlElement element;
-        page("/standard.faces");
-        assertEquals("Standard ViewController Lifecycle Events", title());
-
-        // Validate values for initial non-postback call
-        
-        element = element("initCalled");
-        assertNotNull(element);
-        assertEquals("1", element.asText());
-
-        element = element("preprocessCalled");
-        assertNotNull(element);
-        assertEquals("0", element.asText());
-
-        element = element("prerenderCalled");
-        assertNotNull(element);
-        assertEquals("2", element.asText());
-
-        element = element("destroyCalled");
-        assertNotNull(element);
-        assertEquals("0", element.asText());
-
-        element = element("postBack");
-        assertNotNull(element);
-        assertEquals("false", element.asText());
-
-        // Click the resubmit hyperlink
-
-        HtmlAnchor anchor = (HtmlAnchor) element("form:resubmit");
-        assertNotNull(anchor);
-        link(anchor);
-
-        // Validate values for subsequent postback call
-        
-        element = element("initCalled");
-        assertNotNull(element);
-        assertEquals("1", element.asText());
-
-        element = element("preprocessCalled");
-        assertNotNull(element);
-        assertEquals("2", element.asText());
-
-        element = element("prerenderCalled");
-        assertNotNull(element);
-        assertEquals("3", element.asText());
-
-        element = element("destroyCalled");
-        assertNotNull(element);
-        assertEquals("0", element.asText());
-
-        element = element("postBack");
-        assertNotNull(element);
-        assertEquals("true", element.asText());
-
-    }
-
-
-    // Test access /status.jsp
-    public void testStatus() throws Exception {
-
-        HtmlElement element;
-        page("/status.faces");
-        assertEquals("Static Status Information", title());
-
-        element = element("exceptionHandler");
-        assertNotNull(element);
-        assertEquals("org.apache.shale.view.impl.DefaultExceptionHandler",
-                     element.asText());
-
-        element = element("viewCallbacks");
-        assertNotNull(element);
-        assertEquals("org.apache.shale.view.faces.ViewControllerCallbacks",
-                     element.asText());
-
-        element = element("viewMapper");
-        assertNotNull(element);
-        assertEquals("org.apache.shale.view.impl.DefaultViewControllerMapper",
-                     element.asText());
-
-    }
-
-
-    // Test /subview1.jsp
-    public void testSubview() throws Exception {
-
-        HtmlElement element;
-        page("/subview1.faces");
-        assertEquals("Subview Lifecycle Events", title());
-
-        // Validate values for initial non-postback call
-        
-        element = element("recorderEvents");
-        assertNotNull(element);
-        assertEquals("init1/prerender1/", element.asText());
-
-        // Click the resubmit hyperlink
-
-        HtmlAnchor anchor = (HtmlAnchor) element("form:resubmit");
-        assertNotNull(anchor);
-        link(anchor);
-
-        // Validate values for subsequent postback call
-        
-        assertEquals("Subview Lifecycle Events", title());
+    // Test /token1.jsp and /token2.jsp when invalid input
+    // on each page (submitted twice each to verify this capability)
+    // is ultimately followed by valid input on each page
+    public void testTokenInvalid() throws Exception {
+
+        HtmlTextInput input;
+        HtmlSubmitInput submit;
+        page("/token1.faces");
+
+        // /token1.jsp invalid input
+        assertEquals("Token Processor Test (Page 1)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        // input.setValueAttribute("abc"); // NOTE - no value is set
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // /token1.jsp invalid input (again)
+        assertEquals("Token Processor Test (Page 1)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        // input.setValueAttribute("abc"); // NOTE - no value is set
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // /token1.jsp valid input
+        assertEquals("Token Processor Test (Page 1)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        input.setValueAttribute("abc"); // Now set a valid value
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // /token2.jsp invalid input
+        assertEquals("Token Processor Test (Page 2)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        input.setValueAttribute("abcdef"); // NOTE - invalid value is set
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // /token2.jsp invalid input (again)
+        assertEquals("Token Processor Test (Page 2)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        input.setValueAttribute("abcdef"); // NOTE - invalid value is set
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // /token2.jsp valid input
+        assertEquals("Token Processor Test (Page 2)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        input.setValueAttribute("abcd"); // NOTE - valid value is set
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // Should have returned to the main menu
+        assertEquals("Shale Test App (Core Library)", title());
+
+    }
+
+
+    // Test /token1.jsp and /token2.jsp when valid input is always entered
+    public void testTokenValid() throws Exception {
+
+        HtmlTextInput input;
+        HtmlSubmitInput submit;
+        page("/token1.faces");
+
+        // /token1.jsp valid input
+        assertEquals("Token Processor Test (Page 1)", title());
+        input = (HtmlTextInput) element("form:input");
+        assertNotNull(input);
+        input.setValueAttribute("abc");
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
+
+        // /token2.jsp valid input
+        assertEquals("Token Processor Test (Page 2)", title());
+        assertNotNull(input);
+        input.setValueAttribute("abc");
+        submit = (HtmlSubmitInput) element("form:submit");
+        assertNotNull(submit);
+        submit(submit);
 
-        element = element("recorderEvents");
-        assertNotNull(element);
-        assertEquals("init1/preprocess1/init2/preprocess2/prerender1/", element.asText());
+        // Should have returned to the main menu
+        assertEquals("Shale Test App (Core Library)", title());
 
     }
 



Mime
View raw message