Author: jsong
Date: Wed Aug 11 17:40:04 2004
New Revision: 36262
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice2/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice2/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/beanrecord/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/beanrecord/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord2/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord2/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/
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/
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/
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/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/eventhandler/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/eventhandler/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/listener/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/listener/Controller.jpf
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
Modified:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/resources/milton/jsp/miltonResultsTemplate.jsp
Log:
Add test drivers and pageflows to test controls invoked by pageflows.
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,63 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 context.getotherservice;
+
+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.context.ServiceGetterBean;
+import org.apache.beehive.controls.test.driver.context.DriveServiceGetter;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test getting other services avaliable to control context
+ * The control is instantiated declaratively
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public ServiceGetterBean serviceGetter;
+
+ /**
+ * @jpf:action
+ */
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ DriveServiceGetter driver=new DriveServiceGetter();
+ driver.setControl(serviceGetter);
+ driver.setTestEnv(true,true,false);
+ Report report=driver.doTest();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice2/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice2/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,71 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 context.getotherservice2;
+
+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.context.ServiceGetterBean;
+import org.apache.beehive.controls.test.driver.context.DriveServiceGetter;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test getting other services avaliable to control context
+ * The control is instantiated programmatically
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ /**
+ * @jpf:action
+ */
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ Report report=new Report();
+ DriveServiceGetter driver=new DriveServiceGetter();
+ try{
+ ServiceGetterBean
serviceGetter=(ServiceGetterBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+
"org.apache.beehive.controls.test.controls.context.ServiceGetterBean");
+ driver.setControl(serviceGetter);
+ driver.setTestEnv(true,true,false);
+ report=driver.doTest();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+ return new Forward(Report.RESULTS, Report.KEY, report);
+
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/beanrecord/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/beanrecord/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,62 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 contextevent.beanrecord;
+
+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.contextevent.RecorderBean;
+import org.apache.beehive.controls.test.driver.context.DriveBeanRecorder;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test listening to controls life cycle events from control bean instance
directly
+ * The control is instantiated declaratively
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public RecorderBean recorder;
+
+ /**
+ * @jpf:action
+ */
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ DriveBeanRecord driver=new DriveBeanRecord();
+ driver.setControl(recorder);
+ Report report=driver.doTest();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,62 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 contextevent.implrecord;
+
+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.contextevent.RecorderBean;
+import org.apache.beehive.controls.test.driver.context.DriveRecorder;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test control implementation listenning to and recording controls life cycle
events
+ * The control is instantiated declaratively
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public RecorderBean recorder;
+
+ /**
+ * @jpf:action
+ */
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ DriveRecord driver=new DriveRecord();
+ driver.setControl(recorder);
+ Report report=driver.doTest();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord2/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord2/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,70 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 contextevent.implrecord2;
+
+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.contextevent.RecorderBean;
+import org.apache.beehive.controls.test.driver.context.DriveRecorder;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test control implementation listenning to and recording controls life cycle
events
+ * The control is instantiated programmatically
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ /**
+ * @jpf:action
+ */
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ DriveRecord driver=new DriveRecord();
+
+ try{
+ RecorderBean
recorder=(RecorderBean)java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader() ,
+
"org.apache.beehive.controls.test.controls.contextevent.RecorderBean");
+ driver.setControl(recorder);
+ report=driver.doTest();
+ }
+ catch(Exception e){
+
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+ return new Forward(Report.RESULTS, Report.KEY, report);
+
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/DriveServiceGetter.java
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/context/DriveServiceGetter.java
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,120 @@
+package org.apache.beehive.controls.test.driver.context;
+
+
+import java.beans.Beans;
+import java.beans.beancontext.BeanContextServices;
+import javax.servlet.ServletContext;
+//import javax.ejb.EJBContext;
+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
+ */
+
+public class DriveServiceGetter
+{
+ public static String ENV_SERVLET="servlet container";
+ public static String ENV_EJB="ejb container";
+ public static String ENV_JAVA="java environment";
+
+ private ServiceGetterBean myControl;
+ private boolean inJavaEnv=false;
+ private boolean inServletContainer=false;
+ private boolean inEJBContainer=false;
+
+ public void setControl(ServiceGetterBean aControl){
+
+ myControl=aControl;
+ }
+
+ public void setTestEnv(boolean javaEnv,boolean servletEnv, boolean
ejbEnv){
+ inJavaEnv=javaEnv;
+ inServletContainer=servletEnv;
+ inEJBContainer=ejbEnv;
+ }
+
+ public Report doTest(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else if(!(inJavaEnv||inServletContainer||inEJBContainer)){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Test environment is not specified.
Please set "+
+ "specify if the test is in servlet container,
ejb container "+
+ "or java environment only");
+ }
+ {
+ if (inEJBContainer)
+ report=doEJBcontainerTest();
+ else if(inServletContainer)
+ report= doServletContainerTest();
+ else
+ report= doJavaEnvTest();
+ }
+ return report;
+ }
+ private Report doJavaEnvTest(){
+
+ Report report=new Report();
+
+ String
beanContext=myControl.getService(BeanContextServices.class, null);
+ String
servletContext=myControl.getService(ServletContext.class, null);
+ //String ejbContext=serviceGetter.getService(EJBContext.class,
null);
+
+ if (beanContext.equals("0") && servletContext.equals("-1"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("get
BeanContextServices:"+beanContext+
+ "get ServletContext:"+servletContext);
+ }
+
+ return report;
+ }
+
+ private Report doServletContainerTest(){
+
+ Report report=new Report();
+
+ String
beanContext=myControl.getService(BeanContextServices.class, null);
+ String
servletContext=myControl.getService(ServletContext.class, null);
+ //String ejbContext=serviceGetter.getService(EJBContext.class,
null);
+
+ if (beanContext.equals("0") && servletContext.equals("0"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("get
BeanContextServices:"+beanContext+
+ "get ServletContext:"+servletContext);
+ }
+
+ return report;
+ }
+
+ private Report doEJBcontainerTest(){
+
+ Report report=new Report();
+
+ String
beanContext=myControl.getService(BeanContextServices.class, null);
+ String
servletContext=myControl.getService(ServletContext.class, null);
+ //String ejbContext=serviceGetter.getService(EJBContext.class,
null);
+
+ if (beanContext.equals("0") && servletContext.equals("0"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("get
BeanContextServices:"+beanContext+
+ "get ServletContext:"+servletContext);
+ }
+
+ return report;
+
+ }
+
+}
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveBeanRecorder.java
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveBeanRecorder.java
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,48 @@
+package org.apache.beehive.controls.test.driver.contextevent;
+
+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
+ */
+
+public class DriveBeanRecorder
+{
+
+ private RecorderBean myControl;
+
+ public void setControl(RecorderBean aControl){
+
+ myControl=aControl;
+ }
+
+
+ public Report doTest(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the custom control is NULL");
+ }
+ else{
+ /**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 }; });
+ */
+
+ /* Before CR190273 is fixed, just simply fail this
test*/
+
+ report.setStatus(Report.FAIL);
+ report.setMessage("Failed by CR190273. Please check the
latest development");
+ }
+
+ return report;
+ }
+}
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,44 @@
+package org.apache.beehive.controls.test.driver.contextevent;
+
+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
+ */
+
+public class DriveRecorder
+{
+
+ private RecorderBean myControl;
+
+ public void setControl(RecorderBean aControl){
+
+ myControl=aControl;
+ }
+
+
+ public Report doTest(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the custom control is NULL");
+ }
+ else{
+
+ String record=myRecorder.getRecord();
+
+ if record.equals("onCreateonInstantiate");
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("The events recorded by
control impl:"+record);
+ }
+ }
+
+ return report;
+ }
+}
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event/DriveListener.java
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/event/DriveListener.java
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,94 @@
+package org.apache.beehive.controls.test.driver.event;
+
+import org.apache.beehive.test.tools.milton.common.Report;
+import org.apache.beehive.controls.test.controls.event.Hello;
+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
+ */
+
+public class DriveListener
+{
+
+ private HelloBean myControl;
+
+ private boolean innerClassReceiveEvent=false;
+ private Event2Listener event2listener;
+
+ public void setControl(HelloBean aControl){
+
+ myControl=aControl;
+ }
+
+
+ public Report doTest(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the custom control is NULL");
+ }
+ else{
+ try{
+ /*Register an inner class as listener for event1*/
+ myControl.addEventSet1Listener(
+ new Hello.EventSet1()
+ {
+ public void method1()
+ {
+ innerClassReceiveEvent=true;
+ }
+ });
+
+ /* Creates a listener for event2 and register
it*/
+ event2listener=new Event2Listener();
+ myControl.addEventSet2Listener(event2listener);
+
+ /* Invokes methods on myHelloBean to trigger
the events*/
+ myControl.triggerEvents();
+
+ report.setStatus(Report.PASS);
+ }
+ catch(Exception e){
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+ }
+ }
+
+ return report;
+ }
+
+ public Report verifyResult(){
+
+ Report report=new Report();
+ String failuredetail="";
+ if (!innerClassReceiveEvent){
+ report.setStatus(Report.FAIL);
+ failuredetail="Innner Class didn't receive event.";
+ }
+
+ if (event2listener==null){
+ report.setStatus(Report.FAIL);
+ failuredetail=failuredetail+"Event2Listerner is NULL";
+ }
+ else{
+ String listenerResult=event2listener.getAllResult();
+
+ if (listenerResult.equals("0000"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ failuredetail=failuredetail+"Listener
Result:"+listenerResult;
+ }
+
+ }
+ report.setMessage(failuredetail);
+
+ return report;
+ }
+
+}
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,293 @@
+package org.apache.beehive.controls.test.driver.extension;
+
+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
+ */
+
+public class DriveSubControl
+{
+
+ private SubControlBean myControl;
+
+ public void setControl(SubControlBean aControl){
+
+ myControl=aControl;
+ }
+
+ public Report doInvokeInheritedMethod(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ String s=myControl.hello();
+ if (s.equals("Hello from super control"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ }
+ return report;
+ }
+
+ public Report doInvokeExtendedMethod(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ String s=myControl.hello2();
+ if (s.equals("Hello from subcontrol"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ }
+ return report;
+ }
+
+ public Report doGetInheritedPropertyByContext(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ String s=myControl.accessInheritedProperty();
+ if (s.equals("In_ExtensibleControl_Interface"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ }
+ return report;
+ }
+
+ public Report doGetInheritedPropertyByGetter(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ /*
+ String s=myControl.getWhereaboutPosition();
+ if (s.equals("In_ExtensibleControl_Interface"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ */
+ /* BUG: getter/setter in generated bean class is busted!
+ Just fail this test until it is fixed*/
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter is
broken. Check the latest development please.");
+ }
+ return report;
+ }
+
+ public Report doSetInheritedPropertyBySetter(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ /*
+ myControl.setWhereaboutPosition("new position");
+ String s=myControl.accessInheritedProperty();
+ if (s.equals("new position"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ */
+ /* BUG: getter/setter in generated bean class is busted!
+ Just fail this test until it is fixed*/
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter is
broken. Check the latest development please.");
+ }
+ return report;
+ }
+
+ public Report doGetReconfiguredPropertyByGetter(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ /*
+ String s=myControl.getWhereAboutLayer();
+ if (s.equals("On_SubControl_Interface_Layer"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ */
+ /* BUG: getter/setter in generated bean class is busted!
+ Just fail this test until it is fixed*/
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter is
broken. Check the latest development please.");
+ }
+ return report;
+ }
+
+ public Report doSetReconfiguredPropertyBySetter(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ /*
+ myControl.getWhereAboutLayer("new layer");
+ String s=myControl.getLayerByContext();
+ if (s.equals("new position"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ */
+ /* BUG: getter/setter in generated bean class is busted!
+ Just fail this test until it is fixed*/
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter is
broken. Check the latest development please.");
+ }
+ return report;
+ }
+
+
+ public Report doGetReconfiguredPropertyByContext(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ String s=myControl.getLayerByContext();
+ if (s.equals("On_SubControl_Interface_Layer"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ }
+ return report;
+ }
+
+
+ public Report doGetExtendedPropertyByContext(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+
+ /* BUG: extended method declared on sub control could
not be invoked
+ * should add a new method on SubControl to allow
getting extended
+ * property via control context.
+ *
+ * Just fail this test until the bug is fixed.
+ */
+ report.setStatus(Report.FAIL);
+ report.setMessage("Bug:extended method could not be
invoked."+
+ " Check the latest development please.");
+ }
+ return report;
+ }
+
+ public Report doGetExtendedPropertyByGetter(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ /*
+ String s=myControl.getNewPropertyMessage();
+ if (s.equals("New Property Declared by Sub Control"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ */
+ /* BUG: getter/setter in generated bean class is busted!
+ Just fail this test until it is fixed*/
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter is
broken. Check the latest development please.");
+ }
+ return report;
+ }
+
+ public Report doSetExtendedPropertyBySetter(){
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else {
+ /*
+ String s=myControl.setNewPropertyMessage("new message
for new property");
+ if (s.equals("On_SubControl_Interface_Layer"))
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage(s);
+ }
+ */
+ /* BUG: getter/setter in generated bean class is busted!
+ Just fail this test until it is fixed*/
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control bean getter/setter is
broken. Check the latest development please.");
+ }
+ return report;
+ }
+
+/*
+ public Report doInvokeOverwrittenMethod(){
+
+ Report report=new Report();
+
+ return report;
+ }
+*/
+
+}
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/eventhandler/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/eventhandler/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,125 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 event.eventhandler;
+
+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.api.events.EventHandler;
+import org.apache.beehive.controls.test.controls.event.HelloBean;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test receiving events raised by a control using EventHandler annotations
+ * The control is instantiated declaratively
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public HelloBean myHelloBean;
+
+ private boolean eventSet1Received=false;
+ private boolean eventSet2Received=false;
+
+ /** EventHandler that receives EventSet1 from myHelloBean*/
+ @EventHandler (field="myHelloBean", eventSet= HelloBean.EventSet1.class,
+ eventName="method1")
+ public void myHelloBeanMessageHandler()
+ {
+ /*
+ System.out.println("***************************************");
+ System.out.println("event receive! nothing received");
+ System.out.println("***************************************");
+ */
+
+ eventSet1Received=true;
+ }
+
+
+ /** EventHandler that receives EventSet2 from myHelloBean*/
+ @EventHandler (field="myHelloBean", eventSet= HelloBean.EventSet2.class,
eventName="set2Method2")
+ public void myHelloBeanMessageHandler2()
+ {
+ /*
+
System.out.println("***************************************************");
+ System.out.println("event2 receive!");
+
System.out.println("***************************************************");
+ */
+
+ eventSet2Received=true;
+ }
+
+
+
+
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ //Invoke method on myHelloBean to trigger the events
+
+ Report report=new Report();
+
+ try{
+ myHelloBean.triggerEvents();
+ report.setStatus(Report.PASS);
+ }
+ catch(Exception e){
+ report.setStatus(Report.FAIL);
+ report.setExceptionStack(e);
+
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward verifyResult(){
+
+ Report report=new Report();
+
+ if (eventSet1Received && eventSet2Received)
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+
+ String detail="";
+ if (!eventSet1Received)
+ detail="EventSet1 is not received.";
+ if (!eventSet2Received)
+ detail=detail+"EventSet2 is not received.";
+ report.setMessage(detail);
+ }
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/listener/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/event/listener/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,62 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 event.listener;
+
+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.contextevent.RecorderBean;
+import org.apache.beehive.controls.test.driver.contextevent.DriveRecorder;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test receiving events raised by a control using a registered listener
+ * The control is instantiated declaratively
+ */
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public RecorderBean recorder;
+
+ /**
+ * @jpf:action
+ */
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+
+ DriveRecorder driver=new DriveRecorder();
+ driver.setControl(recorder);
+ Report report=driver.doTest();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+}
+
+
Added:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
Wed Aug 11 17:40:04 2004
@@ -0,0 +1,189 @@
+/*
+ * B E A S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2002 BEA Systems, Inc.
+ *
+ * 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 extension;
+
+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.extension.SubControlBean;
+import org.apache.beehive.controls.test.driver.extension.DriveSubControl;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* Test control inheritance by invoking methods on a sub control instance*/
+
[EMAIL PROTECTED](
+ forwards = {
+ @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP)
+ })
+public class Controller extends PageFlowController
+{
+
+ @Control
+ public SubControlBean subcontrol;
+
+
+ @Jpf.Action(
+ )
+ protected Forward begin(){
+ /*
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(hellobean);
+ Report report=driver.doTest();
+ */
+ Report report =new Report();
+ report.setStatus(Report.PASS);
+ report.setMessage("This is a bogus test.");
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testInheritedMethod(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doInvokeInheritedMethod();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testExtendedMethod(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doInvokeExtendedMethod();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testGetInheritedPropertyByContext(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doGetInheritedPropertyByContext();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testGetInheritedPropertyByGetter(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doGetInheritedPropertyByGetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testSetInheritedPropertyBySetter(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doSetInheritedPropertyBySetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testGetReconfiguredPropertyByContext(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doGetReconfiguredPropertyByContext();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testGetReconfiguredPropertyByGetter(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doGetReconfiguredPropertyByGetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testSetReconfiguredPropertyBySetter(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doSetReconfiguredPropertyBySetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testGetExtendedPropertyByContext(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doGetExtendedPropertyByContext();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testGetExtendedPropertyByGetter(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doGetExtendedPropertyByGetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ @Jpf.Action(
+ )
+ protected Forward testSetExtendedPropertyBySetter(){
+
+ DriveSubControl driver=new DriveSubControl();
+ driver.setControl(subcontrol);
+ Report report=driver.doSetExtendedPropertyBySetter();
+
+ return new Forward(Report.RESULTS, Report.KEY, report);
+ }
+
+ /*
+ protected Forward testInvokeOverwrittenMethod(){
+
+ }
+ */
+
+}
+
+
Modified:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/resources/milton/jsp/miltonResultsTemplate.jsp
==============================================================================
---
incubator/beehive/trunk/controls/test/webapps/controlsWeb/resources/milton/jsp/miltonResultsTemplate.jsp
(original)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/resources/milton/jsp/miltonResultsTemplate.jsp
Wed Aug 11 17:40:04 2004
@@ -5,7 +5,7 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ page import="org.apache.beehive.test.tools.milton.common.Report;"%>
+<%@ page import="org.apache.beehive.test.tools.milton.common.Report"%>
<%@ page import="org.apache.beehive.netui.pageflow.PageFlowUtils"%>
<% Report report = (Report)PageFlowUtils.getPageInput(Report.KEY, request); %>