Author: jsong
Date: Thu Jul 29 12:01:09 2004
New Revision: 30937
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty.java
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty2.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java
Log:
adding tests to instantiate controls with property values.
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty.java
==============================================================================
---
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty.java
(original)
+++
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty.java
Thu Jul 29 12:01:09 2004
@@ -19,7 +19,7 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface Greeting
{
- String GreetWord() default GREET_DEFAULT;
+ public String GreetWord() default GREET_DEFAULT;
}
public String sayHello();
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty2.java
==============================================================================
---
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty2.java
(original)
+++
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/SingleProperty2.java
Thu Jul 29 12:01:09 2004
@@ -20,7 +20,7 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface Greeting
{
- String GreetWord() default GREET_DEFAULT;
+ public String GreetWord() default GREET_DEFAULT;
}
public String sayHello();
Modified:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java
==============================================================================
---
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java
(original)
+++
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java
Thu Jul 29 12:01:09 2004
@@ -7,13 +7,29 @@
import org.apache.beehive.controls.api.bean.ControlBean;
import org.apache.beehive.controls.test.controls.instantiate.HelloControlBean;
+import org.apache.beehive.controls.test.controls.properties.SinglePropertyBean;
+import org.apache.beehive.controls.test.controls.properties.SingleProperty;
+/**
+ * Tests instantiating controls in different ways
+ */
public class TestInstantiate extends TestCase
{
-
+ /**
+ * A simple control with one method, no property declared
+ */
@Control
public HelloControlBean myHelloBean;
+ /*BUG:? can not refer to Greeting directly ControlProgramming.html
needs update??*/
+
+ /**
+ * A simple control with one property declared
+ * Resets the property value at declaration
+ */
+ @Control
+ @SingleProperty.Greeting(GreetWord="Good evening!")
+ public SinglePropertyBean myPropertyBean;
public TestInstantiate(String s) { super(s); }
@@ -37,6 +53,28 @@
{
Assert.assertNotNull(myHelloBean);
Assert.assertEquals(myHelloBean.hello("Bob"),"Bob");
+ }
+
+ public void testDeclareWithProperty() throws Exception
+ {
+ Assert.assertNotNull(myPropertyBean);
+ Assert.assertEquals(myPropertyBean.sayHello(),"Good evening!");
+ }
+
+ /** Instantiates a control and reset the property value*/
+ public void testProgrammWithProperty() throws Exception
+ {
+ /*BUG:CR190302
+
+ PropertyMap greetAttr = new
(PropertyMap(SingleProperty.Greeting.class);
+ greetAttr.setProperty("GreetWord","Good afternoon!");
+ SinglePropertyBean spbean = (SinglePropertyBean)
+ Controls.instantiate(cl,
"org.apache.beehive.controls.test.controls.properties.SinglePropertyBean",
greetAttr);
+
+
+ Assert.assertNotNull(spbean);
+ Assert.assertEquals(spbean.sayHello(),"Good afternoon!");
+ */
}
}