Author: jsong
Date: Tue Oct 12 13:19:48 2004
New Revision: 54693
Modified:
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java
Log:
Update controls test on packaging. Using Introspector to get BeanInfo class
instead of getting it directly.
Modified:
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java
==============================================================================
---
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java
(original)
+++
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/packaging/DriveFeatureInfo.java
Tue Oct 12 13:19:48 2004
@@ -1,7 +1,10 @@
package org.apache.beehive.controls.test.driver.packaging;
-import
org.apache.beehive.controls.test.controls.packaging.FeatureInfoControlBeanBeanInfo;
+import java.lang.Class;
+import java.beans.BeanInfo;
+import java.beans.Introspector;
import java.beans.BeanDescriptor;
+import
org.apache.beehive.controls.test.controls.packaging.FeatureInfoControlBean;
import org.apache.beehive.test.tools.milton.common.Report;
/* This class contains the logic to test FeatureInfo annotation of control
packaging.
@@ -19,53 +22,54 @@
public Report doGetClassLevelFeatureInfo(){
Report report=new Report();
+ report.setStatus(Report.PASS);
- 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;
- }
+ try{
+ BeanInfo
beanInfo=Introspector.getBeanInfo(Class.forName(
+
"org.apache.beehive.controls.test.controls.packaging.FeatureInfoControlBean"));
+ BeanDescriptor descriptor=beanInfo.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);
+ }
+
+ if
((report.getStatus().equals(Report.PASS))&&(!displayName.equals("A Control to
test packaging"))){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control displaName is
wrong:"+displayName);
+ }
+
+ if
((report.getStatus().equals(Report.PASS))&&(!shortDescription.equals("This
control is to test control packaging"))){
+ report.setStatus(Report.FAIL);
+ report.setMessage("Control description is
wrong:"+shortDescription);
+ }
+
+ if
((report.getStatus().equals(Report.PASS))&&(!isExpert)){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isExpert is FALSE");
+ }
+
+ if
((report.getStatus().equals(Report.PASS))&&(!isHidden)){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isHidden is FALSE");
+ }
+
+ if
((report.getStatus().equals(Report.PASS))&&(!isPreferred)){
+ report.setStatus(Report.FAIL);
+ report.setMessage("isPreferred is FALSE");
+ }
- if (!isHidden){
- report.setStatus(Report.FAIL);
- report.setMessage("isHidden is FALSE");
- return report;
}
-
- if (!isPreferred){
+ catch(Exception e){
report.setStatus(Report.FAIL);
- report.setMessage("isPreferred is FALSE");
- return report;
+ report.setExceptionStack(e);
}
-
- report.setStatus(Report.PASS);
return report;