Issue Details (XML | Word | Printable)

Key: SHALE-374
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig McClanahan
Reporter: Craig McClanahan
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Shale

Verify that the destroy callbacks are being called correctly

Created: 23/Dec/06 09:58 PM   Updated: 23/Jan/07 04:40 PM
Component/s: Tiger, View
Affects Version/s: None
Fix Version/s: 1.0.4


 Description  « Hide
While reviewing the behavior reported in SHALE-371, it became clear that we do not have automated testing to verify that the destroy callbacks on a ViewController (shale-view) or @View bean (shale-tiger) are being correctly called. Need to (at a minimum) manually verify that for all cases, and (better) provide means to test this automatically so we can catch any future regressions.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #489951 Sat Dec 23 23:41:37 UTC 2006 craigmcc [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.
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/subview1.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview1.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview2.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/web.xml
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview3.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/nonview4.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp

Repository Revision Date User Message
ASF #489960 Sun Dec 24 00:42:36 UTC 2006 craigmcc [SHALE-374] Make changes to shale-test-tiger corresponding to those just made
to shale-test-view, to make the recorder bean application scoped so we can
watch for destroy events across navigation. It does indeed appear there is a
bug in this area ... no destroy events are being recorded. For now, check in
the tests with the failing assertions commented out and marked with FIXME, but
this needs to get taken care of before we cut 1.0.4.
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Recorder.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/webapp/menu.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/ApplicationBean.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/test/java/org/apache/shale/examples/test/tiger/systest/IntegrationTestCase.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Managed.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/RequestBean.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/webapp/WEB-INF/web.xml
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/SessionBean.java

Repository Revision Date User Message
ASF #489966 Sun Dec 24 01:43:42 UTC 2006 craigmcc Explicitly remove request scope attributes that implement @Request or @View,
which will trigger the event that actually calls @Destroy methods. However,
it is not currently guaranteed that this will happen within the scope of a
Faces request (i.e. FacesContext.getCurrentInstance() will return zero if this
happens in the servlet container's cleanup), which can be inconvenient if you
need access to JSF resources in the destroy method. Therefore, leaving this
open to investigate a solution (although it will have to wait a couple of days)
to get attention.

SHALE-374
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/test/java/org/apache/shale/examples/test/tiger/systest/IntegrationTestCase.java
MODIFY /shale/framework/trunk/shale-view/src/main/java/org/apache/shale/view/faces/LifecycleListener.java
MODIFY /shale/framework/trunk/shale-tiger/src/main/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java

Repository Revision Date User Message
ASF #490577 Wed Dec 27 22:19:21 UTC 2006 craigmcc [SHALE-374] Ensure that destroy() callbacks occur within the JSF lifecycle,
so that references to FacesContext.getCurrentInstance() will still work. That
way, destroy() methods can still use JSF facilities to perform their cleanup
tasks.
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Lifecycle2.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Lifecycle1.java
MODIFY /shale/framework/trunk/shale-view/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle2.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle1.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java

Craig McClanahan added a comment - 27/Dec/06 10:21 PM
I just checked in a fix that ensures the destroy() method on request scoped beans gets called within the context of a JSF request (rather than being part of the cleanup that happens afterwards). This fix will be in the 20061228 nightly build, and is good to go for 1.0.4 as well.

Craig McClanahan made changes - 27/Dec/06 10:21 PM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Craig McClanahan added a comment - 29/Dec/06 11:54 PM
It turns out that the order in which beans get their destroy() method called is non-deterministic across platforms, and indeed is different on Solaris/X86 than it is on Linux. Reopening to get this adjusted.

Craig McClanahan made changes - 29/Dec/06 11:54 PM
Status Resolved [ 5 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #491164 Sat Dec 30 03:54:39 UTC 2006 craigmcc The least risky approach to dealing with non-deterministic destroy() call
ordering (SHALE-374) is to make the test case accept either order. We can
review whether we want to guarantee a particular order in some future version.
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/test/java/org/apache/shale/examples/test/tiger/systest/IntegrationTestCase.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java

Craig McClanahan added a comment - 30/Dec/06 03:56 AM
I have committed a minimal-risk fix for now, making the test cases accept either ordering of destroy events. We can decide in a future version whether or not to guarantee a particular ordering.

Craig McClanahan made changes - 30/Dec/06 03:56 AM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Rahul Akolkar made changes - 23/Jan/07 04:40 PM
Fix Version/s 1.0.4-SNAPSHOT [ 21740 ]
Fix Version/s 1.0.4 [ 21790 ]
Jeff Turner made changes - 09/Aug/07 07:15 AM
Workflow Struts [ 39071 ] Struts - editable closed status [ 41667 ]
Antonio Petrelli made changes - 08/Jan/09 08:56 AM
Workflow Struts - editable closed status [ 41667 ] Struts - editable closed status (temporary) [ 46012 ]
Antonio Petrelli made changes - 08/Jan/09 09:08 AM
Workflow Struts - editable closed status (temporary) [ 46012 ] Struts - editable closed status [ 52700 ]