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/07/29 19:44:42 UTC
svn commit: rev 30933 - in incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java: context contextevent event
Author: jsong
Date: Thu Jul 29 10:44:41 2004
New Revision: 30933
Added:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/test.xml
Modified:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/DeclareTest.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/ProgrammicTest.java
Log:
update controls tests for event, context and lifecycle event.
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java Thu Jul 29 10:44:41 2004
@@ -14,17 +14,17 @@
import org.apache.beehive.test.tools.milton.common.Report;
/**
- * Test retrieving other service via context service
- * ServiceGetter is the control that retrieves other service in its impl
+ * Tests retrieving other services available to a control
*/
-
public class GetServiceTest extends TestCase
{
public GetServiceTest( String s ) { super( s ); }
public void setUp() { }
-
+ /**
+ * A control that exposes the function to access other services available
+ */
@Control
public ServiceGetterBean serviceGetter;
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java Thu Jul 29 10:44:41 2004
@@ -9,13 +9,14 @@
/**
- * This class listens to and records control's life cycle events
+ * Tests control's context event by listening to and recording controls'
+ * life cycle event
*/
public class LifeCycleTest extends TestCase
{
/*
- * RecorderImpl listens to an record life cycle event
+ * A control that listens to and records its life cycle event in its impl
*/
@Control
public RecorderBean myRecorder;
@@ -36,7 +37,14 @@
*/
public void testRecordFromBeanInstance() throws Exception
{
+ /**Bug: CR190273
+ ControlBeanContext peerContext = myRecorder.getPeerContext();
+ PeerContext.addCallbackListener( new ControlBeanContext.Callback()
+ { public void onCreate() { //do recording };
+ public void onAcquire() { //do recording};
+ public void onRelease() { //do recording }; });
+ */
}
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/DeclareTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/DeclareTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/DeclareTest.java Thu Jul 29 10:44:41 2004
@@ -11,20 +11,23 @@
import org.apache.beehive.controls.api.events.EventHandler;
/**
- * This class tests receiving control events by declaration
+ * This class receives events from a control by @EventHandler
*/
-
public class DeclareTest extends TestCase
{
public final static String LOG_FILE_METHOD1="test_method1.log";
public final static String LOG_FILE_METHOD2="test_method2.log";
+ /**
+ * A control that sends events to this class
+ */
@Control
public HelloBean myHelloBean;
public DeclareTest(String s) { super(s); }
+ /** EventHandler for EventSet1 from myHelloBean*/
@EventHandler (field="myHelloBean", eventSet= HelloBean.EventSet1.class,
eventName="set1Method1")
public void myHelloBeanMessageHandler()
@@ -55,7 +58,7 @@
}
-
+ /** EventHandler for EventSet2 from myHelloBean*/
@EventHandler (field="myHelloBean", eventSet= HelloBean.EventSet2.class,
eventName="set2Method2")
public void myHelloBeanMessageHandler(int i)
@@ -86,9 +89,10 @@
}
+
/**
- * 1. Delete the file that might exist
- * 2. Invoke a method on a control and wait for the event
+ * 1. Delete the files that might exist
+ * 2. Invoke a method on the control and wait for the event
*/
public void testInvokeEvent() throws Exception
{
@@ -130,7 +134,7 @@
}
/**
- * Check a log file and see if the event is received
+ * Checks a log file to see if EventSet1 has been received
*/
public void testMethod1Event() throws Exception
{
@@ -156,9 +160,8 @@
}
}
-
/**
- * Check a log file and see if the event is received
+ * Checks a log file to see if EventSet2 has been received
*/
public void testMethod2Event() throws Exception
{
@@ -184,4 +187,5 @@
}
}
+
}
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/ProgrammicTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/ProgrammicTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/ProgrammicTest.java Thu Jul 29 10:44:41 2004
@@ -12,14 +12,17 @@
import org.apache.beehive.controls.api.events.EventHandler;
/**
- * This class tests listening to control events programmically
+ * This class receives events from a control with an inner class or
+ * an instance of other class.
*/
-
public class ProgrammicTest extends TestCase
{
public final static String LOG_FILE_METHOD1="test_method1.log";
public final static String LOG_FILE_METHOD2="test_method2.log";
+ /**
+ * A control that raises events
+ */
@Control
public HelloBean myHelloBean;
@@ -29,7 +32,7 @@
/**
* 1. Deletes the file that might exist
- * 2. Adds a listeners to myHelloBean;
+ * 2. Registers two event listeners to myHelloBean;
* 3. Invokes the method myHelloBean that will trigger the event1 and event2
*/
public void testInvokeEvent1() throws Exception
@@ -62,23 +65,25 @@
System.out.println("****** event invoked ******");
System.out.println("*********************************");
-
+ /* Creates an instance of event listener designed for event2*/
Event2Listener event2listener=new Event2Listener();
try{
-
+ /*Adds an inner class as event listener for event1*/
myHelloBean.addEventSet1Listener(
new Hello.EventSet1()
{
public void method1()
{
- // Code implementing on Message event handler
+ // do some recording
}
});
+ /* Registers the event listener designed for event2*/
myHelloBean.addEventSet2Listener(event2listener);
+ /* Trigger the events on myHelloBean*/
myHelloBean.testEvents();
}
catch(Exception e){
Added: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/test.xml
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/test.xml Thu Jul 29 10:44:41 2004
@@ -0,0 +1,20 @@
+<project name="org.apache.beehive.controls.test.java.context" default="org-apache-beehive-controls-test-java-context" >
+ <target name="org-apache-beehive-controls-test-java-context" >
+ <test-suite testunit="org-apache-beehive-controls-test-java-context" >
+ <test name="Tests Receiving Events by EventHandler Tag" timeoutSeconds="300" >
+ <test-metadata>
+ <freq>daily</freq>
+ <status>active</status>
+ </test-metadata>
+ <junit testclass="org.apache.beehive.controls.test.java.event.DeclareTest" />
+ </test>
+ <test name="Tests Receiving Events by Inner Class" timeoutSeconds="300" >
+ <test-metadata>
+ <freq>daily</freq>
+ <status>active</status>
+ </test-metadata>
+ <junit testclass="org.apache.beehive.controls.test.java.event.ProgrammicTest" />
+ </test>
+ </test-suite>
+ </target>
+</project>