You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2006/04/17 22:45:21 UTC

svn commit: r394774 - in /beehive/trunk/netui: src/pageflow/org/apache/beehive/netui/pageflow/ test/webapps/drt/src/controls/lifecycle2/ test/webapps/drt/src/controls/lifecycle3/ test/webapps/drt/src/controls/llLifecycle/ test/webapps/drt/src/controls/...

Author: crogers
Date: Mon Apr 17 13:45:19 2006
New Revision: 394774

URL: http://svn.apache.org/viewcvs?rev=394774&view=rev
Log:
Adding some tests for control life cycle testing within shared flwos and long lived page flows.
Also included some very minor corrections to Copyright dates and typos.

tests: netui runtime bvt (WinXP)


Added:
    beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/
    beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/ControlLifecycleController.java   (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/
    beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/Controller.java   (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/
    beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/ControlLifecycleController.java   (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/SharedFlow.java   (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/
    beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/index.jsp   (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/
    beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/index.jsp   (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/
    beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/index.jsp   (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/sharedFlowPage.jsp   (with props)
Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
    beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/ControlLifecycleController.java
    beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/SharedFlow.java
    beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle3/ControlLifecycleController.java
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControl.java
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControlImpl.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?rev=394774&r1=394773&r2=394774&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java Mon Apr 17 13:45:19 2006
@@ -357,7 +357,7 @@
      * Get the shared flow with the given class name.
      * @deprecated Use {@link #getSharedFlow(String, HttpServletRequest, ServletContext)} instead.
      * 
-     * @param sharedFlowClassName the class name of the shared flow to remove.
+     * @param sharedFlowClassName the class name of the shared flow to retrieve.
      * @param request the current HttpServletRequest.
      * @return the {@link SharedFlowController} of the given class name which is stored in the user session.
      */ 
@@ -370,7 +370,7 @@
     /**
      * Get the shared flow with the given class name.
      * 
-     * @param sharedFlowClassName the class name of the shared flow to remove.
+     * @param sharedFlowClassName the class name of the shared flow to retrieve.
      * @param request the current HttpServletRequest.
      * @return the {@link SharedFlowController} of the given class name which is stored in the user session.
      */ 

Modified: beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/ControlLifecycleController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/ControlLifecycleController.java?rev=394774&r1=394773&r2=394774&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/ControlLifecycleController.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/ControlLifecycleController.java Mon Apr 17 13:45:19 2006
@@ -1,26 +1,26 @@
-/**
- Copyright 2004 The Apache Software Foundation.
-
- 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:$
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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 controls.lifecycle2;
 
-import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
 import org.apache.beehive.netui.pageflow.annotations.Jpf;
-import org.apache.beehive.controls.api.bean.Control;
 
 /**
  *
@@ -30,7 +30,6 @@
     sharedFlowRefs={
         @Jpf.SharedFlowRef(name="shared", type=controls.lifecycle2.SharedFlow.class)
     }
-
 )
 public class ControlLifecycleController
     extends PageFlowController {
@@ -41,8 +40,7 @@
     private String _onCreateMsg;
     private String _beginMsg;
 
-    public String getPropertyMsg()
-    {
+    public String getPropertyMsg() {
         return  _shared.getControlMessage("get property");
     }
 

Modified: beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/SharedFlow.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/SharedFlow.java?rev=394774&r1=394773&r2=394774&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/SharedFlow.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle2/SharedFlow.java Mon Apr 17 13:45:19 2006
@@ -1,21 +1,35 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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 controls.lifecycle2;
 
-import org.apache.beehive.netui.pageflow.Forward;
 import org.apache.beehive.netui.pageflow.SharedFlowController;
 import org.apache.beehive.netui.pageflow.annotations.Jpf;
 import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.netui.test.controls.pflifecycle.PfControlLifecycle;
 
-@Jpf.Controller(
-)
+@Jpf.Controller()
 public class SharedFlow extends SharedFlowController
 {
     @Control
     private PfControlLifecycle _control;
 
-    public String getControlMessage(String echoMsg)
-    {
-	//System.err.println("Inside the shared flow control access method");
-	return _control.echo("shared flow access -- controls.lifecycle.ControlLifecycleController");
+    public String getControlMessage(String echoMsg) {
+        //System.err.println("Inside the shared flow control access method");
+        return _control.echo("shared flow access -- controls.lifecycle.ControlLifecycleController");
     }
 }

Modified: beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle3/ControlLifecycleController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle3/ControlLifecycleController.java?rev=394774&r1=394773&r2=394774&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle3/ControlLifecycleController.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/lifecycle3/ControlLifecycleController.java Mon Apr 17 13:45:19 2006
@@ -1,5 +1,5 @@
 /**
- Copyright 2004 The Apache Software Foundation.
+ Copyright 2006 The Apache Software Foundation.
 
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
@@ -17,10 +17,10 @@
  */
 package controls.lifecycle3;
 
-import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
 import org.apache.beehive.netui.pageflow.annotations.Jpf;
-import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.netui.test.controls.container.ContainerControl;
 
 /**
@@ -38,15 +38,14 @@
     private String _onCreateMsg;
     private String _beginMsg;
 
-    public String getPropertyMsg()
-    {
-	//System.err.println("Inside the property Accessor");
+    public String getPropertyMsg() {
+        //System.err.println("Inside the property Accessor");
         return  _control.echo("get property -- controls.lifecycle.ControlLifecycleController");
     }
 
     public void onCreate() {
-	//System.err.println("Inside the Controller onCreate");
-	//System.err.println("Context:" + _control.getInfo());
+        //System.err.println("Inside the Controller onCreate");
+        //System.err.println("Context:" + _control.getInfo());
         _onCreateMsg = _control.echo("onCreate -- controls.lifecycle.ControlLifecycleController");
     }
 

Added: beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/ControlLifecycleController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/ControlLifecycleController.java?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/ControlLifecycleController.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/ControlLifecycleController.java Mon Apr 17 13:45:19 2006
@@ -0,0 +1,116 @@
+/**
+ Copyright 2006 The Apache Software Foundation.
+
+ 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 controls.llLifecycle;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.PageFlowUtils;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.netui.test.controls.pfcontainer.PageFlowContextControl;
+
+/**
+ * Test Control life cycle within a long lived page flow.
+ */
+@Jpf.Controller(
+    forwards = {@Jpf.Forward(name="success", path="index.jsp")}
+)
+public class ControlLifecycleController
+    extends PageFlowController {
+
+    @Control
+    private PageFlowContextControl _control;
+
+    public String getPropertyMsg() {
+        return checkControl(".getPropertyMsg()");
+    }
+
+    @Jpf.Action()
+    public Forward begin() {
+        String message = checkControl(".begin()");
+        return new Forward("success", "controlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "samePage",
+                navigateTo=Jpf.NavigateTo.currentPage)
+        })
+    public Forward navigateToCurrentPage() {
+        String message = checkControl(".navigateToCurrentPage()");
+        return new Forward("samePage", "controlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "longlived",
+                path = "longlived/begin.do")
+        })
+    public Forward longlived() {
+        String message = checkControl(".longlived(): go to long lived page flow");
+        return new Forward("longlived", "controlResults", message);
+    }
+
+    @Jpf.Action()
+    public Forward removeLonglived() {
+        String message = checkControl(".removeLonglived(): call call PageFlowUtils.removeLongLivedPageFlow()");
+
+        // BEEHIVE-1103 - the onDestroy() life cylce method of the long
+        // lived page flow does not get called when we run this routine.
+        PageFlowUtils.removeLongLivedPageFlow(getModulePath() + "/longlived", getRequest(), getServletContext());
+        return new Forward("success", "controlResults", message);
+    }
+
+    protected void onCreate() {
+        checkControl(".onCreate()");
+    }
+
+    protected void beforeAction() {
+        checkControl(".beforeAction()");
+    }
+
+    protected void afterAction() {
+        checkControl(".afterAction()");
+    }
+
+    protected void onDestroy(HttpSession session) {
+        //causes exception, see BEEHIVE-1094
+        //checkControl(".onDestroy()");
+        //try...
+        System.out.println(getClass().getName() + ".onDestroy() - w/o ctrl testing");
+    }
+
+    private String checkControl(String label) {
+        StringBuilder ctrlMsg = new StringBuilder(128);
+        ctrlMsg.append(getClass().getName()).append(label);
+        ctrlMsg.append(" | control test ");
+        if (_control != null) {
+            ctrlMsg.append(_control.checkPageFlow(this) ? "OK" : "FAILED");
+        }
+        else {
+            ctrlMsg.append("not run");
+        }
+        System.out.println(ctrlMsg.toString());
+        return ctrlMsg.toString();
+    }
+}

Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/ControlLifecycleController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/Controller.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/Controller.java?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/Controller.java Mon Apr 17 13:45:19 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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 controls.llLifecycle.longlived;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.netui.test.controls.pfcontainer.PageFlowContextControl;
+
+/**
+ * Test Control life cycle within a long lived page flow.
+ */
+@Jpf.Controller(
+    longLived=true
+)
+public class Controller extends PageFlowController
+{
+    @Control()
+    private PageFlowContextControl _control;
+
+    public String getPropertyMsg() {
+        return checkControl(".getPropertyMsg()");
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "success",
+                path = "index.jsp")
+        })
+    public Forward begin() {
+        String message = checkControl(".begin()");
+        return new Forward("success", "llControlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "leave",
+                path = "../begin.do")
+        })
+    public Forward leave() {
+        String message = checkControl(".leave(): leave the long lived page flow");
+        return new Forward("leave", "llControlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "leave",
+                path = "../begin.do")
+        })
+    public Forward leaveAndRemove() {
+        // Call remove() and go to another pageflow
+        // so we can see onDestroy() work. Note that
+        // onDestroy will blow away the CBC for the
+        // PageFlowController so the endContext() after
+        // this action will blow if this onRelease()
+        // tries to call the control!
+        String message = checkControl(".leaveAndRemove(): leave the long lived page flow, call remove()");
+        remove();
+        return new Forward("leave", "llControlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "samePage",
+                navigateTo=Jpf.NavigateTo.currentPage)
+        })
+    public Forward doNothing() {
+        String message = checkControl(".doNothing()");
+        return new Forward("samePage", "llControlResults", message);
+    }
+
+    protected void onCreate() {
+        checkControl(".onCreate()");
+    }
+
+    protected void beforeAction() {
+        checkControl(".beforeAction()");
+    }
+
+    protected void afterAction() {
+        checkControl(".afterAction()");
+    }
+
+    protected void onDestroy(HttpSession session) {
+        //causes exception, see BEEHIVE-1094
+        //checkControl(".onDestroy()");
+        //try...
+        System.out.println(getClass().getName() + ".onDestroy() - w/o ctrl testing");
+    }
+
+    public void valueBound(javax.servlet.http.HttpSessionBindingEvent event) {
+        System.out.println(getClass().getName() + ".valueBound()");
+        super.valueBound(event);
+    }
+
+    public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) {
+        System.out.println(getClass().getName() + ".valueUnbound()");
+        super.valueUnbound(event);
+    }
+
+    private String checkControl(String label) {
+        StringBuilder ctrlMsg = new StringBuilder(128);
+        ctrlMsg.append(getClass().getName()).append(label);
+        ctrlMsg.append(" | control test ");
+        if (_control != null) {
+            ctrlMsg.append(_control.checkPageFlow(this) ? "OK" : "FAILED");
+        }
+        else {
+            ctrlMsg.append("not run");
+        }
+        System.out.println(ctrlMsg.toString());
+        return ctrlMsg.toString();
+    }
+}

Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/llLifecycle/longlived/Controller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/ControlLifecycleController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/ControlLifecycleController.java?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/ControlLifecycleController.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/ControlLifecycleController.java Mon Apr 17 13:45:19 2006
@@ -0,0 +1,125 @@
+/**
+ Copyright 2006 The Apache Software Foundation.
+
+ 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 controls.sfLifecycle;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.PageFlowUtils;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.netui.test.controls.pfcontainer.PageFlowContextControl;
+
+/**
+ * Test Control life cycle within a shared flow.
+ */
+@Jpf.Controller(
+    forwards = {@Jpf.Forward(name="success", path="index.jsp")},
+    sharedFlowRefs = {
+        @Jpf.SharedFlowRef(name="shared", type=controls.sfLifecycle.SharedFlow.class)
+    }
+)
+public class ControlLifecycleController
+    extends PageFlowController {
+
+    @Jpf.SharedFlowField(name="shared")
+    private SharedFlow _shared;
+
+    @Control
+    private PageFlowContextControl _control;
+
+    public String getPropertyMsg() {
+        return checkControl(".getPropertyMsg()");
+    }
+
+    @Jpf.Action()
+    public Forward begin() {
+        String message = checkControl(".begin()");
+        return new Forward("success", "controlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "samePage",
+                navigateTo=Jpf.NavigateTo.currentPage)
+        })
+    public Forward navigateToCurrentPage() {
+        String message = checkControl(".navigateToCurrentPage()");
+        return new Forward("samePage", "controlResults", message);
+    }
+
+    @Jpf.Action()
+    protected Forward sfFieldTest() throws Exception{
+        String message = _shared.checkControl(this);
+        return new Forward("success", "controlResults", message);
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "runIt",
+                action = "shared.sharedFlowAction")
+        })
+    public Forward runSharedFlow() {
+        String message = checkControl(".runSharedFlow(): execute a shared flow action");
+        return new Forward("runIt", "controlResults", message);
+    }
+
+    @Jpf.Action()
+    public Forward removeSharedFlow() {
+        String message = checkControl(".removeSharedFlow(): call PageFlowUtils.removeSharedFlow()");
+        PageFlowUtils.removeSharedFlow(_shared.getClass().getName(), getRequest(), getServletContext());
+        return new Forward("success", "controlResults", message);
+    }
+
+    protected void onCreate() {
+        checkControl(".onCreate()");
+    }
+
+    protected void beforeAction() {
+        checkControl(".beforeAction()");
+    }
+
+    protected void afterAction() {
+        checkControl(".afterAction()");
+    }
+
+    protected void onDestroy(HttpSession session) {
+        //causes exception, see BEEHIVE-1094
+        //checkControl(".onDestroy()");
+        //try...
+        System.out.println(getClass().getName() + ".onDestroy() - w/o ctrl testing");
+    }
+
+    private String checkControl(String label) {
+        StringBuilder ctrlMsg = new StringBuilder(128);
+        ctrlMsg.append(getClass().getName()).append(label);
+        ctrlMsg.append(" | control test ");
+        if (_control != null) {
+            ctrlMsg.append(_control.checkPageFlow(this) ? "OK" : "FAILED");
+        }
+        else {
+            ctrlMsg.append("not run");
+        }
+        System.out.println(ctrlMsg.toString());
+        return ctrlMsg.toString();
+    }
+}

Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/ControlLifecycleController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/SharedFlow.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/SharedFlow.java?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/SharedFlow.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/SharedFlow.java Mon Apr 17 13:45:19 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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 controls.sfLifecycle;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.PageFlowUtils;
+import org.apache.beehive.netui.pageflow.SharedFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.netui.test.controls.pfcontainer.PageFlowContextControl;
+
+
+/**
+ * Test Control life cycle within a shared flow.
+ */
+@Jpf.Controller()
+public class SharedFlow extends SharedFlowController
+{
+    @Control()
+    private PageFlowContextControl _control;
+
+    public String checkControl(PageFlowController currentPageFlow) {
+        return checkControl(".getPropertyMsg()", currentPageFlow);
+    }
+
+    @Jpf.Action(
+        forwards={
+            @Jpf.Forward(
+                name="success",
+                navigateTo=Jpf.NavigateTo.currentPage)
+        })
+    public Forward sharedFlowAction() {
+        String message = checkControl(".sharedFlowAction(): execute Action");
+        return new Forward( "success", "sfControlResults", message );
+    }
+
+    @Jpf.Action(
+        forwards = {
+            @Jpf.Forward(
+                name = "success",
+                navigateTo=Jpf.NavigateTo.currentPage)
+        })
+    public Forward leaveAndRemove() {
+        // Call remove() and go to another pageflow
+        // so we can see onDestroy() work. Note that
+        // onDestroy will blow away the CBC for the
+        // PageFlowController so the endContext() after
+        // this action will blow if this onRelease()
+        // tries to call the control!
+        String message = checkControl(".leaveAndRemove(): execute Action, call remove()");
+        remove();
+        return new Forward("success", "sfControlResults", message);
+    }
+
+    protected void onCreate() {
+        // When a shared flow is created, the parent page flow
+        // is not fully created yet. This means that call here
+        // to a control that has a @Context member field of type
+        // PageFlowController will fail. The ControlBean.ensureControl
+        // will fail because the PageFlowController contextual
+        // service is not yet available. BEEHIVE-1104
+        try {
+            checkControl(".onCreate()");
+        }
+        catch (ControlException ce) {
+            StringBuilder ctrlMsg = new StringBuilder(128);
+            ctrlMsg.append(getClass().getName());
+            ctrlMsg.append(".onCreate() | control test FAILED!");
+            System.out.println(ctrlMsg.toString());
+            ce.printStackTrace(System.out);
+        }
+    }
+
+    protected void beforeAction() {
+        checkControl(".beforeAction()");
+    }
+
+    protected void afterAction() {
+        checkControl(".afterAction()");
+    }
+
+    protected void onDestroy(HttpSession session) {
+        //causes exception, see BEEHIVE-1094
+        //checkControl(".onDestroy()", null);
+        //try...
+        System.out.println(getClass().getName() + ".onDestroy() - w/o ctrl testing");
+    }
+
+    public void valueBound(javax.servlet.http.HttpSessionBindingEvent event) {
+        System.out.println(getClass().getName() + ".valueBound()");
+        super.valueBound(event);
+    }
+
+    public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) {
+        System.out.println(getClass().getName() + ".valueUnbound()");
+        super.valueUnbound(event);
+    }
+
+    private String checkControl(String label) {
+        PageFlowController currentPageFlow = PageFlowUtils.getCurrentPageFlow(getRequest(), getServletContext());
+        return checkControl(label, currentPageFlow);
+    }
+
+    private String checkControl(String label, PageFlowController currentPageFlow) {
+        StringBuilder ctrlMsg = new StringBuilder(128);
+        ctrlMsg.append(getClass().getName()).append(label);
+        ctrlMsg.append(" | control test ");
+        if (_control != null) {
+            ctrlMsg.append(_control.checkPageFlow(currentPageFlow) ? "OK" : "FAILED");
+        }
+        else {
+            ctrlMsg.append("not run");
+        }
+        System.out.println(ctrlMsg.toString());
+        return ctrlMsg.toString();
+    }
+}

Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/sfLifecycle/SharedFlow.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControl.java?rev=394774&r1=394773&r2=394774&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControl.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControl.java Mon Apr 17 13:45:19 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControlImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControlImpl.java?rev=394774&r1=394773&r2=394774&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControlImpl.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/container/ContainerControlImpl.java Mon Apr 17 13:45:19 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@
     private ServletContext _sc;
 
     @Context
