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/12/15 04:34:46 UTC
svn commit: r111928 - in incubator/beehive/trunk/controls/test: src/controls/org/apache/beehive/controls/test/controls/property src/drivers/org/apache/beehive/controls/test/driver/property src/units/org/apache/beehive/controls/test/jws/property webapps/controlsWeb/WEB-INF/src/jws
Author: jsong
Date: Tue Dec 14 19:34:45 2004
New Revision: 111928
URL: http://svn.apache.org/viewcvs?view=rev&rev=111928
Log:
Add two checkin.tests to test bound/constrained external declared propertySet.
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java
incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java?view=diff&rev=111928&p1=incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java&r1=111927&p2=incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java&r2=111928
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/property/BoundPropertyControl.java Tue Dec 14 19:34:45 2004
@@ -3,13 +3,16 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.bean.ExternalPropertySets;
import org.apache.beehive.controls.api.packaging.PropertyInfo;
import org.apache.beehive.controls.api.properties.PropertySet;
+
/**
* A control interface with bound and/or constrain propertySet
*/
@ControlInterface
+@ExternalPropertySets({BoundExtPropertySet.class})
public interface BoundPropertyControl
{
static final String BRAND_DEFAULT = "DEFAULT_BRAND";
Modified: incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java?view=diff&rev=111928&p1=incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java&r1=111927&p2=incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java&r2=111928
==============================================================================
--- incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java (original)
+++ incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyInfo.java Tue Dec 14 19:34:45 2004
@@ -103,6 +103,60 @@
}
+ /* If a constrained property change is veto-ed, the property should not be changed
+ * And a PropertyVetoException should be caught.
+ */
+ public Report doVetoChangeOnConstrainedExtProperty(){
+
+ propertyChanged=false;
+ vetoExceptionCaught=false;
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else
+ {
+ // Create a new test listener and register it on the test bean
+ ChangeTestListener ctl = new ChangeTestListener();
+ myControl.addPropertyChangeListener(ctl);
+
+ // Create a new test listener and register it on the test bean
+ VetoableTestListener vtl = new VetoableTestListener();
+ myControl.addVetoableChangeListener(vtl);
+
+ try{
+ myControl.setHeight(7.9f);
+ }
+ catch(PropertyVetoException e){vetoExceptionCaught=true;}
+
+ if (vetoExceptionCaught){
+ if (propertyChanged){
+ report.setStatus(Report.FAIL);
+ report.setMessage("PropertyChanged listener is invoked");
+ }
+ else{
+ float height=myControl.getHeight();
+
+ if (height==0.0f)
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("Property value changed to:"+height+
+ ". Although PropertyChangedEvent not received.");
+ }
+ }
+ }
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("PropertyVetoException not caught");
+ }
+ }
+ return report;
+ }
+
/* Change on unconstrained property should go succeed.*/
public Report doVetoChangeOnUnConstrainedProperty(){
@@ -151,4 +205,54 @@
}
return report;
}
+
+
+ /* Change on unconstrained property should go succeed.*/
+ public Report doVetoChangeOnUnConstrainedExtProperty(){
+
+ propertyChanged=false;
+ vetoExceptionCaught=false;
+
+ Report report=new Report();
+
+ if (myControl==null){
+ report.setStatus(Report.FAIL);
+ report.setMessage("the control is NULL");
+ }
+ else
+ {
+ // Create a new test listener and register it on the test bean
+ ChangeTestListener ctl = new ChangeTestListener();
+ myControl.addPropertyChangeListener(ctl);
+
+ // Create a new test listener and register it on the test bean
+ VetoableTestListener vtl = new VetoableTestListener();
+ myControl.addVetoableChangeListener(vtl);
+
+ myControl.setAge(22);
+
+ if (!vetoExceptionCaught){
+ if (!propertyChanged){
+ report.setStatus(Report.FAIL);
+ report.setMessage("PropertyChanged listener is NOT invoked");
+ }
+ else{
+ int age=myControl.getAge();
+
+ if (age==22)
+ report.setStatus(Report.PASS);
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("Property is changed to an unexpected value.");
+ }
+ }
+ }
+ else{
+ report.setStatus(Report.FAIL);
+ report.setMessage("PropertyVetoException is caught");
+ }
+ }
+ return report;
+ }
+
}
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java?view=diff&rev=111928&p1=incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java&r1=111927&p2=incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java&r2=111928
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jws/property/TestProperty.java Tue Dec 14 19:34:45 2004
@@ -93,4 +93,22 @@
{
assertReport("http://localhost:8080/controlsWeb/jws/Property.jws","testVetoChangeOnUnConstrainedProperty");
}
+
+ /**
+ * Tests vetoing change made to a constrained property, the property is declared externally
+ */
+ @Freq("checkin")
+ public void testVetoChangeOnConstrainedExtProperty() throws Exception
+ {
+ assertReport("http://localhost:8080/controlsWeb/jws/Property.jws","testVetoChangeOnConstrainedExternalProperty");
+ }
+
+ /**
+ * Tests vetoing change made to an uncontrained property.the property is declared externally
+ */
+ @Freq("checkin")
+ public void testVetoChangeOnUnConstrainedExtProperty() throws Exception
+ {
+ assertReport("http://localhost:8080/controlsWeb/jws/Property.jws","testVetoChangeOnUnConstrainedExternalProperty");
+ }
}
Modified: incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws?view=diff&rev=111928&p1=incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws&r1=111927&p2=incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws&r2=111928
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws (original)
+++ incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jws/Property.jws Tue Dec 14 19:34:45 2004
@@ -194,9 +194,20 @@
return report;
}
-
/*
- * Test veto-ing a the change on a unconstrained property
+ * Test veto-ing a the change on a constrained property
+ */
+ @WebMethod
+ public Report testVetoChangeOnConstrainedExternalProperty()
+ {
+ Report report=new Report();
+ DrivePropertyInfo driver=new DrivePropertyInfo();
+ driver.setControl(myBoundPropertyControl);
+ report=driver.doVetoChangeOnConstrainedExtProperty();
+ return report;
+ }
+ /*
+ * Test veto-ing a the change on a constrained property
*/
@WebMethod
public Report testVetoChangeOnUnConstrainedProperty()
@@ -205,6 +216,19 @@
DrivePropertyInfo driver=new DrivePropertyInfo();
driver.setControl(myBoundPropertyControl);
report=driver.doVetoChangeOnUnConstrainedProperty();
+ return report;
+ }
+
+ /*
+ * Test veto-ing a the change on a unconstrained property
+ */
+ @WebMethod
+ public Report testVetoChangeOnUnConstrainedExternalProperty()
+ {
+ Report report=new Report();
+ DrivePropertyInfo driver=new DrivePropertyInfo();
+ driver.setControl(myBoundPropertyControl);
+ report=driver.doVetoChangeOnUnConstrainedExtProperty();
return report;
}