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/10/12 04:01:46 UTC
svn commit: rev 54642 - in incubator/beehive/trunk/controls/test/src: controls/org/apache/beehive/controls/test/controls/packaging drivers/org/apache/beehive/controls/test/driver/packaging units/org/apache/beehive/controls/test/java/packaging
Author: jsong
Date: Mon Oct 11 19:01:45 2004
New Revision: 54642
Added:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/packaging/FeatureInfoControl.java (contents, props changed)
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/packaging/FeatureInfoControlImpl.jcs (contents, props changed)
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java (contents, props changed)
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/packaging/
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/packaging/DriveFeatureInfo.java (contents, props changed)
Log:
Add controls, drivers and junit tests for controls packaging.
checkin.tests passed on WinXP.
code reviewed by Nikhil Gore.
Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/packaging/FeatureInfoControl.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/packaging/FeatureInfoControl.java Mon Oct 11 19:01:45 2004
@@ -0,0 +1,40 @@
+package org.apache.beehive.controls.test.controls.packaging;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.api.packaging.FeatureAttribute;
+
+/**
+ * A control interface with FeatureInfo annotations
+ */
+
+@ControlInterface
+@FeatureInfo(
+ displayName="A Control to test packaging",
+ shortDescription="This control is to test control packaging",
+ isExpert=true,
+ isHidden=true,
+ isPreferred=true,
+ attributes={
+ @FeatureAttribute(name="FirstFeatureOfThisControl",value="valueOf the first feature"),
+ @FeatureAttribute(name="SecondFeatureOfThisControl",value="valueOf the second feature")
+ }
+
+ )
+public interface FeatureInfoControl
+{
+
+ @FeatureInfo(
+ displayName="The only method on this control",
+ shortDescription="The feature info about the method on the control",
+ isExpert=true,
+ isHidden=true,
+ isPreferred=true,
+ attributes={
+ @FeatureAttribute(name="FirstFeatureOfThisMethod",value="valueOf the first feature of the method"),
+ @FeatureAttribute(name="SecondFeatureOfThisMethod",value="valueOf the second feature of the method")
+ }
+
+ )
+ public String hello(String input);
+}
\ No newline at end of file
Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/packaging/FeatureInfoControlImpl.jcs
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/packaging/FeatureInfoControlImpl.jcs Mon Oct 11 19:01:45 2004
@@ -0,0 +1,15 @@
+package org.apache.beehive.controls.test.controls.packaging;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+/**
+ * A simple control impl
+ */
+@ControlImplementation
+public class FeatureInfoControlImpl implements FeatureInfoControl
+{
+ public String hello(String input)
+ {
+ return input;
+ }
+}
Added: incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java Mon Oct 11 19:01:45 2004
@@ -0,0 +1,74 @@
+package org.apache.beehive.controls.test.driver.packaging;
+
+import org.apache.beehive.controls.test.controls.packaging.FeatureInfoControlBeanBeanInfo;
+import java.beans.BeanDescriptor;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* This class contains the logic to test FeatureInfo annotation of control packaging.
+ *
+ * FeatureInfo annotations on control interface shall be written into control beaninfo
+ * class during control packaging process.
+ * The tests in this class will get feature info from control beaninfo class in
+ * order to make sure this part of packaging process works fine.
+ */
+
+public class DriveFeatureInfo
+{
+
+ /*Gets class level feature info from Hello2ControlBeanBeanInfo class*/
+ public Report doGetClassLevelFeatureInfo(){
+
+ Report report=new Report();
+
+ FeatureInfoControlBeanBeanInfo hello2BeanInfo=new FeatureInfoControlBeanBeanInfo();
+ BeanDescriptor descriptor=hello2BeanInfo.getBeanDescriptor();
+ String name=descriptor.getName();
+ String displayName=descriptor.getDisplayName();
+ String shortDescription=descriptor.getShortDescription();
+ boolean isExpert=descriptor.isExpert();
+ boolean isHidden=descriptor.isHidden();
+ boolean isPreferred=descriptor.isPreferred();
+
+ if (!name.equals("FeatureInfoControlBean")){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control name is wrong:"+name);
+ return report;
+ }
+
+ if (!displayName.equals("A Control to test packaging")){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control displaName is wrong:"+displayName);
+ return report;
+ }
+
+ if (!shortDescription.equals("This control is to test control packaging")){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control description is wrong:"+shortDescription);
+ return report;
+ }
+
+ if (!isExpert){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isExpert is FALSE");
+ return report;
+ }
+
+ if (!isHidden){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isHidden is FALSE");
+ return report;
+ }
+
+ if (!isPreferred){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isPreferred is FALSE");
+ return report;
+ }
+
+ report.setStatus(Report.PASS);
+
+ return report;
+
+ }
+
+}
Added: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/packaging/DriveFeatureInfo.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/packaging/DriveFeatureInfo.java Mon Oct 11 19:01:45 2004
@@ -0,0 +1,74 @@
+package org.apache.beehive.controls.test.driver.packaging;
+
+import org.apache.beehive.controls.test.controls.packaging.FeatureInfoControlBeanBeanInfo;
+import java.beans.BeanDescriptor;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+/* This class contains the logic to test FeatureInfo annotation of control packaging.
+ *
+ * FeatureInfo annotations on control interface shall be written into control beaninfo
+ * class during control packaging process.
+ * The tests in this class will get feature info from control beaninfo class in
+ * order to make sure this part of packaging process works fine.
+ */
+
+public class DriveFeatureInfo
+{
+
+ /*Gets class level feature info from Hello2ControlBeanBeanInfo class*/
+ public Report doGetClassLevelFeatureInfo(){
+
+ Report report=new Report();
+
+ FeatureInfoControlBeanBeanInfo hello2BeanInfo=new FeatureInfoControlBeanBeanInfo();
+ BeanDescriptor descriptor=hello2BeanInfo.getBeanDescriptor();
+ String name=descriptor.getName();
+ String displayName=descriptor.getDisplayName();
+ String shortDescription=descriptor.getShortDescription();
+ boolean isExpert=descriptor.isExpert();
+ boolean isHidden=descriptor.isHidden();
+ boolean isPreferred=descriptor.isPreferred();
+
+ if (!name.equals("FeatureInfoControlBean")){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control name is wrong:"+name);
+ return report;
+ }
+
+ if (!displayName.equals("A Control to test packaging")){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control displaName is wrong:"+displayName);
+ return report;
+ }
+
+ if (!shortDescription.equals("This control is to test control packaging")){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control description is wrong:"+shortDescription);
+ return report;
+ }
+
+ if (!isExpert){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isExpert is FALSE");
+ return report;
+ }
+
+ if (!isHidden){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isHidden is FALSE");
+ return report;
+ }
+
+ if (!isPreferred){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isPreferred is FALSE");
+ return report;
+ }
+
+ report.setStatus(Report.PASS);
+
+ return report;
+
+ }
+
+}