You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by js...@apache.org on 2004/09/16 04:51:34 UTC
svn commit: rev 46152 - in incubator/beehive/trunk/controls/test: src/controls/org/apache/beehive/controls/test/controls/composition src/controls/org/apache/beehive/controls/test/controls/context src/controls/org/apache/beehive/controls/test/controls/contextevent src/controls/org/apache/beehive/controls/test/controls/event src/controls/org/apache/beehive/controls/test/controls/extension src/controls/org/apache/beehive/controls/test/controls/instantiate src/controls/org/apache/beehive/controls/test/controls/property src/units/org/apache/beehive/controls/test/java/composition src/units/org/apache/beehive/controls/test/java/extension src/units/org/apache/beehive/controls/test/jpf/composition src/units/org/apache/beehive/controls/test/jpf/extension webapps/controlsWeb/composition webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/contextevent webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/event webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/instantiate webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/property webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/composition webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property
Author: jsong
Date: Wed Sep 15 19:51:33 2004
New Revision: 46152
Added:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/composition/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/composition/Controller.jpf (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControl.java (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControlEventListener.java (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/OuterControlImpl.jcs (contents, props changed)
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/composition/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/composition/DriveOuterControl.java (contents, props changed)
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/composition/ProgrammaticTest.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/DriveServiceGetter.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveBeanRecorder.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event/DriveListener.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveSingleProperty.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientAccess.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java
Log:
Add test on control composition on servlet container.
Improve java doc for controls tests.
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs Wed Sep 15 19:51:33 2004
@@ -7,6 +7,10 @@
import org.apache.beehive.controls.api.context.Context;
import org.apache.beehive.controls.api.context.ControlBeanContext;
+/*
+ * A control impl to test control composition.
+ * This control shall be instantiated by another control.
+ */
@ControlImplementation
public class InnerControlImpl implements InnerControl
{
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java Wed Sep 15 19:51:33 2004
@@ -5,7 +5,6 @@
import org.apache.beehive.controls.test.controls.composition.InnerControlBean;
-
/**
* A control interface designed to test control composition
*/
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java Wed Sep 15 19:51:33 2004
@@ -4,7 +4,7 @@
import org.apache.beehive.controls.api.bean.ControlInterface;
/**
- * A simple control that retrieve specific service
+ * A control interface to test control context service
*/
@ControlInterface
public interface ServiceGetter
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs Wed Sep 15 19:51:33 2004
@@ -9,7 +9,7 @@
import org.apache.beehive.controls.api.context.ControlBeanContext;
/**
- * A impl that retrieves specific service via controlContext
+ * A control impl that retrieves specific service via controlContext
*/
@ControlImplementation
public class ServiceGetterImpl implements ServiceGetter
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java Wed Sep 15 19:51:33 2004
@@ -3,7 +3,7 @@
import org.apache.beehive.controls.api.bean.ControlInterface;
/**
- * A simple control that records its lifecycle events in its impl
+ * A control interface to test control context event
*/
@ControlInterface
public interface Recorder
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs Wed Sep 15 19:51:33 2004
@@ -4,7 +4,7 @@
import org.apache.beehive.controls.api.events.Client;
/**
- * A control implementation that raises events while executing its method
+ * A control implementation that raises events when its method is invoked
*/
@ControlImplementation
public class HelloImpl implements Hello
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java Wed Sep 15 19:51:33 2004
@@ -10,8 +10,6 @@
* A sub control extending ExtensibleControl.
* This control declares one new method and one new propertySet.
* It also resets the value of the propertySet inherited from ExtensibleControl.
- *
- * It will access another property inherited from ExtensibleControl in its impl.
*/
@ControlInterface
@ExtensibleControl.WhereAbout(Layer="On_SubControl_Interface_Layer")
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs Wed Sep 15 19:51:33 2004
@@ -6,7 +6,8 @@
/**
* A control impl of a SubControl and extending ExtensibleControlImpl.
- * It access the propertySet inherited from ExtensibleControl.
+ * It accesses the propertySets inherited from ExtensibleControl, and extended by
+ * its own interface.
*/
@ControlImplementation
public class SubControlImpl extends ExtensibleControlImpl implements SubControl
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java Wed Sep 15 19:51:33 2004
@@ -1,13 +1,9 @@
-//
-// Copyright � 2001-2002 BEA Systems. All rights reserved.
-//
-
package org.apache.beehive.controls.test.controls.instantiate;
import org.apache.beehive.controls.api.bean.ControlInterface;
/**
- * A simple control with one method
+ * A control interface with one method declared.
*/
@ControlInterface
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs Wed Sep 15 19:51:33 2004
@@ -5,7 +5,7 @@
import org.apache.beehive.controls.api.context.ControlBeanContext;
/**
- * A control impl that access the property declared in its control interface
+ * A control impl that accesses the property declared by its control interface via control context
*/
@ControlImplementation
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/composition/ProgrammaticTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/composition/ProgrammaticTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/composition/ProgrammaticTest.java Wed Sep 15 19:51:33 2004
@@ -104,7 +104,7 @@
InnerControlBean innercontrol=outerControl.instantiateNestedControlWithProperty();
Assert.assertNotNull(innercontrol);
Assert.assertEquals("Bob",innercontrol.getNameFromContext());
- Assert.assertNull(innercontrol.getJobFromContext());
+ Assert.assertEquals("farmer",innercontrol.getJobFromContext());
}
/**
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java Wed Sep 15 19:51:33 2004
@@ -187,6 +187,40 @@
*/
}
+
+ /**
+ * Tests getting the reconfigured and inherited property.(A property declared on super control,
+ * but reconfigured on sub control)
+ * The reset property is retrieve by context.
+ * The subcontrol is instantiated declaratively
+ */
+ @Freq("detailed")
+ @Status("inactive")
+ public void testGetReconfiguredPropertyByContext() throws Exception
+ {
+ Assert.assertNotNull(subcontrol);
+ String s=subcontrol.getLayerByContext();
+ Assert.assertEquals("On_SubControl_Interface_Layer",s);
+
+ }
+
+ /**
+ * Tests getting the reconfigured and inherited property.(A property declared on super control,
+ * but reconfigured on sub control)
+ * The reset property is retrieve by context.
+ * The subcontrol is instantiated programmatically
+ */
+ @Freq("detailed")
+ public void testGetReconfiguredPropertyByContext2() throws Exception
+ {
+ SubControlBean sub=(SubControlBean)java.beans.Beans.instantiate( Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.extension.SubControlBean");
+
+ Assert.assertNotNull(sub);
+ Assert.assertEquals("On_SubControl_Interface_Layer",sub.getLayerByContext());
+
+ }
+
/**
* Tests getting a reconfigured inherited property.(The property is declared on super control
* but reconfigured on sub control interface).
@@ -253,50 +287,45 @@
}
+ /* More tests to be added on getting property value reconfigured on subcontrol
+ * by declaration.
+ * The above tests testGetReconfiguredPropertyByContext(2) gets the value using an
+ * inherited method.
+ * Once testExtendedMethod passes, we need to add one or two tests to
+ * get the reconfigured value using an extended method on subcontrol
+ *
+ * Like: testGetReconfigurePropertyBySubImpl
+ * While the above two methods are really: testGetReconfiguredPropertyBySuperImpl
+ */
+
/**
- * Tests getting the reconfigured and inherited property.(A property declared on super control,
- * but reconfigured on sub control)
- * The reset property is retrieve by context.
- * The subcontrol is instantiated declaratively
+ * Tests getting the property declared on SubControl interface.
+ * The value is retrieved by control context.
+ * The subcontrol is instantiated declaratively.
*/
- @Freq("detailed")
- @Status("inactive")
- public void testGetReconfiguredPropertyByContext() throws Exception
+ @Freq("checkin")
+ public void testGetExtendedPropertyByContext() throws Exception
{
- Assert.assertNotNull(subcontrol);
- String s=subcontrol.getLayerByContext();
- Assert.assertEquals("On_SubControl_Interface_Layer",s);
+ SubControlBean sub=(SubControlBean)java.beans.Beans.instantiate( Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.extension.SubControlBean");
+ Assert.assertNotNull(sub);
+ Assert.assertEquals("New Property Declared by Sub Control",sub.getExtendedPropertyByContext());
}
/**
- * Tests getting the reconfigured and inherited property.(A property declared on super control,
- * but reconfigured on sub control)
- * The reset property is retrieve by context.
- * The subcontrol is instantiated programmatically
+ * Tests getting the property declared on SubControl interface.
+ * The property is retrieved by control context.
+ * The subcontrol is instantiated programmatically.
*/
@Freq("detailed")
- public void testGetReconfiguredPropertyByContext2() throws Exception
+ @Status("inactive")
+ public void testGetExtendedPropertyByContext2() throws Exception
{
- SubControlBean sub=(SubControlBean)java.beans.Beans.instantiate( Thread.currentThread().getContextClassLoader() ,
- "org.apache.beehive.controls.test.controls.extension.SubControlBean");
-
- Assert.assertNotNull(sub);
- Assert.assertEquals("On_SubControl_Interface_Layer",sub.getLayerByContext());
-
+ //one new method needs to be added on SubControl
+ //getNewPropertyByContext()
}
- /* More tests to be added on getting property value reconfigured on subcontrol
- * by declaration.
- * The above tests testGetReconfiguredPropertyByContext(2) gets the value using an
- * inherited method.
- * Once testExtendedMethod passes, we need to add one or two tests to
- * get the reconfigured value using an extended method on subcontrol
- *
- * Like: testGetReconfigurePropertyBySubImpl
- * While the above two methods are really: testGetReconfiguredPropertyBySuperImpl
- */
-
/**
* Tests getting the property declared SubControl interface.
* The value is retrieved by getter on subcontrol bean
@@ -329,34 +358,6 @@
Assert.assertNotNull(sub);
Assert.assertEquals(sub.getNewPropertyMessage(),"New Property Declared by Sub Control");
*/
- }
-
- /**
- * Tests getting the property declared on SubControl interface.
- * The value is retrieved by control context.
- * The subcontrol is instantiated declaratively.
- */
- @Freq("checkin")
- public void testGetExtendedPropertyByContext() throws Exception
- {
- SubControlBean sub=(SubControlBean)java.beans.Beans.instantiate( Thread.currentThread().getContextClassLoader() ,
- "org.apache.beehive.controls.test.controls.extension.SubControlBean");
-
- Assert.assertNotNull(sub);
- Assert.assertEquals("New Property Declared by Sub Control",sub.getExtendedPropertyByContext());
- }
-
- /**
- * Tests getting the property declared on SubControl interface.
- * The property is retrieved by control context.
- * The subcontrol is instantiated programmatically.
- */
- @Freq("detailed")
- @Status("inactive")
- public void testGetExtendedPropertyByContext2() throws Exception
- {
- //one new method needs to be added on SubControl
- //getNewPropertyByContext()
}
/**
Added: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java Wed Sep 15 19:51:33 2004
@@ -0,0 +1,197 @@
+package org.apache.beehive.controls.test.jpf.composition;
+
+import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
+
+
+/**
+ * Tests controls composition by invoking a control on a pageflow.
+ * The control has nested controls.
+ */
+public class TestOuterControl extends HtmlReportTestCase
+{
+ public TestOuterControl(String s){super(s);}
+
+ /**
+ * Tests instantiation of nested control.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("checkin")
+ public void testInstantiation() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testInstantiation.do");
+ }
+
+ /**
+ * Tests instantiation of nested control.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("checkin")
+ public void testInstantiationP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testInstantiationP.do");
+ }
+
+ /**
+ * Tests instantiation of nested control when a property of the
+ * nested control is reconfigured at instantiation.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("detailed")
+ public void testInstantiationWithProperty() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testInstantiationWithProperty.do");
+ }
+
+ /**
+ * Tests instantiation of nested control when a property of the
+ * nested control is reconfigured at instantiation.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("detailed")
+ public void testInstantiationWithPropertyP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testInstantiationWithPropertyP.do");
+ }
+
+ /**
+ * Tests getting nested control property from context of nested control.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("checkin")
+ public void testGetPropertyByContext() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testGetPropertyByContext.do");
+ }
+
+ /**
+ * Tests getting nested control property from context of nested control.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("checkin")
+ public void testGetPropertyByContextP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testGetPropertyByContextP.do");
+ }
+
+ /**
+ * Tests getting nested control property using getter method on nested control bean class.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("detailed")
+ public void testGetPropertyByGetter() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testGetPropertyByGetter.do");
+ }
+
+ /**
+ * Tests getting nested control property using getter method on nested control bean class.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("detailed")
+ public void testGetPropertyByGetterP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testGetPropertyByGetterP.do");
+ }
+
+ /**
+ * Tests setting nested control property using setter method on nested control bean class.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("detailed")
+ public void testSetPropertyBySetter() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testSetPropertyBySetter.do");
+ }
+
+ /**
+ * Tests setting nested control property using setter method on nested control bean class.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("detailed")
+ public void testSetPropertyBySetterP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testSetPropertyBySetterP.do");
+ }
+
+ /**
+ * Tests getting a reconfigured property from context of the nested control.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("detailed")
+ public void testGetReconfiguredPropertyByContext() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testGetReconfiguredPropertyByContext.do");
+ }
+
+ /**
+ * Tests getting a reconfigured property from context of nested control.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("detailed")
+ public void testGetReconfiguredPropertyByContextP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testGetReconfiguredPropertyByContextP.do");
+ }
+
+ /**
+ * Tests outer control receiving events raised by nested control using EventHandler.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("detailed")
+ public void testEventHandler() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testEventHandler.do");
+ }
+
+ /**
+ * Tests outer control receiving events raised by nested control using EventHandler.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("detailed")
+ public void testEventHandlerP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testEventHandlerP.do");
+ }
+
+ /**
+ * Tests outer control receiving events raised by nested control using EventListener.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("checkin")
+ public void testEventListener() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testEventListener.do");
+ }
+
+ /**
+ * Tests outer control receiving events raised by nested control using EventListener.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("checkin")
+ public void testEventListenerP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testEventListenerP.do");
+ }
+
+ /**
+ * Tests outer control receiving events raised by nested control using inner classes.
+ * The outer control is instantiated declaratively
+ */
+ @Freq("checkin")
+ public void testInnnerClassListener() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testInnerClassListener.do");
+ }
+
+ /**
+ * Tests outer control receiving events raised by nested control using inner classes.
+ * The outer control is instantiated programmatically
+ */
+ @Freq("checkin")
+ public void testInnerClassListenerP() throws Exception
+ {
+ assertReport("/controlsWeb/composition/testInnerClassListenerP.do");
+ }
+}
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java Wed Sep 15 19:51:33 2004
@@ -56,7 +56,7 @@
* implementation class.
*/
- @Freq("detailed")
+ @Freq("checkin")
public void testGetInheritedPropertyByContext() throws Exception
{
assertReport("/controlsWeb/extension/testGetInheritedPropertyByContext.do");
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/composition/Controller.jpf
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/composition/Controller.jpf Wed Sep 15 19:51:33 2004
@@ -0,0 +1,436 @@
+/*
+ *
+ * N E T U I
+ *
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * All Rights Reserved. Unpublished rights reserved under the copyright laws
+ * of the United States. The software contained on this media is proprietary
+ * to and embodies the confidential technology of BEA Systems, Inc. The
+ * possession or receipt of this information does not convey any right to
+ * disclose its contents, reproduce it, or use, or license the use,
+ * for manufacture or sale, the information or anything described
+ * therein. Any use, disclosure, or reproduction without BEA System's
+ * prior written permission is strictly prohibited.
+ *
+ * $Header:$
+ */
+package composition;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.bean.ControlBean;
+import org.apache.beehive.controls.test.controls.composition.OuterControlBean;
+import org.apache.beehive.controls.test.driver.composition.DriveOuterControl;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test control composition by invoking methods on a control that has nested controls*/
+
+@Jpf.Controller(
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public OuterControlBean outercontrol;
+
+
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ Report report =new Report();
+ report.setStatus(Report.PASS);
+ report.setMessage("This is a bogus test.");
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Verifies the instantiation of nested controls.
+ * The outer control is instantiated declaratively.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testInstantiation(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestInstantiate();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Verifies the instantiation of nested controls.
+ * The outer control is instantiated programmatically.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testInstantiationP(){
+
+
+ DriveOuterControl driver=new DriveOuterControl();
+
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestInstantiate();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestInstantiateWithProperty();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestInstantiateWithProperty();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests getting control property from the context of the nested control.
+ * The outer control is instantiated declaratively.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testGetPropertyByContext(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestGetPropertyByContext();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests getting control property from the context of the nested control.
+ * The outer control is instantiated programmatically.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testGetPropertyByContextP(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestGetPropertyByContext();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests getting control property from getter method of the nested control bean.
+ * The outer control is instantiated declaratively.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testGetPropertyByGetter(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestGetPropertyByGetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests getting control property from getter method of the nested control bean.
+ * The outer control is instantiated programmatically.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testGetPropertyByGetterP(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestGetPropertyByGetter();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests setting control property using setter method of the nested control bean.
+ * The outer control is instantiated declaratively.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testSetPropertyBySetter(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestSetPropertyBySetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests setting control property using setter method of the nested control bean.
+ * The outer control is instantiated programmatically.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testSetPropertyBySetterP(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestSetPropertyBySetter();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests getting control property via the context of the nested control.
+ * The property is reconfigured when instantiated.
+ * The outer control is instantiated declaratively.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testGetReconfiguredPropertyByContext(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestGetReconfiguredPropertyByContext();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * Tests getting control property via the context of the nested control.
+ * The property is reconfigured when instantiated.
+ * The outer control is instantiated programmatically.
+ */
+ @Jpf.Action(
+ )
+ protected Forward testGetReconfiguredPropertyByContextP(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestGetReconfiguredPropertyByContext();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestEventHandler();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestEventHandler();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestEventListener();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestEventListener();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ driver.setControl(outercontrol);
+ Report report=driver.doTestEventInnerClass();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ * 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(){
+
+ DriveOuterControl driver=new DriveOuterControl();
+ Report report=new Report();
+ try{
+ OuterControlBean outerbean=(OuterControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.OuterControlBean");
+ driver.setControl(outerbean);
+ report=driver.doTestEventInnerClass();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+}
\ No newline at end of file
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControl.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControl.java Wed Sep 15 19:51:33 2004
@@ -0,0 +1,55 @@
+package org.apache.beehive.controls.test.controls.composition;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+/**
+ * A control interface designed to test control composition
+ */
+@ControlInterface
+public interface InnerControl
+{
+ static final String DEFAULT_NAME="Bob";
+ static final String DEFAULT_JOB="cleaner";
+
+ @PropertySet
+ @Target( {ElementType.TYPE, ElementType.FIELD} )
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Identity
+ {
+ public String name() default DEFAULT_NAME;
+ //does not have a default value assigned
+ public String job();
+ }
+
+
+
+ @EventSet
+ public interface Activity
+ {
+ void wakeup();
+ int readMessage(String message);
+ String report();
+ }
+
+ @EventSet
+ public interface Action
+ {
+ public Object[] shopping (double credit);
+ public void doStuff(String value);
+ }
+
+ public void fireAllEvents();
+ public void fireEvent(String eventSet, String eventName);
+
+ /*Gets property value from context*/
+ public String getNameFromContext();
+ /*Gets property value from context*/
+ public String getJobFromContext();
+}
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControlEventListener.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControlEventListener.java Wed Sep 15 19:51:33 2004
@@ -0,0 +1,72 @@
+package org.apache.beehive.controls.test.controls.composition;
+
+/**
+ * A listener class for event raised by InnerControl
+ */
+public class InnerControlEventListener implements InnerControl.Activity,InnerControl.Action
+{
+
+ private boolean wakeupReceived=false;
+ private boolean readMessageReceived=false;
+ private boolean reportReceived=false;
+ private boolean shoppingReceived=false;
+ private boolean doStuffReceived=false;
+
+ /*
+ * BUG!!?? although the event declares methods wakeup, readMessage and
+ * report using default accessor,
+ * implmentation must change the method accessor to public,
+ * or, a compile error!
+ *
+ * attempting to assign weaker access privileges; was public
+ * [apt] void wakeup(){wakeupReceived=true;}
+ *
+ */
+
+ public void wakeup(){wakeupReceived=true;}
+ public int readMessage(String message){
+ readMessageReceived=true;
+ return 0;}
+ public String report(){
+ reportReceived=true;
+ return "a report from event listener";}
+
+ public Object[] shopping (double credit){
+ shoppingReceived=true;
+ //return (Object){"clothes","shoes","food"};
+ return null;
+ }
+ public void doStuff(String value){
+ doStuffReceived=true;
+ }
+
+ public boolean getWakeupResult(){return wakeupReceived;}
+ public boolean getReadMessageResult(){return readMessageReceived;}
+ public boolean getReportResult(){return reportReceived;}
+ public boolean getShoppingResult(){return shoppingReceived;}
+ public boolean getDoStuffResult(){return doStuffReceived;}
+
+ /* checks all the event records.
+ * returns '0' if all the events have been received.
+ */
+ public String getFinalResult(){
+
+ String result="";
+
+ if (!wakeupReceived)
+ result="WakeUp not received.";
+ if (!readMessageReceived)
+ result=result+"readMessage not received.";
+ if (!reportReceived)
+ result=result+"report not received.";
+ if (!shoppingReceived)
+ result=result+"shopping not received.";
+ if (!doStuffReceived)
+ result=result+"dostuff not received.";
+
+ if (result.length()==0)
+ result="0";
+
+ return result;
+ }
+}
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/InnerControlImpl.jcs Wed Sep 15 19:51:33 2004
@@ -0,0 +1,62 @@
+package org.apache.beehive.controls.test.controls.composition;
+
+import java.lang.reflect.Method;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.events.Client;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+
+@ControlImplementation
+public class InnerControlImpl implements InnerControl
+{
+ @Context ControlBeanContext context;
+ @Client Activity activity;
+ @Client Action action;
+
+
+ /*Gets property value from context*/
+ public String getNameFromContext(){
+
+ Identity identity=(InnerControl.Identity)context.getControlPropertySet(InnerControl.Identity.class);
+ return identity.name();
+ }
+ /*Gets property value from context*/
+ public String getJobFromContext(){
+
+ Identity identity=(InnerControl.Identity)context.getControlPropertySet(InnerControl.Identity.class);
+ return identity.job();
+ }
+
+ public void fireEvent(String eventSet, String eventName){
+
+ if ((eventSet!=null)&&(eventName!=null)){
+
+ if (eventSet.equalsIgnoreCase("Activity")){
+ if (eventName.equalsIgnoreCase("wakeup"))
+ activity.wakeup();
+ else if(eventName.equalsIgnoreCase("readMessage"))
+ activity.readMessage("message from nested control");
+ else if(eventName.equalsIgnoreCase("report"))
+ activity.report();
+ }
+ else if (eventSet.equalsIgnoreCase("Action")){
+ if (eventName.equalsIgnoreCase("shopping"))
+ action.shopping(999.99d);
+ else if(eventName.equalsIgnoreCase("doStuff"))
+ action.doStuff("stuff to do");
+ }
+ }
+
+ }
+
+ public void fireAllEvents(){
+
+ activity.wakeup();
+ activity.readMessage("message from nested control");
+ activity.report();
+ action.shopping(999.99d);
+ action.doStuff("stuff to do");
+ }
+
+}
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/OuterControl.java Wed Sep 15 19:51:33 2004
@@ -0,0 +1,52 @@
+package org.apache.beehive.controls.test.controls.composition;
+
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.test.controls.composition.InnerControlBean;
+
+
+
+/**
+ * A control interface designed to test control composition
+ */
+@ControlInterface
+public interface OuterControl
+{
+ /*
+ * BUG: can not refer to the bean class
+ *
+ * Must a outer control declare its inner control by bean or interface?
+ */
+ public InnerControlBean getDeclaredNestedControl();
+ public InnerControlBean getDeclaredNestedControl2();
+ public InnerControlBean instantiateNestedControlProgrammatically();
+ public InnerControlBean instantiateNestedControlWithProperty();
+
+ /*Test outer control receiving event from nested control using
+ * EventHandler.
+ */
+ public String testActivityWakeup();
+ public String testActivityReadMessage();
+ public String testActivityReport();
+ public String testActionShopping();
+ public String testActionDostuff();
+
+ /*Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated programmatically
+ */
+ public String testEventListener();
+
+ /*Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated decalratively
+ */
+ public String testEventListenerByDeclare();
+
+ /*Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated programmatically
+ */
+ public String testInnerClassListener();
+ /*Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated decalratively
+ */
+ public String testInnerClassListenerByDeclare();
+}
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/OuterControlImpl.jcs
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/composition/OuterControlImpl.jcs Wed Sep 15 19:51:33 2004
@@ -0,0 +1,444 @@
+package org.apache.beehive.controls.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.events.EventHandler;
+
+import org.apache.beehive.controls.test.controls.composition.InnerControlBean;
+
+/**
+ * A control implementation designed to test control composition
+ * This control implementation make two instances of nested control
+ * be declaration.
+ */
+@ControlImplementation
+public class OuterControlImpl implements OuterControl
+{
+ static final long serialVersionUID = 1L;
+ static final String EVENT_RECEIVED="Event Received";
+
+ private String innerControlEventHandlerWakeUp="";
+ private String innerControlEventHandlerReadMessage="";
+ private String innerControlEventHandlerReport="";
+ private String innerControlEventHandlerShopping="";
+ private String innerControlEventHandlerDoStuff="";
+
+ private boolean innerClassWakeUp=false;
+ private boolean innerClassReadMessage=false;
+ private boolean innerClassReport=false;
+ private boolean innerClassShopping=false;
+ private boolean innerClassDoStuff=false;
+
+ private boolean innerControlInnerClassWakeUp=false;
+ private boolean innerControlInnerClassReadMessage=false;
+ private boolean innerControlInnerClassReport=false;
+ private boolean innerControlInnerClassShopping=false;
+ private boolean innerControlInnerClassDoStuff=false;
+
+ /*Instantiates a nested control without reconfiguring the property*/
+ @Control
+ InnerControlBean innerControl;
+
+ @Control
+ @InnerControl.Identity(job="farmer")
+ InnerControlBean innerControl2;
+
+
+ //
+ // Define various event handlers for the nested controls
+ //
+ @EventHandler(field="innerControl", eventSet=InnerControl.Activity.class, eventName="wakeup")
+ public void innerControlwakeup() { innerControlEventHandlerWakeUp=EVENT_RECEIVED; }
+
+ @EventHandler(field="innerControl", eventSet=InnerControl.Activity.class, eventName="readMessage")
+ public int innerControlreadMessage(String message) {
+ innerControlEventHandlerReadMessage=EVENT_RECEIVED;
+ return 0;
+ }
+
+ @EventHandler(field="innerControl", eventSet=InnerControl.Activity.class, eventName="report")
+ public String innerControlreport() {
+ innerControlEventHandlerReport=EVENT_RECEIVED;
+ return "a report";
+ }
+
+ @EventHandler(field="innerControl", eventSet=InnerControl.Action.class, eventName="shopping")
+ public Object [] innerControlshopping(double credit) {
+ innerControlEventHandlerShopping=EVENT_RECEIVED;
+ return null;
+ }
+
+ @EventHandler(field="innerControl", eventSet=InnerControl.Action.class, eventName="doStuff")
+ public void innerControldoStuff(String vakue) {
+ innerControlEventHandlerShopping=EVENT_RECEIVED;
+ }
+
+ @EventHandler(field="innerControl2", eventSet=InnerControl.Activity.class, eventName="wakeup")
+ public void innerControl2wakeup() {}
+
+ @EventHandler(field="innerControl2", eventSet=InnerControl.Activity.class, eventName="readMessage")
+ public int innerControl2readMessage(String message) { return 0; }
+
+ @EventHandler(field="innerControl2", eventSet=InnerControl.Activity.class, eventName="report")
+ public String innerControl2report() { return "a report"; }
+
+ @EventHandler(field="innerControl2", eventSet=InnerControl.Action.class, eventName="shopping")
+ public Object [] innerControl2shopping(double credit) { return null; }
+
+ @EventHandler(field="innerControl2", eventSet=InnerControl.Action.class, eventName="doStuff")
+ public void innerControl2doStuff(String vakue) {}
+
+
+ public InnerControlBean getDeclaredNestedControl(){
+ return innerControl;
+ }
+
+ public InnerControlBean getDeclaredNestedControl2(){
+ return innerControl2;
+ }
+
+ public InnerControlBean instantiateNestedControlProgrammatically(){
+ try{
+ InnerControlBean inner=(InnerControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.InnerControlBean");
+ return inner;
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+ public InnerControlBean instantiateNestedControlWithProperty(){
+ /*BUG:CR190302*/
+ return null;
+ }
+
+ public String testActivityWakeup(){
+
+ String result="";
+ if (innerControl==null)
+ result="inner control is NULL";
+ else{
+ innerControl.fireEvent("Activity","wakeup");
+ /*Wait for the events*/
+ try{
+ Thread.currentThread().sleep(1000);
+ if (innerControlEventHandlerWakeUp.equals(EVENT_RECEIVED))
+ result="0";
+ else
+ result="Acivity.wakeup not received by EventHandler";
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+ }
+ return result;
+ }
+ public String testActivityReadMessage(){
+
+ String result="";
+ if (innerControl==null)
+ result="inner control is NULL";
+ else{
+ innerControl.fireEvent("Activity","readMessage");
+ /*Wait for the events*/
+ try{
+ Thread.currentThread().sleep(1000);
+
+ if (innerControlEventHandlerReadMessage.equals(EVENT_RECEIVED))
+ result="0";
+ else
+ result="Acivity.readMessage not received by EventHandler";
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+ }
+ return result;
+
+ }
+ public String testActivityReport(){
+
+ String result="";
+ if (innerControl==null)
+ result="inner control is NULL";
+ else{
+ innerControl.fireEvent("Activity","report");
+ /*Wait for the events*/
+ try{
+ Thread.currentThread().sleep(1000);
+
+ if (innerControlEventHandlerReport.equals(EVENT_RECEIVED))
+ result="0";
+ else
+ result="Acivity.report not received by EventHandler";
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+ }
+ return result;
+
+ }
+ public String testActionShopping(){
+
+ String result="";
+ if (innerControl==null)
+ result="inner control is NULL";
+ else{
+ innerControl.fireEvent("Action","shopping");
+ /*Wait for the events*/
+ try{
+ Thread.currentThread().sleep(1000);
+
+ if (innerControlEventHandlerShopping.equals(EVENT_RECEIVED))
+ result="0";
+ else
+ result="Action.shopping not received by EventHandler";
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+ }
+ return result;
+
+ }
+ public String testActionDostuff(){
+
+ String result="";
+ if (innerControl==null)
+ result="inner control is NULL";
+ else{
+ innerControl.fireEvent("Action","doStuff");
+ /*Wait for the events*/
+ try{
+ Thread.currentThread().sleep(1000);
+
+ if (innerControlEventHandlerDoStuff.equals(EVENT_RECEIVED))
+ result="0";
+ else
+ result="Action.doStuff not received by EventHandler";
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+ }
+ return result;
+
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated programmatically
+ */
+ public String testEventListener(){
+
+ String result="init";
+ try{
+
+ InnerControlBean nested=(InnerControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.InnerControlBean");
+ if (nested==null)
+ result="Nested control instantiated programmatically is NULL.";
+ else{
+ //Create an Event Listener
+ InnerControlEventListener listener=new InnerControlEventListener();
+ nested.addActivityListener(listener);
+ nested.addActionListener(listener);
+ nested.fireAllEvents();
+ try{
+ Thread.currentThread().sleep(1000);
+ result=listener.getFinalResult();
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+
+
+ }
+ }
+ catch(Exception e){
+ result="Exception caught:"+e.toString();
+ }
+ return result;
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated decalratively
+ */
+ public String testEventListenerByDeclare(){
+
+ String result="init";
+
+ if (innerControl==null)
+ result="Nested control instantiated declaratively is NULL.";
+ else{
+ try{
+ //Create an Event Listener
+ InnerControlEventListener listener=new InnerControlEventListener();
+ innerControl.addActivityListener(listener);
+ innerControl.addActionListener(listener);
+ innerControl.fireAllEvents();
+
+ Thread.currentThread().sleep(1000);
+ result=listener.getFinalResult();
+ }
+ catch(Exception e){
+ result="Thread sleep interrupted."+e.toString();
+ }
+
+
+ }
+ return result;
+
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated programmatically
+ */
+ public String testInnerClassListener(){
+
+ String result="init";
+ try{
+ InnerControlBean nested=(InnerControlBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+ "org.apache.beehive.controls.test.controls.composition.InnerControlBean");
+ if (nested==null)
+ result="Nested control instantiated programmatically is NULL.";
+ else{
+ nested.addActivityListener(
+ new InnerControl.Activity(){
+
+ public void wakeup(){innerClassWakeUp=true;}
+ public int readMessage(String message){
+ innerClassReadMessage=true;
+ return 0;}
+ public String report(){
+ innerClassReport=true;
+ return "event received.";
+ }
+ }
+ );
+ nested.addActionListener(
+ new InnerControl.Action(){
+
+ public Object[] shopping (double credit){
+ innerClassShopping=true;
+ //return {"food","drinks","candies"};
+ return null;
+ }
+ public void doStuff(String value){
+ innerClassDoStuff=true;
+ }
+ }
+ );
+ nested.fireAllEvents();
+ try{
+ Thread.currentThread().sleep(1000);
+ }
+ catch(Exception e){}
+
+ result=getInnerClassListenerResult();
+ }
+ }
+ catch(Exception e){
+ result="Exception caught:"+e.toString();
+ }
+ return result;
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated decalratively
+ */
+ public String testInnerClassListenerByDeclare(){
+
+ String result="init";
+
+ if (innerControl==null)
+ result="Nested control instantiated declaratively is NULL.";
+ else{
+ try{
+ innerControl.addActivityListener(
+ new InnerControl.Activity(){
+
+ public void wakeup(){innerControlInnerClassWakeUp=true;}
+ public int readMessage(String message){
+ innerControlInnerClassReadMessage=true;
+ return 0;}
+ public String report(){
+ innerControlInnerClassReport=true;
+ return "event received.";
+ }
+ }
+ );
+ innerControl.addActionListener(
+ new InnerControl.Action(){
+
+ public Object[] shopping (double credit){
+ innerControlInnerClassShopping=true;
+ //return {"food","drinks","candies"};
+ return null;
+ }
+ public void doStuff(String value){
+ innerControlInnerClassDoStuff=true;
+ }
+ }
+ );
+ innerControl.fireAllEvents();
+
+ Thread.currentThread().sleep(1000);
+ }
+ catch(Exception e){}
+
+ result=getInnerControlInnerClassListenerResult();
+ }
+ return result;
+
+ }
+
+ private String getInnerClassListenerResult(){
+
+ String result="";
+
+ if (!innerClassWakeUp)
+ result="WakeUp not received.";
+ if (!innerClassReadMessage)
+ result=result+"readMessage not received.";
+ if (!innerClassReport)
+ result=result+"report not received.";
+ if (!innerClassShopping)
+ result=result+"shopping not received.";
+ if (!innerClassDoStuff)
+ result=result+"dostuff not received.";
+
+ if (result.length()==0)
+ result="0";
+
+ return result;
+ }
+
+ private String getInnerControlInnerClassListenerResult(){
+
+ String result="";
+
+ if (!innerControlInnerClassWakeUp)
+ result="WakeUp not received.";
+ if (!innerControlInnerClassReadMessage)
+ result=result+"readMessage not received.";
+ if (!innerControlInnerClassReport)
+ result=result+"report not received.";
+ if (!innerControlInnerClassShopping)
+ result=result+"shopping not received.";
+ if (!innerControlInnerClassDoStuff)
+ result=result+"dostuff not received.";
+
+ if (result.length()==0)
+ result="0";
+
+ return result;
+ }
+
+}
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetter.java Wed Sep 15 19:51:33 2004
@@ -4,7 +4,7 @@
import org.apache.beehive.controls.api.bean.ControlInterface;
/**
- * A simple control that retrieve specific service
+ * A control interface to test control context service
*/
@ControlInterface
public interface ServiceGetter
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/context/ServiceGetterImpl.jcs Wed Sep 15 19:51:33 2004
@@ -9,7 +9,7 @@
import org.apache.beehive.controls.api.context.ControlBeanContext;
/**
- * A impl that retrieves specific service via controlContext
+ * A control implementation that retrieves specific service via controlContext
*/
@ControlImplementation
public class ServiceGetterImpl implements ServiceGetter
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/contextevent/Recorder.java Wed Sep 15 19:51:33 2004
@@ -3,7 +3,7 @@
import org.apache.beehive.controls.api.bean.ControlInterface;
/**
- * A simple control that records its lifecycle events in its impl
+ * A control interface to test control context events
*/
@ControlInterface
public interface Recorder
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/event/HelloImpl.jcs Wed Sep 15 19:51:33 2004
@@ -4,7 +4,7 @@
import org.apache.beehive.controls.api.events.Client;
/**
- * A control implementation that raises events while executing its method
+ * A control implementation that raises events when the method is invoked
*/
@ControlImplementation
public class HelloImpl implements Hello
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java Wed Sep 15 19:51:33 2004
@@ -10,8 +10,6 @@
* A sub control extending ExtensibleControl.
* This control declares one new method and one new propertySet.
* It also resets the value of the propertySet inherited from ExtensibleControl.
- *
- * It will access another property inherited from ExtensibleControl in its impl.
*/
//@ControlExtension
@ControlInterface
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs Wed Sep 15 19:51:33 2004
@@ -6,7 +6,8 @@
/**
* A control impl of a SubControl and extending ExtensibleControlImpl.
- * It access the propertySet inherited from ExtensibleControl.
+ * It accesses the propertySet inherited from ExtensibleControl via control context.
+ * It also accesses the propertySet declared by its own interface.
*/
@ControlImplementation
public class SubControlImpl extends ExtensibleControlImpl implements SubControl
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/instantiate/HelloControl.java Wed Sep 15 19:51:33 2004
@@ -1,13 +1,9 @@
-//
-// Copyright � 2001-2002 BEA Systems. All rights reserved.
-//
-
package org.apache.beehive.controls.test.controls.instantiate;
import org.apache.beehive.controls.api.bean.ControlInterface;
/**
- * A simple control with one method
+ * A simple control interface with one method declared
*/
@ControlInterface
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/property/SinglePropertyImpl.jcs Wed Sep 15 19:51:33 2004
@@ -5,7 +5,7 @@
import org.apache.beehive.controls.api.context.ControlBeanContext;
/**
- * A control impl that access the property declared in its control interface
+ * A control impl that accesses the property via control context
*/
@ControlImplementation
Added: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/composition/DriveOuterControl.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/composition/DriveOuterControl.java Wed Sep 15 19:51:33 2004
@@ -0,0 +1,257 @@
+package org.apache.beehive.controls.test.driver.composition;
+
+import org.apache.beehive.test.tools.milton.common.Report;
+import org.apache.beehive.controls.test.controls.composition.OuterControlBean;
+import org.apache.beehive.controls.test.controls.composition.InnerControlBean;
+
+/* This class contains the logic to test control composition.
+ * By invoking method on OuterControl, a control containing a nested control,
+ * features of control composition are verified.
+ */
+public class DriveOuterControl
+{
+
+ private OuterControlBean myControl;
+
+ public void setControl(OuterControlBean aControl){
+
+ myControl=aControl;
+ }
+
+ public Report doTestInstantiate(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the outer control is NULL");
+ }
+ else{
+ InnerControlBean declaredNestedControl=myControl.getDeclaredNestedControl();
+
+ if (declaredNestedControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the nested control instantiated declaratively is NULL");
+ }
+ else{
+ InnerControlBean programNestedControl=myControl.instantiateNestedControlProgrammatically();
+
+ if (programNestedControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the nested control instantiated programmatically is NULL");
+ }
+ else
+ report.setStatus(Report.PASS);
+ }
+
+ }
+ return report;
+ }
+
+ public Report doTestInstantiateWithProperty(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the outer control is NULL");
+ }
+ else{
+ InnerControlBean declaredNestedControl=myControl.getDeclaredNestedControl2();
+
+ if (declaredNestedControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the nested control instantiated declaratively is NULL");
+ }
+ else{
+ InnerControlBean programNestedControl=myControl.instantiateNestedControlWithProperty();
+
+ if (programNestedControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the nested control instantiated programmatically is NULL");
+ }
+ else
+ report.setStatus(Report.PASS);
+ }
+
+ }
+ return report;
+ }
+
+ public Report doTestGetPropertyByContext(){
+
+ Report report=doTestInstantiate();
+
+ if (report.getStatus().equals(Report.PASS)){
+
+ InnerControlBean declaredNestedControl=myControl.getDeclaredNestedControl();
+ String property_value=declaredNestedControl.getNameFromContext();
+ if(property_value!=null){
+ if (property_value.equals("Bob"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("declarative instantiation:property retrieved from context is:"+property_value);
+ }
+ }
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("declarative instantiation:property retrieved from context is NULL.");
+ }
+
+ if (report.getStatus().equals(Report.PASS)){
+
+ InnerControlBean programNestedControl=myControl.instantiateNestedControlProgrammatically();
+ String property_value2=programNestedControl.getNameFromContext();
+
+ if(property_value2!=null){
+ if (property_value.equals("Bob"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("programmatic instantiation:property retrieved from context is:"+property_value);
+ }
+ }
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("programmatic instantiation:property retrieved from context is NULL.");
+ }
+ }
+ }
+ return report;
+ }
+
+ public Report doTestGetPropertyByGetter(){
+
+ Report report=new Report();
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter not supported. Check latest development status.");
+ return report;
+ }
+
+ public Report doTestSetPropertyBySetter(){
+
+ Report report=new Report();
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter not supported. Check latest development status.");
+ return report;
+ }
+
+ public Report doTestGetReconfiguredPropertyByContext(){
+
+ Report report=doTestInstantiateWithProperty();
+
+ if (report.getStatus().equals(Report.PASS)){
+
+ InnerControlBean declaredNestedControl=myControl.getDeclaredNestedControl2();
+ String property_value=declaredNestedControl.getJobFromContext();
+ if(property_value!=null){
+ if (property_value.equals("farmer"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("declarative instantiation:reconfigured property retrieved from context is:"+property_value);
+ }
+ }
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("declarative instantiation:property retrieved from context is NULL.");
+ }
+
+ if (report.getStatus().equals(Report.PASS)){
+
+ InnerControlBean programNestedControl=myControl.instantiateNestedControlWithProperty();
+ String property_value2=programNestedControl.getJobFromContext();
+
+ if(property_value2!=null){
+ if (property_value.equals("farmer"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("programmatic instantiation:reconfigured property retrieved from context is:"+property_value);
+ }
+ }
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("programmatic instantiation:property retrieved from context is NULL.");
+ }
+ }
+ }
+
+ return report;
+ }
+
+ public Report doTestEventHandler(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the outer control is NULL");
+ }
+ else{
+ String wakeupResult=myControl.testActivityWakeup();
+ String readMessageResult=myControl.testActivityReadMessage();
+ String reportResult=myControl.testActivityReport();
+ String shoppingResult=myControl.testActionShopping();
+ String dostuffResult=myControl.testActionDostuff();
+
+ if (wakeupResult.equals("0") && readMessageResult.equals("0") && reportResult.equals("0")
+ && shoppingResult.equals("0") && dostuffResult.equals("0"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("ActivityWakeup:"+wakeupResult+
+ ". ActivityReadMessage:"+ readMessageResult+
+ ". ActivityReport:"+reportResult+
+ ". ActionShopping:"+shoppingResult+
+ ". ActionDodtuff:"+dostuffResult);
+ }
+ }
+
+ return report;
+ }
+
+ public Report doTestEventListener(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the outer control is NULL");
+ }
+ else{
+ String eventListener=myControl.testEventListener();
+
+ if (eventListener.equals("0"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("EventListener:"+ eventListener);
+ }
+ }
+
+ return report;
+ }
+
+ public Report doTestEventInnerClass(){
+
+ Report report=new Report();
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the outer control is NULL");
+ }
+ else{
+ String innerClassListener=myControl.testInnerClassListener();
+
+ if (innerClassListener.equals("0"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("InnerClassListener:"+ innerClassListener);
+ }
+ }
+
+ return report;
+ }
+}
\ No newline at end of file
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/DriveServiceGetter.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/DriveServiceGetter.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/DriveServiceGetter.java Wed Sep 15 19:51:33 2004
@@ -8,9 +8,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.context.ServiceGetterBean;
-/* This class contains the logic to test ServiceGetterBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control context service.
+ * By invoking methods on ServiceGetterBean, features of context service are verified.
*/
public class DriveServiceGetter
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveBeanRecorder.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveBeanRecorder.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveBeanRecorder.java Wed Sep 15 19:51:33 2004
@@ -3,11 +3,9 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.contextevent.RecorderBean;
-/* This class contains the logic to test RecorderBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control context events.
+ * By invoking methods on RecorderBean, features of control lifecycle events are verified.
*/
-
public class DriveBeanRecorder
{
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java Wed Sep 15 19:51:33 2004
@@ -3,9 +3,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.contextevent.RecorderBean;
-/* This class contains the logic to test RecorderBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control context event.
+ * By invoking methods on RecorderBean, features of control lifecycle events are verified.
*/
public class DriveRecorder
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event/DriveListener.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event/DriveListener.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event/DriveListener.java Wed Sep 15 19:51:33 2004
@@ -5,11 +5,9 @@
import org.apache.beehive.controls.test.controls.event.HelloBean;
import org.apache.beehive.controls.test.controls.event.Event2Listener;
-/* This class contains the logic to test RecorderBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control event.
+ * By registering a listener to HelloBean, events raised by control are received and recorded.
*/
-
public class DriveListener
{
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java Wed Sep 15 19:51:33 2004
@@ -3,9 +3,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.extension.SubControlBean;
-/* This class contains the logic to test SubControlBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control extensibility.
+ * By invoking methods on a SubControlBean, features of control extensibility are verified.
*/
public class DriveSubControl
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java Wed Sep 15 19:51:33 2004
@@ -3,9 +3,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.instantiate.HelloControlBean;
-/* This class contains the logic to test HelloControlBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control instantiation.
+ * By verifying the control instance, a Report object is generated.
*/
public class DriveHelloControl
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveSingleProperty.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveSingleProperty.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/instantiate/DriveSingleProperty.java Wed Sep 15 19:51:33 2004
@@ -3,9 +3,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.property.SinglePropertyBean;
-/* This class contains the logic to test HelloControlBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test instantiating controls with propertSet.
+ * A Report object is generated for test result.
*/
public class DriveSingleProperty
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientAccess.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientAccess.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientAccess.java Wed Sep 15 19:51:33 2004
@@ -3,11 +3,10 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.property.SinglePropertyBean;
-/* This class contains the logic to test SinglePropertyBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control property.
+ * It tries to reset the control's property by the setter method on the generated control
+ * bean class, and retrieves the value via control context.
*/
-
public class DriveClientAccess
{
public static String EXPECTED_GREETING="Hello";
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java Wed Sep 15 19:51:33 2004
@@ -3,9 +3,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.property.SinglePropertyBean;
-/* This class contains the logic to test SinglePropertyBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control property.
+ * It tries to get control's property by the getter method on the generated control bean class.
*/
public class DriveClientImpl
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java Wed Sep 15 19:51:33 2004
@@ -3,9 +3,8 @@
import org.apache.beehive.test.tools.milton.common.Report;
import org.apache.beehive.controls.test.controls.property.SinglePropertyBean;
-/* This class contains the logic to test SinglePropertyBean
- It will exercise the control in a certain way and generate a
- test result report
+/* This class contains the logic to test control property.
+ * It tries to get control property via control context.
*/
public class DriveImplAccess