-    private ServletRequest _sr;
+    private ServletRequest _sreq;
 
     @Context
     private ServletResponse _sresp;
@@ -61,11 +61,10 @@
         return "Echo: '" + value + "'";
     }
 
-    public String getInfo()
-    {
+    public String getInfo() {
         return "Context: " + (_sc != null) +
-            ", Response: " + (_sresp != null) +
-            ", Request: " + (_sc != null);
+               ", Response: " + (_sresp != null) +
+               ", Request: " + (_sreq != null);
     }
 
     @EventHandler(field = "_context", eventSet = ControlBeanContext.LifeCycle.class, eventName = "onCreate")
@@ -77,7 +76,7 @@
     public void onAquire() {
         checkContainerContext();
 
-        if(!_onReleaseCalled) 
+        if (!_onReleaseCalled)
             throw new IllegalStateException("onAcquire called without having called on Release on the previous request!");
 
         _onReleaseCalled = false;
@@ -91,24 +90,22 @@
 
     private void checkContainerContext() {
         ControlContainerContext ccc = ControlThreadContext.getContext();
-
-        if(ccc == null)
+        if (ccc == null)
             throw new IllegalStateException("Control could not find a valid ControlContainerContext!");
-
-        if(!(ccc instanceof ServletBeanContext))
+        if (!(ccc instanceof ServletBeanContext))
             throw new IllegalStateException("Control container context is not a ServletBeanContext");
 
         ServletBeanContext servletBeanContext = (ServletBeanContext)ccc;
-        if(servletBeanContext.getServletRequest() == null)
+        if (servletBeanContext.getServletRequest() == null)
             throw new IllegalStateException("ServletBeanContext could not provide a valid ServletRequest!");
 
-        boolean diff = (_sr != servletBeanContext.getServletRequest());
-        if (diff && _sr instanceof ServletRequestWrapper)
-            diff = (_sr == ((ServletRequestWrapper) _sr).getRequest());
+        boolean diff = (_sreq != servletBeanContext.getServletRequest());
+        if (diff && _sreq instanceof ServletRequestWrapper)
+            diff = (_sreq == ((ServletRequestWrapper) _sreq).getRequest());
         if (diff)
             throw new IllegalStateException("Wired Up ServletRequest doesn't match ServletBeanContext request");
 
-        if(servletBeanContext.getServletResponse() == null)
+        if (servletBeanContext.getServletResponse() == null)
             throw new IllegalStateException("ServletBeanContext could not provide a valid ServletResponse!");
 
         diff = (_sresp != servletBeanContext.getServletResponse());

Added: beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/index.jsp?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/index.jsp Mon Apr 17 13:45:19 2006
@@ -0,0 +1,44 @@
+<%--
+   Copyright 2006 The Apache Software Foundation.
+
+   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:$
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+    <head>
+        <title>Control Lifecycle Test 4</title>
+    </head>
+    <netui:body>
+        <h4>Control Lifecycle Test 4</h4>
+        <p style="color:green">This test verifies the life cycle of a long lived page flow containg a control.</p>
+        <br>
+        <netui:anchor action="longlived">go to a long lived page flow</netui:anchor>
+        <br>
+        <netui:anchor action="removeLonglived">remove a long lived page flow</netui:anchor>
+        <br>
+        <netui:anchor action="navigateToCurrentPage">this page flow</netui:anchor>
+        <br>
+        <br>
+        Main Flow results:
+        <br>
+        <netui:span value="${pageInput.controlResults}"/>
+        <br>
+        <br>
+        Long Lived Page Flow results:
+        <br>
+        <netui:span value="${pageInput.llControlResults}"/>
+    </netui:body>
+</netui:html>
\ No newline at end of file

Propchange: beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/index.jsp?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/index.jsp Mon Apr 17 13:45:19 2006
@@ -0,0 +1,43 @@
+<%--
+   Copyright 2006 The Apache Software Foundation.
+
+   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:$
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui" %>
+<netui:html>
+    <head>
+        <title>Control Lifecycle Test 4 - Long Lived Page Flow</title>
+    </head>
+    <body>
+        <h4>Control Lifecycle Test 4 - Long Lived Page Flow</h4>
+
+        <netui:anchor action="doNothing">run an empty action</netui:anchor>
+        <br>
+        <netui:anchor action="leave">leave this long lived page flow</netui:anchor>
+        <br>
+        <netui:anchor action="leaveAndRemove">leave and remove this long lived page flow</netui:anchor>
+        <br>
+        <br>
+        Main Flow results:
+        <br>
+        <netui:span value="${pageInput.controlResults}"/>
+        <br>
+        <br>
+        Long Lived Page Flow results:
+        <br>
+        <netui:span value="${pageInput.llControlResults}"/>
+    </body>
+</netui:html>

Propchange: beehive/trunk/netui/test/webapps/drt/web/controls/llLifecycle/longlived/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/index.jsp?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/index.jsp Mon Apr 17 13:45:19 2006
@@ -0,0 +1,48 @@
+<%--
+   Copyright 2006 The Apache Software Foundation.
+
+   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:$
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+    <head>
+        <title>Control Lifecycle Test 5</title>
+    </head>
+    <netui:body>
+        <h4>Control Lifecycle Test 5</h4>
+        <p style="color:green">This test verifies the life cycle of a shared flow containg a control.</p>
+        <br>
+        <netui:anchor action="sfFieldTest">access a shared flow field (and control)</netui:anchor>
+        <br>
+        <netui:anchor action="shared.sharedFlowAction">run an empty action</netui:anchor>
+        <br>
+        <netui:anchor action="runSharedFlow">execute a shared flow action</netui:anchor>
+        <br>
+        <netui:anchor action="removeSharedFlow">remove a shared flow</netui:anchor>
+        <br>
+        <netui:anchor action="navigateToCurrentPage">this page flow</netui:anchor>
+        <br>
+        <br>
+        Main Flow results:
+        <br>
+        <netui:span value="${pageInput.controlResults}"/>
+        <br>
+        <br>
+        Shared Flow results:
+        <br>
+        <netui:span value="${pageInput.sfControlResults}"/>
+    </netui:body>
+</netui:html>

Propchange: beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/sharedFlowPage.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/sharedFlowPage.jsp?rev=394774&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/sharedFlowPage.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/sharedFlowPage.jsp Mon Apr 17 13:45:19 2006
@@ -0,0 +1,41 @@
+<%--
+   Copyright 2006 The Apache Software Foundation.
+
+   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:$
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui" %>
+<netui:html>
+    <head>
+        <title>Control Lifecycle Test 5 - Shared Flow</title>
+    </head>
+    <body>
+        <h4>Control Lifecycle Test 5 - Shared Flow</h4>
+
+        <netui:anchor action="shared.sharedFlowAction">run an empty action</netui:anchor>
+        <br>
+        <netui:anchor action="shared.leaveAndRemove">leave and remove this shared flow</netui:anchor>
+        <br>
+        <br>
+        Main Flow results:
+        <br>
+        <netui:span value="${pageInput.controlResults}"/>
+        <br>
+        <br>
+        Shared Flow results:
+        <br>
+        <netui:span value="${pageInput.sfControlResults}"/>
+    </body>
+</netui:html>

Propchange: beehive/trunk/netui/test/webapps/drt/web/controls/sfLifecycle/sharedFlowPage.jsp
------------------------------------------------------------------------------
    svn:eol-style = native