Author: craigmcc
Date: Sat Dec 23 15:41:37 2006
New Revision: 489951

URL: http://svn.apache.org/viewvc?view=rev&rev=489951
Log:
[SHALE-374] Adjust the scope of the "recorder" bean from request to application
so that it can trace event firings across navigation requests.  In this way, we
can validate the correct behavior of destroy events by checking the value
rendered in the second view (which will now be cumulative).  This also required
resetting the recorder between each test run when the application is executed
manually.

All tests currently pass for shale-test-view ... now we need to do the same
kinds of changes for shale-test-tiger to validate destroy behavior there.

Modified:
    
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-view/src/main/webapp/WEB-INF/faces-config.xml
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp
    shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview1.jsp
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview2.jsp
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview3.jsp
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview4.jsp
    
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/subview1.jsp
    
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/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-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
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-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java
 Sat Dec 23 15:41:37 2006
@@ -38,6 +38,15 @@
 
 
     /**
+     * <p>Dummy getter to force clearing when called.</p>
+     */
+    public boolean isClear() {
+        clear();
+        return true;
+    }
+
+
+    /**
      * <p>Return the complete set of events that has occurred since
      * we were last erased.</p>
      */

Modified: 
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-view/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml
 (original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml
 Sat Dec 23 15:41:37 2006
@@ -205,7 +205,7 @@
         <managed-bean-class>
             org.apache.shale.examples.test.view.Recorder
         </managed-bean-class>
-        <managed-bean-scope>request</managed-bean-scope>
+        <managed-bean-scope>application</managed-bean-scope>
     </managed-bean>
 
 </faces-config>

Modified: 
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-view/src/main/webapp/WEB-INF/web.xml?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml
 (original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml
 Sat Dec 23 15:41:37 2006
@@ -35,10 +35,12 @@
   </context-param>
 
   <!-- JSF Configuration Resources (comma-separated list) -->
+  <!-- This is the default, does not have to be explicitly declared
   <context-param>
     <param-name>javax.faces.CONFIG_FILES</param-name>
     <param-value>/WEB-INF/faces-config.xml</param-value>
   </context-param>
+  -->
 
   <context-param>
     <param-name>org.apache.shale.view.EXCEPTION_DISPATCH_PATH</param-name>

Modified: 
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-view/src/main/webapp/lifecycle1.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp 
Sat Dec 23 15:41:37 2006
@@ -51,12 +51,12 @@
 
     <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
+    <code>init1/prerender1/</code>.  When you press the Navigate button, you
     should advance to page 2, where the event listing should be
-    "init1/preprocess1/init2/prerender2/".</p>
+    
<code>init1/prerender1/destroy1/init1/preprocess1/init2/prerender2/</code>.</p>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>NOTE:  The final destroy event(s) for each request do not get listed,
+    because rendering is completed before that method gets called.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
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-view/src/main/webapp/lifecycle2.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp 
Sat Dec 23 15:41:37 2006
@@ -47,12 +47,12 @@
 
     <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
+    <code>init1/prerender1/</code>.  When you press the Navigate button, you
     should advance to page 2, where the event listing should be
-    "init1/preprocess1/init2/prerender2/".</p>
+    
<code>init1/prerender1/destroy1/init1/preprocess1/init2/prerender2/</code>.</p>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>NOTE:  The final destroy event(s) for each request do not get listed,
+    because rendering is completed before that method gets called.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
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-view/src/main/webapp/menu.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp 
(original)
+++ shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp 
Sat Dec 23 15:41:37 2006
@@ -48,6 +48,11 @@
     navigation links are included so that the pages may be executed by hand
     as well.</p>
 
+    <h:panelGroup rendered="#{recorder.clear}">
+        <f:verbatim>
+            <p>Recorder has been cleared for the next test cycle.</p>
+        </f:verbatim>
+    </h:panelGroup>
 
     <h3>Test View Controller Exception Handling Strategy</h3>
     

Modified: 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview1.jsp
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview1.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview1.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview1.jsp 
Sat Dec 23 15:41:37 2006
@@ -51,13 +51,13 @@
 
     <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
+    <code>init1/prerender1/</code>.  When you press the Navigate button, you
     should advance to page 2, where the event listing should be
-    "init1/preprocess1/" because the second page does not implement
-    ViewController.</p>
+    <code>init1/prerender1/destroy1/init1/preprocess1/</code> because
+    the second page does not implement ViewController.</p>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>NOTE:  The final destroy event(s) for each request do not get listed,
+    because rendering is completed before that method gets called.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview2.jsp
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview2.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview2.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview2.jsp 
Sat Dec 23 15:41:37 2006
@@ -47,13 +47,13 @@
 
     <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
+    <code>init1/prerender1/</code>.  When you press the Navigate button, you
     should advance to page 2, where the event listing should be
-    "init1/preprocess1/" because the second page does not implement
-    ViewController.</p>
+    <code>init1/prerender1/destroy1/init1/preprocess1/</code> because
+    the second page does not implement ViewController.</p>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>NOTE:  The final destroy event(s) for each request do not get listed,
+    because rendering is completed before that method gets called.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview3.jsp
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview3.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview3.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview3.jsp 
Sat Dec 23 15:41:37 2006
@@ -51,13 +51,14 @@
 
     <p>Displays the lifecycle events that have been recorded so far.
     When this page is initially navigated to, it should be
-    "init3/prerender3/".  When you press the Navigate button, you
+    <code>init3/prerender3/</code>.  When you press the Navigate button, you
     should advance to page 2, where the event listing should be
-    "init3/preprocess3/" because the second page does not have a
-    ViewControllerMapper compatible backing bean name.</p>
+    <code>init3/prerender3/destroy3/init3/preprocess3/</code> because
+    the second page does not have a ViewControllerMapper compatible
+    backing bean name.</p>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>NOTE:  The final destroy event(s) for each request do not get listed,
+    because rendering is completed before that method gets called.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview4.jsp
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview4.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview4.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview4.jsp 
Sat Dec 23 15:41:37 2006
@@ -47,13 +47,14 @@
 
     <p>Displays the lifecycle events that have been recorded so far.
     When this page is initially navigated to, it should be
-    "init3/prerender3/".  When you press the Navigate button, you
+    <code>init3/prerender3/</code>.  When you press the Navigate button, you
     should advance to page 2, where the event listing should be
-    "init3/preprocess3/" because the second page does not have a
-    ViewControllerMapper compatible backing bean name.</p>
+    <code>init3/prerender3/destroy3/init3/preprocess3/</code> because
+    the second page does not have a ViewControllerMapper compatible
+    backing bean name.</p>
 
-    <p>NOTE:  Destroy events do not get listed, because rendering
-    is completed before that method gets called.</p>
+    <p>NOTE:  The final destroy event(s) for each request do not get listed,
+    because rendering is completed before that method gets called.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/subview1.jsp
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/subview1.jsp?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/subview1.jsp 
(original)
+++ 
shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/subview1.jsp 
Sat Dec 23 15:41:37 2006
@@ -56,16 +56,13 @@
 
     <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 Resubmit button, you
-    should see "init1/preprocess1/init2/preprocess2/prerender1".</p>
+    <code>init1/prerender1/</code>.  When you press the Resubmit button, you
+    should see
+    
<code>init1/prerender1/init2/prerender2/destroy2/destroy1/init1/preprocess1/init2/preprocess2/prerender1/</code>.</p>
 
     <p>NOTE:  The display does not show all of the events that are
     actually fired, because of the way JSF 1.1 builds the component
-    tree on the fly.  If you check the System.out log of your servlet
-    container, you will see that the actual stream of events for the
-    initial page is "init1/prerender1/init2/prerender2/destroy2/destroy1"
-    and the stream of events for the resubmit is actually
-    
"init1/preprocess1/init2/preprocess2/prerender1/prerender2/destroy2/destroy1".</p>
+    tree on the fly.</p>
 
     <p><a href="menu.faces">Back</a> to main menu</p>
 

Modified: 
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-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java?view=diff&rev=489951&r1=489950&r2=489951
==============================================================================
--- 
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-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java
 Sat Dec 23 15:41:37 2006
@@ -110,7 +110,7 @@
 
         element = element("recorderEvents");
         assertNotNull(element);
-        assertEquals("init1/preprocess1/init2/prerender2/", element.asText());
+        
assertEquals("init1/prerender1/destroy1/init1/preprocess1/init2/prerender2/", 
element.asText());
 
     }
 
@@ -148,7 +148,7 @@
 
         element = element("recorderEvents");
         assertNotNull(element);
-        assertEquals("init1/preprocess1/", element.asText());
+        assertEquals("init1/prerender1/destroy1/init1/preprocess1/", 
element.asText());
 
     }
 
@@ -178,7 +178,7 @@
 
         element = element("recorderEvents");
         assertNotNull(element);
-        assertEquals("init3/preprocess3/", element.asText());
+        assertEquals("init3/prerender3/destroy3/init3/preprocess3/", 
element.asText());
 
     }
 
@@ -293,7 +293,7 @@
 
         element = element("recorderEvents");
         assertNotNull(element);
-        assertEquals("init1/preprocess1/init2/preprocess2/prerender1/", 
element.asText());
+        
assertEquals("init1/prerender1/init2/prerender2/destroy2/destroy1/init1/preprocess1/init2/preprocess2/prerender1/",
 element.asText());
 
     }
 


Reply via email to