beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eddie O'Neil" <ekon...@gmail.com>
Subject moving the controls tests to netui [was: svn commit: r421695]
Date Thu, 13 Jul 2006 20:04:45 GMT
Chad--

  Hey, I see that the controls tests are moving to NetUI -- that's a
useful step toward decouping NetUI and Controls.

  A thought about how they surface in NetUI, though -- would it be
additionally useful (and faster to test) to have a controls test web
application rather than continuing to grow the NetUI coreWeb tests?
This would be similar to how jsfWeb/ sits beside the drt/ directory.

  Just curious what you think about this.

Eddie



---------- Forwarded message ----------
From: cschoett@apache.org <cschoett@apache.org>
Date: Jul 13, 2006 1:53 PM
Subject: svn commit: r421695 [1/6] - in
/beehive/trunk/netui/test/webapps/drt: src/controls/binding/
src/controls/composition/ src/controls/context/
src/controls/contextevent/ src/controls/contextevent/beanrecord/
src/controls/contextevent/implrecord/ src/contr...
To: commits@beehive.apache.org


Author: cschoett
Date: Thu Jul 13 12:53:37 2006
New Revision: 421695

URL: http://svn.apache.org/viewvc?rev=421695&view=rev
Log:
Ported controls core tch jpf tests into the netui test recorder framework.

Added:
    beehive/trunk/netui/test/webapps/drt/src/controls/binding/
    beehive/trunk/netui/test/webapps/drt/src/controls/binding/ControlBindingController.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/composition/
    beehive/trunk/netui/test/webapps/drt/src/controls/composition/ControlCompositionController.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/context/
    beehive/trunk/netui/test/webapps/drt/src/controls/context/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/
    beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/beanrecord/
    beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/beanrecord/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/implrecord/
    beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/implrecord/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/event/
    beehive/trunk/netui/test/webapps/drt/src/controls/event/eventhandler/
    beehive/trunk/netui/test/webapps/drt/src/controls/event/eventhandler/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/event/listener/
    beehive/trunk/netui/test/webapps/drt/src/controls/event/listener/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/extension/
    beehive/trunk/netui/test/webapps/drt/src/controls/extension/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/instantiate/
    beehive/trunk/netui/test/webapps/drt/src/controls/instantiate/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/property/
    beehive/trunk/netui/test/webapps/drt/src/controls/property/client_access/
    beehive/trunk/netui/test/webapps/drt/src/controls/property/client_access/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/
    beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/
    beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/
    beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/
    beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/Controller.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/Nested.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetter.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetterImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorder.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorderImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/Recorder.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/RecorderImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/event/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/event/Event2Listener.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/event/Hello.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/event/HelloImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/event/SerializeUtils.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/extension/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/extension/ExtensibleControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/extension/ExtensibleControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/extension/SubControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/extension/SubControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/instantiate/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/instantiate/SingleProperty.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/instantiate/SinglePropertyImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/BoundExtPropertySet.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/BoundPropertyControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/BoundPropertyControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/PropertyConstraintControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/PropertyConstraintControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/PropertyControl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/property/PropertyControlImpl.java
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlComposition.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlContext.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlContextEvents.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlEvents.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlExtension.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlInstantiation.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlProperties.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ControlsBinding.xml
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/binding/
    beehive/trunk/netui/test/webapps/drt/web/controls/binding/index.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/composition/
    beehive/trunk/netui/test/webapps/drt/web/controls/composition/index.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/composition/result.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/context/
    beehive/trunk/netui/test/webapps/drt/web/controls/context/index.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/contextevent/
    beehive/trunk/netui/test/webapps/drt/web/controls/contextevent/index.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/event/
    beehive/trunk/netui/test/webapps/drt/web/controls/event/index.jsp
 (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/extension/
    beehive/trunk/netui/test/webapps/drt/web/controls/extension/index.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/extension/result.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/instantiate/
    beehive/trunk/netui/test/webapps/drt/web/controls/instantiate/index.jsp
  (with props)
    beehive/trunk/netui/test/webapps/drt/web/controls/property/
    beehive/trunk/netui/test/webapps/drt/web/controls/property/index.jsp
  (with props)
Modified:
    beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml

Added: beehive/trunk/netui/test/webapps/drt/src/controls/binding/ControlBindingController.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/binding/ControlBindingController.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/binding/ControlBindingController.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/binding/ControlBindingController.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,52 @@
+/*
+ * 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:$
+ */
+package controls.binding;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.properties.BaseProperties;
+import org.apache.beehive.netui.test.controls.binding.BindingTestControl;
+import org.apache.beehive.netui.test.controls.binding.DefaultBindingTestControl;
+import org.apache.beehive.netui.test.controls.binding.ExternalBindingTestControl;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+        forwards = {@Jpf.Forward(name = "index", path = "index.jsp")}
+)
+public class ControlBindingController
+    extends PageFlowController {
+
+    @Control
+    @BaseProperties(controlImplementation =
"org.apache.beehive.netui.test.controls.binding.BindingTestControlOverrideImpl")
+    public BindingTestControl btc;
+
+    @Control
+    public DefaultBindingTestControl dbtc;
+
+    @Control
+    public ExternalBindingTestControl ebtc;
+
+    @Jpf.Action
+    protected Forward begin() {
+        getRequest().setAttribute("BindingTestControlStatus", btc.getStatus());
+        getRequest().setAttribute("DefaultBindingTestControlStatus",
dbtc.getStatus());
+        getRequest().setAttribute("ExternalBindingTestControlStatus",
ebtc.getStatus());
+        return new Forward("index");
+    }
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/composition/ControlCompositionController.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/composition/ControlCompositionController.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/composition/ControlCompositionController.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/composition/ControlCompositionController.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,476 @@
+/*
+ * 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.composition;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.composition.InnerControl;
+import org.apache.beehive.netui.test.controls.composition.InnerControlBean;
+import org.apache.beehive.netui.test.controls.composition.OuterControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Test control composition by invoking methods on a control that has
nested controls
+ */
+@Jpf.Controller(
+        forwards = {
+        @Jpf.Forward(name = "result", path = "result.jsp")
+                })
+public class ControlCompositionController extends PageFlowController {
+
+    @Control
+    private OuterControlBean outercontrol;
+
+    @Jpf.Action()
+    protected Forward begin() {
+        return new Forward("index.jsp");
+    }
+
+    /**
+     * Verifies the instantiation of nested controls.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testInstantiation() {
+        InnerControlBean declaredNestedControl =
outercontrol.getDeclaredNestedControl();
+        if (declaredNestedControl == null) {
+            return new Forward("result", "message",
"testInstantiation.do: the nested control instantiated declaratively
is NULL.");
+        }
+
+        InnerControlBean programNestedControl =
outercontrol.instantiateNestedControlProgrammatically();
+        if (programNestedControl == null) {
+            return new Forward("result", "message",
"testInstantiation.do: The nested control instantiated
programmatically is NULL.");
+        }
+
+        return new Forward("result", "message",
"testInstantiation.do: PASSED");
+    }
+
+    /**
+     * Verifies the instantiation of nested controls.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testInstantiationP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testInstantiationP.do: Instantiation failed.");
+        }
+
+        InnerControlBean declaredNestedControl =
outerbean.getDeclaredNestedControl();
+        if (declaredNestedControl == null) {
+            return new Forward("result", "message",
+                               "testInstantiateP.do: the nested
control instantiated declaratively is NULL.");
+        }
+
+        InnerControlBean programNestedControl =
outerbean.instantiateNestedControlProgrammatically();
+        if (programNestedControl == null) {
+            return new Forward("result", "message",
+                               "testInstantiateP.do: The nested
control instantiated programmatically is NULL.");
+        }
+
+        return new Forward("result", "message", "testInstantiateP.do: PASSED");
+    }
+
+    /**
+     * Verifies the instantiation of nested control, if the property
of the nested control is
+     * is reconfigured when instantiated.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testInstantiationWithProperty() {
+        InnerControlBean declaredNestedControl =
outercontrol.getDeclaredNestedControl2();
+        if (declaredNestedControl == null) {
+            return new Forward("result", "message",
+                               "testInstantiationWithProperty.do: The
nested control instantiated declaratively is NULL");
+        }
+
+        InnerControlBean programNestedControl =
outercontrol.instantiateNestedControlWithProperty();
+        if (programNestedControl == null) {
+            return new Forward("result", "message",
"testInstantiationWithProperty.do: Missing API:Controls.
JIRA-BEEHIVE-113");
+        }
+        return new Forward("result", "message",
"testInstantiationWithProperty.do: PASSED");
+    }
+
+    /**
+     * Verifies the instantiation of nested control, if the property
of the nested control is
+     * is reconfigured when instantiated.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testInstantiationWithPropertyP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testInstantiationWithPropertyP.do: Instantiation failed.");
+        }
+
+        InnerControlBean declaredNestedControl =
outerbean.getDeclaredNestedControl2();
+        if (declaredNestedControl == null) {
+            return new Forward("result", "message",
+                               "testInstantiationWithPropertyP.do:
The nested control instantiated declaratively is NULL");
+        }
+
+        InnerControlBean programNestedControl =
outerbean.instantiateNestedControlWithProperty();
+        if (programNestedControl == null) {
+            return new Forward("result", "message",
"testInstantiationWithPropertyP.do: Missing API:Controls.
JIRA-BEEHIVE-113");
+        }
+        return new Forward("result", "message",
"testInstantiationWithPropertyP.do: PASSED");
+    }
+
+    /**
+     * Tests getting control property from the context of the nested control.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testGetPropertyByContext() {
+
+        InnerControlBean declaredNestedControl =
outercontrol.getDeclaredNestedControl();
+        String property_value = declaredNestedControl.getNameFromContext();
+
+        if (property_value == null || !property_value.equals("Bob")) {
+            return new Forward("result", "message",
+                               "testGetPropertyByContext.do: property
retrieved from context is:" + property_value);
+        }
+
+        InnerControlBean programNestedControl =
outercontrol.instantiateNestedControlProgrammatically();
+        String property_value2 = programNestedControl.getNameFromContext();
+
+        if (property_value2 == null || !property_value2.equals("Bob")) {
+            return new Forward("result", "message",
+                               "testGetPropertyByContext.do: property
retrieved from context is:" + property_value);
+        }
+
+        return new Forward("result", "message",
"testGetPropertyByContext.do: PASSED");
+    }
+
+    /**
+     * Tests getting control property from the context of the nested control.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testGetPropertyByContextP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetPropertyByContextP.do: Instantiation failed.");
+        }
+
+        InnerControlBean declaredNestedControl =
outerbean.getDeclaredNestedControl();
+        String property_value = declaredNestedControl.getNameFromContext();
+
+        if (property_value == null || !property_value.equals("Bob")) {
+            return new Forward("result", "message",
+                               "testGetPropertyByContextP.do:
property retrieved from context is:" + property_value);
+        }
+
+        InnerControlBean programNestedControl =
outerbean.instantiateNestedControlProgrammatically();
+        String property_value2 = programNestedControl.getNameFromContext();
+
+        if (property_value2 == null || !property_value2.equals("Bob")) {
+            return new Forward("result", "message",
+                               "testGetPropertyByContextP.do:
property retrieved from context is:" + property_value);
+        }
+
+        return new Forward("result", "message",
"testGetPropertyByContextP.do: PASSED");
+    }
+
+    /**
+     * Tests getting control property from getter method of the
nested control bean.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testGetPropertyByGetter() {
+
+        InnerControlBean innerbean = outercontrol.getDeclaredNestedControl();
+        String name = innerbean.getName();
+        String job = innerbean.getJob();
+
+        if (!name.equals(InnerControl.DEFAULT_NAME) || (job != null)) {
+            return new Forward("result", "message",
+                               "testGetPropertyByGetter.do: The
property from getter:name=" + name + "and job=" + job);
+        }
+
+        InnerControlBean innerbean2 = outercontrol.getDeclaredNestedControl2();
+        String name2 = innerbean2.getName();
+        String job2 = innerbean2.getJob();
+
+        if (job2 == null) {
+            return new Forward("result", "message",
+                               "testGetPropertyByGetter.do: The
property reset at declaration is NULL.");
+        }
+
+        if (!name.equals(InnerControl.DEFAULT_NAME) ||
!job2.equals("farmer")) {
+            return new Forward("result", "message",
+                               "The property from getter:name=" +
name2 + "and job=" + job2);
+        }
+        return new Forward("result", "message",
"testGetPropertyByGetter.do: PASSED");
+    }
+
+    /**
+     * Tests getting control property from getter method of the
nested control bean.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testGetPropertyByGetterP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetPropertyByGetterP.do: Instantiation failed.");
+        }
+
+        InnerControlBean innerbean = outerbean.getDeclaredNestedControl();
+        String name = innerbean.getName();
+        String job = innerbean.getJob();
+
+        if (!name.equals(InnerControl.DEFAULT_NAME) || (job != null)) {
+            return new Forward("result", "message",
+                               "testGetPropertyByGetterP.do: The
property from getter:name=" + name + "and job=" + job);
+        }
+
+        InnerControlBean innerbean2 = outerbean.getDeclaredNestedControl2();
+        String name2 = innerbean2.getName();
+        String job2 = innerbean2.getJob();
+
+        if (job2 == null) {
+            return new Forward("result", "message",
+                               "testGetPropertyByGetterP.do: The
property reset at declaration is NULL.");
+        }
+
+        if (!name.equals(InnerControl.DEFAULT_NAME) ||
!job2.equals("farmer")) {
+            return new Forward("result", "message",
+                               "testGetPropertyByGetterP.do: The
property from getter:name=" + name2 + "and job=" + job2);
+        }
+        return new Forward("result", "message",
"testGetPropertyByGetterP.do: PASSED");
+    }
+
+    /**
+     * Tests setting control property using setter method of the
nested control bean.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testSetPropertyBySetter() {
+
+        InnerControlBean innerbean = outercontrol.getDeclaredNestedControl();
+        innerbean.setName("A_NEW_NAME");
+        innerbean.setJob("A_NEW_JOB");
+
+        String name = innerbean.getNameFromContext();
+        String job = innerbean.getJobFromContext();
+
+        if (!name.equals("A_NEW_NAME") || !job.equals("A_NEW_JOB")) {
+            return new Forward("result", "message",
+                               "testSetPropertyBySetter.do: The
property from getter:name=" + name + "and job=" + job);
+        }
+        return new Forward("result", "message",
"testSetPropertyBySetter.do: PASSED");
+    }
+
+    /**
+     * Tests setting control property using setter method of the
nested control bean.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testSetPropertyBySetterP() {
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testSetPropertyBySetterP.do: Instantiation failed.");
+        }
+
+        InnerControlBean innerbean = outerbean.getDeclaredNestedControl();
+        innerbean.setName("A_NEW_NAME");
+        innerbean.setJob("A_NEW_JOB");
+
+        String name = innerbean.getNameFromContext();
+        String job = innerbean.getJobFromContext();
+
+        if (!name.equals("A_NEW_NAME") || !job.equals("A_NEW_JOB")) {
+            return new Forward("result", "message",
+                               "testSetPropertyBySetterP.do: The
property from getter:name=" + name + "and job=" + job);
+        }
+        return new Forward("result", "message",
"testSetPropertyBySetterP.do: PASSED");
+    }
+
+    /**
+     * Verifies outer control receiving events raised by the nested control.
+     * Outer control listens to the events by EventHandler.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testEventHandler() {
+        String wakeupResult = outercontrol.testActivityWakeup();
+        String readMessageResult = outercontrol.testActivityReadMessage();
+        String reportResult = outercontrol.testActivityReport();
+        String shoppingResult = outercontrol.testActionShopping();
+        String dostuffResult = outercontrol.testActionDostuff();
+
+        if (wakeupResult.equals("0") && readMessageResult.equals("0")
&& reportResult.equals("0")
+                && shoppingResult.equals("0") && dostuffResult.equals("0")) {
+            return new Forward("result", "message",
"testEventHandler.do: PASSED");
+        }
+
+        return new Forward("result", "message",
"testEventHandlerP.do: ActivityWakeup:" + wakeupResult +
+                ". ActivityReadMessage:" + readMessageResult +
+                ". ActivityReport:" + reportResult +
+                ". ActionShopping:" + shoppingResult +
+                ". ActionDodtuff:" + dostuffResult);
+    }
+
+    /**
+     * Verifies outer control receiving events raised by the nested control.
+     * Outer control listens to the events by EventHandler.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testEventHandlerP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testEventHandlerP.do: Instantiation failed.");
+        }
+        String wakeupResult = outerbean.testActivityWakeup();
+        String readMessageResult = outerbean.testActivityReadMessage();
+        String reportResult = outerbean.testActivityReport();
+        String shoppingResult = outerbean.testActionShopping();
+        String dostuffResult = outerbean.testActionDostuff();
+
+        if (wakeupResult.equals("0") && readMessageResult.equals("0")
&& reportResult.equals("0")
+                && shoppingResult.equals("0") && dostuffResult.equals("0")) {
+            return new Forward("result", "message",
"testEventHandlerP.do: PASSED");
+        }
+
+        return new Forward("result", "message",
"testEventHandlerP.do: ActivityWakeup:" + wakeupResult +
+                ". ActivityReadMessage:" + readMessageResult +
+                ". ActivityReport:" + reportResult +
+                ". ActionShopping:" + shoppingResult +
+                ". ActionDodtuff:" + dostuffResult);
+    }
+
+    /**
+     * Verifies outer control receiving events raised by the nested control.
+     * Outer control listens to the events by EventListener.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testEventListener() {
+
+        String eventListener = outercontrol.testEventListener();
+        if (!eventListener.equals("0")) {
+            return new Forward("result", "message",
"testEventListener.do: EventListener: " + eventListener);
+        }
+
+        return new Forward("result", "message",
"testEventListener.do: PASSED");
+    }
+
+    /**
+     * Verifies outer control receiving events raised by the nested control.
+     * Outer control listens to the events by EventListener.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testEventListenerP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testEventListenerP.do: Instantiation failed.");
+        }
+
+        String eventListener = outerbean.testEventListener();
+        if (!eventListener.equals("0")) {
+            return new Forward("result", "message",
"testEventListenerP.do: EventListener: " + eventListener);
+        }
+
+        return new Forward("result", "message",
"testEventListenerP.do: PASSED");
+    }
+
+    /**
+     * Verifies outer control receiving events raised by the nested control.
+     * Outer control listens to the events by an inner class listener.
+     * The outer control is instantiated declaratively.
+     */
+    @Jpf.Action()
+    protected Forward testInnerClassListener() {
+
+        String innerClassListener = outercontrol.testInnerClassListener();
+        if (!innerClassListener.equals("0")) {
+            return new Forward("result", "message",
"testInnerClassListener.do: InnerClassListener: " +
innerClassListener);
+        }
+        return new Forward("result", "message",
"testInnerClassListener.do: PASSED");
+    }
+
+    /**
+     * Verifies outer control receiving events raised by the nested control.
+     * Outer control listens to the events by an inner class listener.
+     * The outer control is instantiated programmatically.
+     */
+    @Jpf.Action()
+    protected Forward testInnerClassListenerP() {
+
+        OuterControlBean outerbean = null;
+        try {
+            outerbean = (OuterControlBean) java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.composition.OuterControlBean");
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testInnerClassListenerP.do: Instantiation failed.");
+        }
+
+        String innerClassListener = outerbean.testInnerClassListener();
+        if (!innerClassListener.equals("0")) {
+            return new Forward("result", "message",
"testInnerClassListener.do: InnerClassListener: " +
innerClassListener);
+        }
+        return new Forward("result", "message",
"testInnerClassListener.do: PASSED");
+    }
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/context/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/context/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/context/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/context/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,193 @@
+/*
+ * 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.context;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.context.ServiceGetterBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowControlContainer;
+import org.apache.beehive.netui.pageflow.PageFlowControlContainerFactory;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import javax.servlet.ServletRequestWrapper;
+import javax.servlet.ServletResponseWrapper;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * Test getting other services avaliable to control context
+ * The control is instantiated declaratively
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "index.jsp")})
+public class Controller extends PageFlowController {
+
+    @Control
+    public ServiceGetterBean _serviceGetter;
+
+    @Jpf.Action()
+    protected Forward begin() {
+        return new Forward("index");
+    }
+
+    @Jpf.Action()
+    protected Forward testServices() {
+        try {
+            if (!checkBeanContextService(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: BeanContextService unavailable.");
+            }
+
+            if (!checkControlBeanContext(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: ControlBeanContext unavailable.");
+            }
+
+            if (!checkResourceContext(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: ResourceContext unavailable.");
+            }
+
+            if (!checkServletContext(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: ServletContext unavailable.");
+            }
+
+            if (!checkServletRequest(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: ServletRequest unavailable.");
+            }
+
+            if (!checkServletResponse(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: ServletResponse unavailable.");
+            }
+
+            if (!checkHttpServletRequest(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: HttpServletRequest unavailable.");
+            }
+
+            if (!checkHttpServletResponse(_serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServices.do: HttpServletResponse unavailable.");
+            }
+
+        }
+        catch (ClassNotFoundException e) {
+            return new Forward("index", "message", "ERROR: " + e.getMessage());
+        }
+        return new Forward("index", "message", "PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testServicesP() {
+        try {
+
+            PageFlowControlContainer pfcc =
PageFlowControlContainerFactory.getControlContainer(getRequest(),
getServletContext());
+            pfcc.createAndBeginControlBeanContext(this, getRequest(),
getResponse(), getServletContext());
+
+            ServiceGetterBean serviceGetter = (ServiceGetterBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.context.ServiceGetterBean");
+
+            if (!checkBeanContextService(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: BeanContextService unavailable.");
+            }
+
+            if (!checkControlBeanContext(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: ControlBeanContext unavailable.");
+            }
+
+            if (!checkResourceContext(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: ResourceContext unavailable.");
+            }
+
+            if (!checkServletContext(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: ServletContext unavailable.");
+            }
+
+            if (!checkServletRequest(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: ServletRequest unavailable.");
+            }
+
+            if (!checkServletResponse(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: ServletResponse unavailable.");
+            }
+
+            if (!checkHttpServletRequest(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: HttpServletRequest unavailable.");
+            }
+
+            if (!checkHttpServletResponse(serviceGetter)) {
+                return new Forward("index", "message", "ERROR:
testServicesP.do: HttpServletResponse unavailable.");
+            }
+
+        }
+        catch (Exception e) {
+            return new Forward("index", "message", "ERROR: " + e.getMessage());
+        }
+        return new Forward("index", "message", "PASSED");
+    }
+
+
+    private boolean checkBeanContextService(ServiceGetterBean ctrl) {
+        return ctrl.getBeanContext() != null;
+    }
+
+    private boolean checkControlBeanContext(ServiceGetterBean ctrl) {
+        return ctrl.getControlBeanContext() != null;
+    }
+
+    private boolean checkResourceContext(ServiceGetterBean ctrl)
throws ClassNotFoundException {
+        return
ctrl.getService(Class.forName("org.apache.beehive.controls.api.context.ResourceContext"),
null) != null;
+    }
+
+    private boolean checkServletContext(ServiceGetterBean ctrl)
throws ClassNotFoundException {
+        return
ctrl.getService(Class.forName("javax.servlet.ServletContext"), null)
!= null;
+    }
+
+    private boolean checkServletRequest(ServiceGetterBean ctrl)
throws ClassNotFoundException {
+        boolean result = false;
+        Object servletrequest =
ctrl.getService(Class.forName("javax.servlet.ServletRequest"), null);
+        if ((servletrequest != null) && (servletrequest instanceof
ServletRequestWrapper))
+            result = true;
+
+        return result;
+    }
+
+    private boolean checkServletResponse(ServiceGetterBean ctrl)
throws ClassNotFoundException {
+        boolean result = false;
+        Object servletresponse =
ctrl.getService(Class.forName("javax.servlet.ServletResponse"), null);
+        if ((servletresponse != null) && (servletresponse instanceof
ServletResponseWrapper))
+            result = true;
+
+        return result;
+    }
+
+    private boolean checkHttpServletRequest(ServiceGetterBean ctrl)
throws ClassNotFoundException {
+        boolean result = false;
+        Object httpservletrequest =
ctrl.getService(Class.forName("javax.servlet.http.HttpServletRequest"),
null);
+        if ((httpservletrequest != null) && (httpservletrequest
instanceof HttpServletRequestWrapper))
+            result = true;
+
+        return result;
+    }
+
+    private boolean checkHttpServletResponse(ServiceGetterBean ctrl)
throws ClassNotFoundException {
+        boolean result = false;
+        Object httpservletresponse =
ctrl.getService(Class.forName("javax.servlet.http.HttpServletResponse"),
null);
+        if ((httpservletresponse != null) && (httpservletresponse
instanceof HttpServletResponseWrapper))
+            result = true;
+
+        return result;
+    }
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/beanrecord/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/beanrecord/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/beanrecord/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/beanrecord/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,93 @@
+/*
+ * 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.contextevent.beanrecord;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.ResourceContext;
+import org.apache.beehive.netui.test.controls.contextevent.RecorderBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import java.beans.PropertyChangeEvent;
+
+/**
+ * Test linstening to control life cycle events by adding listeners
to control bean class.
+ * The control is instantiated declaratively
+ */
+@Jpf.Controller(
+        forwards = {
+        @Jpf.Forward(name = "index", path = "../index.jsp")
+                })
+public class Controller extends PageFlowController {
+
+    @Control
+    public RecorderBean _recorder;
+
+    private boolean _onCreateReceived = false;
+    private boolean _onAcquireReceived = false;
+    private boolean _onReleaseReceived = false;
+
+    @Jpf.Action()
+    protected Forward begin() {
+
+        ControlBeanContext beanContext = _recorder.getControlBeanContext();
+        beanContext.addLifeCycleListener(new ControlBeanContext.LifeCycle() {
+            public void onCreate() {
+                _onCreateReceived = true;
+            }
+
+            public void onPropertyChange(PropertyChangeEvent pce) {
+            }
+
+            public void onVetoableChange(PropertyChangeEvent pce) {
+            }
+        });
+
+        try {
+            ResourceContext resourceContext =
beanContext.getService(ResourceContext.class, null);
+            resourceContext.addResourceEventsListener(new
ResourceContext.ResourceEvents() {
+                public void onAcquire() {
+                    _onAcquireReceived = true;
+                }
+
+                public void onRelease() {
+                    _onReleaseReceived = true;
+                }
+            });
+
+            String s = _recorder.getRecord();
+        }
+        catch (Exception e) {
+            return new Forward("index", "message", e.getMessage());
+        }
+
+        try {
+            Thread.sleep(500);
+            if (!_onAcquireReceived) {
+                return new Forward("index", "message", "The onAcquire
ResourceContext event was not received.");
+            }
+        }
+        catch (Exception e) {
+            return new Forward("index", "message", e.getMessage());
+        }
+        return new Forward("index", "message", "PASSED");
+    }
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/implrecord/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/implrecord/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/implrecord/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/contextevent/implrecord/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,75 @@
+/*
+ * 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.contextevent.implrecord;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.contextevent.RecorderBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowControlContainer;
+import org.apache.beehive.netui.pageflow.PageFlowControlContainerFactory;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Test linstening to control life cycle events by EventHandler on
control implementation class.
+ * The control is instantiated declaratively
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path =
"../index.jsp")})
+public  class Controller extends PageFlowController {
+
+    @Control
+    public RecorderBean _recorder;
+
+    @Jpf.Action()
+    protected Forward begin() {
+        return new Forward("index");
+    }
+
+    @Jpf.Action()
+    protected Forward testContextEvents() {
+
+        String record = _recorder.getRecord();
+        if (!record.equals("initonCreateonAcquire")) {
+            return new Forward("index", "message", "The events
recorded by control impl:" + record);
+        }
+        return new Forward("index", "message", "PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testContextEventsP() {
+
+        try {
+            PageFlowControlContainer pfcc =
PageFlowControlContainerFactory.getControlContainer(getRequest(),
getServletContext());
+            pfcc.createAndBeginControlBeanContext(this, getRequest(),
getResponse(), getServletContext());
+
+            RecorderBean recorder = (RecorderBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.contextevent.RecorderBean");
+
+            String record = recorder.getRecord();
+            if (!record.equals("initonCreateonAcquire")) {
+                return new Forward("index", "message", "The events
recorded by control impl:" + record);
+            }
+        }
+        catch (Exception e) {
+            // fail
+        }
+        return new Forward("index", "message", "PASSED");
+    }
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/event/eventhandler/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/event/eventhandler/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/event/eventhandler/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/event/eventhandler/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,96 @@
+/*
+ * 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.event.eventhandler;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.events.EventHandler;
+import org.apache.beehive.netui.test.controls.event.HelloBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Test receiving events raised by a control using EventHandler annotations
+ * The control is instantiated declaratively
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path =
"../index.jsp")})
+public class Controller extends PageFlowController {
+
+    @Control
+    public HelloBean myHelloBean;
+
+    private boolean eventSet1Received = false;
+    private boolean eventSet2Received = false;
+
+//    /**
+//     * EventHandler that receives EventSet1 from myHelloBean
+//     */
+//    @EventHandler(field = "myHelloBean", eventSet =
HelloBean.EventSet1.class, eventName = "method1")
+//    public void myHelloBeanMessageHandler() {
+//        eventSet1Received = true;
+//    }
+
+    /**
+     * EventHandler that receives EventSet2 from myHelloBean
+     */
+    @EventHandler(field = "myHelloBean", eventSet =
org.apache.beehive.netui.test.controls.event.HelloBean.EventSet2.class,
eventName = "set2Method2")
+    public int myHelloBeanMessageHandler2() {
+        eventSet2Received = true;
+        return 0;
+    }
+
+    @Jpf.Action
+    protected Forward begin() {
+
+//        // Invoke method on myHelloBean to trigger the events
+//        try {
+//            myHelloBean.triggerEvents();
+//            if (!eventSet1Received || !eventSet2Received) {
+//                String detail = "";
+//                if (!eventSet1Received) {
+//                    detail = "EventSet1 is not received.";
+//                }
+//                if (!eventSet2Received) {
+//                    detail = detail + "EventSet2 is not received.";
+//                }
+//                return new Forward("index", "message", "Error: " + detail);
+//            }
+//        }
+//        catch (Exception e) {
+//            return new Forward("index", "message", "Error: " +
e.getMessage());
+//        }
+        return new Forward("index", "message", "PASSED");
+    }
+
+    @Jpf.Action
+    protected Forward verifyResult() {
+//        if (!eventSet1Received || !eventSet2Received) {
+//            String detail = "";
+//            if (!eventSet1Received) {
+//                detail = "EventSet1 is not received.";
+//            }
+//            if (!eventSet2Received) {
+//                detail = detail + "EventSet2 is not received.";
+//            }
+//            return new Forward("index", "message", "Error: " + detail);
+//        }
+        return new Forward("index", "message", "PASSED");
+    }
+
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/event/listener/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/event/listener/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/event/listener/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/event/listener/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,81 @@
+/*
+ * 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.event.listener;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.event.Event2Listener;
+import org.apache.beehive.netui.test.controls.event.Hello;
+import org.apache.beehive.netui.test.controls.event.HelloBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Test receiving events raised by a control using a registered listener
+ * The control is instantiated declaratively
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path =
"../index.jsp")})
+public class Controller extends PageFlowController {
+
+    @Control
+    public HelloBean hello;
+
+    private boolean innerClassReceiveEvent = false;
+    private Event2Listener event2listener;
+
+    @Jpf.Action()
+    protected Forward begin() {
+
+        try {
+            // Register an inner class as listener for event1
+            hello.addEventSet1Listener(
+                    new Hello.EventSet1() {
+                        public void method1() {
+                            innerClassReceiveEvent = true;
+                        }
+                    });
+
+            /* Creates a listener for event2 and register it*/
+            event2listener = new Event2Listener();
+            hello.addEventSet2Listener(event2listener);
+
+            /* Invokes methods on myHelloBean to trigger the events*/
+            hello.triggerEvents();
+            Thread.sleep(1000);
+        }
+        catch (Exception e) {
+            return new Forward("index", "message", "Error: " + e.getMessage());
+        }
+
+        if (!innerClassReceiveEvent) {
+            return new Forward("index", "message", "Error: Innner
Class didn't receive event.");
+        }
+
+        if (event2listener == null) {
+            return new Forward("index", "message", "Error:
Event2Listerner is NULL");
+        }
+
+        String listenerResult = event2listener.getAllResult();
+        if (!listenerResult.equals("0000")) {
+            return new Forward("index", "message", "Error: Listener
Result:" + listenerResult);
+        }
+
+        return new Forward("index", "message", "PASSED");
+    }
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/extension/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/extension/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/extension/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/extension/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,435 @@
+/*
+ * 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.extension;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.events.EventHandler;
+import org.apache.beehive.netui.test.controls.extension.ExtensibleControl;
+import org.apache.beehive.netui.test.controls.extension.SubControl;
+import org.apache.beehive.netui.test.controls.extension.SubControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Test control inheritance by invoking methods on a sub control instance
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "result", path =
"result.jsp")})
+public class Controller extends PageFlowController {
+
+    private boolean superClassEventReceived = false;
+    private boolean subClassEventReceived = false;
+
+    @Control
+    public SubControlBean _subcontrol;
+
+    /**
+     * EventHandler that receives SuperClassEvent from _subcontrol
+     */
+    @EventHandler(field = "_subcontrol", eventSet =
SubControl.SuperClassEvent.class, eventName = "method1")
+    public void subcontrolMessageHandler() {
+        superClassEventReceived = true;
+    }
+
+    /**
+     * EventHandler that receives SubClassEvent from _subcontrol
+     */
+    @EventHandler(field = "_subcontrol", eventSet =
SubControl.SubClassEvent.class, eventName = "method1")
+    public void subcontrolMessageHandler2() {
+        subClassEventReceived = true;
+    }
+
+    @Jpf.Action
+    protected Forward begin() {
+        return new Forward("result");
+    }
+
+    /**
+     * Invokes an inherited method on a _subcontrol instantiated declaratively
+     */
+    @Jpf.Action()
+    protected Forward testInheritedMethod() {
+        String s = _subcontrol.hello();
+        if (!s.equals("Hello from super control")) {
+            return new Forward("result", "message",
"testInheritedMethod.do: ERROR: " + s);
+        }
+        return new Forward("result", "message", "testInheritedMethod: PASSED");
+    }
+
+    /**
+     * Invokes an inherited method on a _subcontrol instantiated
programmatically
+     */
+    @Jpf.Action()
+    protected Forward testInheritedMethodP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            String s = subbean.hello();
+            if (!s.equals("Hello from super control")) {
+                return new Forward("result", "message",
"testInheritedMethodP.do: ERROR: " + s);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testInheritedMethodP: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testInheritedMethodP: PASSED");
+    }
+
+    /**
+     * Invokes an extended method on a _subcontrol instantiated declaratively
+     */
+    @Jpf.Action()
+    protected Forward testExtendedMethod() {
+        String s = _subcontrol.hello2();
+        if (s == null || !s.equals("Hello from _subcontrol")) {
+            return new Forward("result", "message",
"testExtendedMethod.do: ERROR: " + s);
+        }
+        return new Forward("result", "message", "testExtendedMethod: PASSED");
+    }
+
+    /**
+     * Invokes an extended method on a _subcontrol instantiated
programmatically
+     */
+    @Jpf.Action()
+    protected Forward testExtendedMethodP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            String s = subbean.hello2();
+            if (s == null || !s.equals("Hello from _subcontrol")) {
+                return new Forward("result", "message",
"testExtendedMethodP.do: ERROR: " + s);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testExtendedMethodP: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message", "testExtendedMethodP: PASSED");
+    }
+
+
+    @Jpf.Action()
+    protected Forward testGetInheritedPropertyByContext() {
+        String s = _subcontrol.accessInheritedProperty();
+        if (s == null || !s.equals("In_ExtensibleControl_Interface")) {
+            return new Forward("result", "message",
"testGetInheritedPropertyByContext.do: ERROR: " + s);
+        }
+        return new Forward("result", "message",
"testGetInheritedPropertyByContext.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetInheritedPropertyByContextP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            String s = subbean.accessInheritedProperty();
+            if (s == null || !s.equals("In_ExtensibleControl_Interface")) {
+                return new Forward("result", "message",
"testGetInheritedPropertyByContextP.do: ERROR: " + s);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetInheritedPropertyByContext.do: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testGetInheritedPropertyByContext.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetInheritedPropertyByGetter() {
+
+        String position = _subcontrol.getPosition();
+        if (position == null ||
!position.equals(ExtensibleControl.CURRENT_POSITION)) {
+            return new Forward("result", "message",
"testGetInheritedPropertyByGetter.do: ERROR: The property from
getter:Position=" + position);
+        }
+        return new Forward("result", "message",
"testGetInheritedPropertyByGetter.do: PASSED");
+    }
+
+
+    @Jpf.Action()
+    protected Forward testGetInheritedPropertyByGetterP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+            String position = subbean.getPosition();
+            if (position == null ||
!position.equals(ExtensibleControl.CURRENT_POSITION)) {
+                return new Forward("result", "message",
"testGetInheritedPropertyByGetterP.do: ERROR: The property from
getter:Position=" + position);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetInheritedPropertyByGetter.do: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testGetInheritedPropertyByGetter.do: PASSED");
+    }
+
+
+    @Jpf.Action()
+    protected Forward testSetInheritedPropertyBySetter() {
+        _subcontrol.setPosition("A_NEW_POSITION");
+        _subcontrol.setLayer("A_NEW_LAYER");
+
+        String position = _subcontrol.accessInheritedProperty();
+        if (position == null || !position.equals("A_NEW_POSITION")) {
+            return new Forward("result", "message",
"testSetInheritedPropertyBySetter.do: ERROR: The property from
setter:Position=" + position);
+        }
+        return new Forward("result", "message",
"testSetInheritedPropertyBySetter.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testSetInheritedPropertyBySetterP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            subbean.setPosition("A_NEW_POSITION");
+            subbean.setLayer("A_NEW_LAYER");
+            String position = subbean.accessInheritedProperty();
+            if (position == null || !position.equals("A_NEW_POSITION")) {
+                return new Forward("result", "message",
"testSetInheritedPropertyBySetterP.do: ERROR: The property from
setter:Position=" + position);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testSetInheritedPropertyBySetterP.do: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testSetInheritedPropertyBySetterP.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetExtendedPropertyByContext() {
+
+        String new_property_value = _subcontrol.getExtendedPropertyByContext();
+        if (new_property_value == null ||
!new_property_value.equals("New Property Declared by Sub Control")) {
+            return new Forward("result", "message",
"testGetExtendedPropertyByContext.do: ERROR: Extended property
retrieved from context:" + new_property_value);
+        }
+        return new Forward("result", "message",
"testGetExtendedPropertyByContext.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetExtendedPropertyByContextP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            String new_property_value = subbean.getExtendedPropertyByContext();
+            if (new_property_value == null ||
!new_property_value.equals("New Property Declared by Sub Control")) {
+                return new Forward("result", "message",
"testGetExtendedPropertyByContextP.do: ERROR: Extended property
retrieved from context:" + new_property_value);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetExtendedPropertyByContextP.do: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testGetExtendedPropertyByContextP.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetExtendedPropertyByGetter() {
+        String s = _subcontrol.getMessage();
+        if (s == null || !s.equals(SubControl.A_MESSAGE)) {
+            return new Forward("result", "message",
"testGetExtendedPropertyByGetter.do: ERROR: " + s);
+        }
+        return new Forward("result", "message",
"testGetExtendedPropertyByGetter.do: PASSED");
+    }
+
+
+    @Jpf.Action()
+    protected Forward testGetExtendedPropertyByGetterP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+            String s = subbean.getMessage();
+            if (s == null || !s.equals(SubControl.A_MESSAGE)) {
+                return new Forward("result", "message",
"testGetExtendedPropertyByGetterP.do: ERROR: " + s);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetExtendedPropertyByGetterP.do: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testGetExtendedPropertyByGetter.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testSetExtendedPropertyBySetter() {
+        _subcontrol.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+        String the_new_value = _subcontrol.getExtendedPropertyByContext();
+        if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+            return new Forward("result", "message",
"testSetExtendedPropertyBySetter.do: ERROR: The result value: " +
the_new_value);
+        }
+        return new Forward("result", "message",
"testSetExtendedPropertyBySetter.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testSetExtendedPropertyBySetterP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            subbean.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+            String the_new_value = subbean.getExtendedPropertyByContext();
+            if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+                return new Forward("result", "message",
"testSetExtendedPropertyBySetter.do: ERROR: The result value: " +
the_new_value);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testSetExtendedPropertyBySetterP.do: Exception: " + e.getMessage());
+        }
+        return new Forward("result", "message",
"testSetExtendedPropertyBySetterP.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetReconfiguredPropertyByContext() {
+        _subcontrol.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+        String the_new_value = _subcontrol.getExtendedPropertyByContext();
+        if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+            return new Forward("result", "message",
"testGetReconfiguredPropertyByContext.do: ERROR: The result value: " +
the_new_value);
+        }
+        return new Forward("result", "message",
"testGetReconfiguredPropertyByContext.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetReconfiguredPropertyByContextP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+            subbean.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+            String the_new_value = subbean.getExtendedPropertyByContext();
+            if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+                return new Forward("result", "message",
"testGetReconfiguredPropertyByContextP.do: ERROR: The result value: "
+ the_new_value);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetReconfiguredPropertyByContextP.do: Exception: " +
e.getMessage());
+        }
+        return new Forward("result", "message",
"testGetReconfiguredPropertyByContext.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetReconfiguredPropertyByGetter() {
+        String layer = _subcontrol.getLayer();
+        if (!layer.equals("On_SubControl_Interface_Layer")) {
+            return new Forward("result", "message",
"testGetReconfiguredPropertyByGetter.do: ERROR: The property from
getter:layer=" + layer);
+        }
+        return new Forward("result", "message",
"testGetReconfiguredPropertyByGetter.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testGetReconfiguredPropertyByGetterP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+            String layer = subbean.getLayer();
+            if (!layer.equals("On_SubControl_Interface_Layer")) {
+                return new Forward("result", "message",
"testGetReconfiguredPropertyByGetterP.do: ERROR: The property from
getter:layer=" + layer);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testGetReconfiguredPropertyByGetterP.do: Exception: " +
e.getMessage());
+        }
+        return new Forward("result", "message",
"testGetReconfiguredPropertyByGetterP.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testSetReconfiguredPropertyBySetter() {
+        _subcontrol.setLayer("NEW_VALUE_FOR_LAYER");
+        try {
+            String the_layer = _subcontrol.getLayerByContext();
+            if (!the_layer.equals("NEW_VALUE_FOR_LAYER")) {
+                return new Forward("result", "message",
"testSetReconfiguredPropertyBySetter.do: ERROR: " + the_layer);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testSetReconfiguredPropertyBySetter.do: Exception: " +
e.getMessage());
+        }
+        return new Forward("result", "message",
"testSetReconfiguredPropertyBySetter.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testSetReconfiguredPropertyBySetterP() {
+
+        try {
+            SubControlBean subbean = (SubControlBean)
java.beans.Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.extension.SubControlBean");
+            subbean.setLayer("NEW_VALUE_FOR_LAYER");
+
+            String the_layer = _subcontrol.getLayerByContext();
+            if (!the_layer.equals("NEW_VALUE_FOR_LAYER")) {
+                return new Forward("result", "message",
"testSetReconfiguredPropertyBySetterP.do: ERROR: " + the_layer);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("result", "message",
"testSetReconfiguredPropertyBySetterP.do: Exception: " +
e.getMessage());
+        }
+        return new Forward("result", "message",
"testSetReconfiguredPropertyBySetter.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testInvokeExtendedEvent() {
+
+        int result = _subcontrol.invokeExtendedEventFromSubControl();
+        try {
+            Thread.sleep(500);
+        }
+        catch (InterruptedException e) {
+            // noop
+        }
+
+        if (result != 0) {
+            return new Forward("result", "message",
"testInvokeExtendedEvent.do: ERROR: The event on subcontrol was not
triggered.");
+        }
+        if (!subClassEventReceived) {
+            return new Forward("result", "message",
"testInvokeExtendedEvent.do: ERROR: The extended event is NOT
received.");
+        }
+        return new Forward("result", "message",
"testInvokeExtendedEvent.do: PASSED");
+    }
+
+    @Jpf.Action()
+    protected Forward testInvokeInheritedEvent() {
+
+        int result = _subcontrol.invokeInheritedEventFromSubControl();
+        if (result != 0) {
+            return new Forward("result", "message",
"testInvokeInheritedEvent.do: ERROR: The event on subcontrol was not
triggered.");
+        }
+        if (!superClassEventReceived) {
+            return new Forward("result", "message",
"testInvokeExtendedEvent.do: ERROR: The inherited event is NOT
received.");
+        }
+        return new Forward("result", "message",
"testInvokeInheritedEvent.do: PASSED");
+    }
+
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/instantiate/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/instantiate/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/instantiate/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/instantiate/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,74 @@
+/*
+ * 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.instantiate;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.bean.Controls;
+import org.apache.beehive.controls.api.properties.BeanPropertyMap;
+import org.apache.beehive.netui.test.controls.instantiate.SingleProperty;
+import org.apache.beehive.netui.test.controls.instantiate.SinglePropertyBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Instantiate a custom control declaratively with property
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "index.jsp")})
+public class Controller extends PageFlowController {
+
+    private static String EXPECTED_GREETING = "Good evening!";
+
+    @Control
+    @SingleProperty.Greeting(GreetWord = "Good evening!")
+    public SinglePropertyBean myPropertyBean;
+
+    @Jpf.Action
+    protected Forward begin() {
+        return new Forward("index");
+    }
+
+    @Jpf.Action
+    protected Forward instantiate() {
+        if (myPropertyBean == null ||
!myPropertyBean.sayHello().equals(EXPECTED_GREETING)) {
+            return new Forward("index", "message", "instantiate:
ERROR: control was null or invalid message.");
+        }
+        return new Forward("index", "message", "instantiate: PASSED");
+    }
+
+    @Jpf.Action
+    protected Forward instantiateP() {
+        try {
+            BeanPropertyMap greetAttr = new
BeanPropertyMap(SingleProperty.Greeting.class);
+            greetAttr.setProperty(SinglePropertyBean.GreetWordKey,
"Good afternoon!");
+            SinglePropertyBean spbean = (SinglePropertyBean)
Controls.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.instantiate.SinglePropertyBean",
greetAttr);
+
+            if (!"Good afternoon!".equals(spbean.sayHello())) {
+                return new Forward("index", "message", "instantiateP:
ERROR: invalid message: " + spbean.sayHello());
+            }
+        }
+        catch (Exception e) {
+            return new Forward("index", "message", "instantiateP:
ERROR: " + e.getMessage());
+        }
+        return new Forward("index", "message", "instantiateP: PASSED");
+    }
+
+}

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

Added: beehive/trunk/netui/test/webapps/drt/src/controls/property/client_access/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/property/client_access/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/property/client_access/Controller.java
(added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/property/client_access/Controller.java
Thu Jul 13 12:53:37 2006
@@ -0,0 +1,77 @@
+/*
+ * 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.property.client_access;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.property.PropertyControl;
+import org.apache.beehive.netui.test.controls.property.PropertyControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import java.beans.Beans;
+
+/**
+ * Tests client getting control property via getter/setter on control bean
+ * The control bean is instantiated declaratively
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path =
"../index.jsp")})
+public class Controller extends PageFlowController {
+
+    @Control
+    private PropertyControlBean _myControl;
+
+    @Jpf.Action
+    protected Forward begin() {
+        return new Forward("index");
+    }
+
+    @Jpf.Action
+    protected Forward clientAccess() {
+        String attribute1 = _myControl.getAttribute1();
+        String attribute3 = _myControl.getPropertyTwoAttribute3();
+
+        if (!attribute1.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE1)
+                ||
!attribute3.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE3)) {
+            return new Forward("index", "message", "clientAccess.do:
ERROR: Attribute1:" + attribute1 + ". Attribute3" + attribute3);
+        }
+        return new Forward("index", "message", "clientAccess.do: PASSED");
+    }
+
+    @Jpf.Action
+    protected Forward clientAccessP() {
+        try {
+            PropertyControlBean thebean = (PropertyControlBean)
Beans.instantiate(
+                    Thread.currentThread().getContextClassLoader(),
+
"org.apache.beehive.netui.test.controls.property.PropertyControlBean");
+
+            String attribute1 = thebean.getAttribute1();
+            String attribute3 = thebean.getPropertyTwoAttribute3();
+
+            if (!attribute1.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE1)
+                    ||
!attribute3.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE3)) {
+                return new Forward("index", "message",
"clientAccessP.do: ERROR: Attribute1:" + attribute1 + ". Attribute3" +
attribute3);
+            }
+        }
+        catch (Exception e) {
+            return new Forward("index", "message", "clientAccessP.do:
ERROR: " + e.getMessage());
+        }
+        return new Forward("index", "message", "clientAccessP.do: PASSED");
+    }
+}

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

Mime
View raw message