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/16 22:23:19 UTC

svn commit: r122584 - /incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java

Author: jsong
Date: Thu Dec 16 13:23:16 2004
New Revision: 122584

URL: http://svn.apache.org/viewcvs?view=rev&rev=122584
Log:
Activate more tests on instantiating controls declaratively in java container.

Modified:
   incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java

Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java?view=diff&rev=122584&p1=incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java&r1=122583&p2=incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java&r2=122584
==============================================================================
--- 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 Dec 16 13:23:16 2004
@@ -2,6 +2,7 @@
 
 import junit.framework.TestCase;
 import java.beans.Beans;
+import java.lang.Integer;
 import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.controls.api.bean.Controls;
 import org.apache.beehive.controls.api.bean.ControlBean;
@@ -19,6 +20,8 @@
 import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
 import org.apache.beehive.test.tools.milton.common.Report;
 
+import org.apache.beehive.controls.test.controls.util.TestBeanContext;
+
 
 /**
  * A TestCase that tests instantiating controls in different ways
@@ -27,13 +30,38 @@
 public class TestInstantiate extends TestCase
 {
 	/**
+	 * Ideally, Control user should not need to handle _testContext to instantiate controls declaratively.
+	 * This breaches "same client programming model across different client platform" promise.
+	 */
+
+    //Start of unique client programming to instantiate controls declaratively in java container
+    private TestBeanContext _testContext;
+
+    public TestInstantiate(String s)throws Exception {
+
+		super(s);
+    	_testContext = new TestBeanContext();
+        org.apache.beehive.controls.api.bean.Controls.initializeClient( null, this, _testContext );
+
+	}
+
+    public void setUp() throws Exception
+    {
+        _testContext.beginContext();
+    }
+
+    public void tearDown() throws Exception
+    {
+        _testContext.endContext();
+    }
+	//End of unique client programming to instantiate controls declaratively in java container
+
+	/**
 	 * 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
@@ -42,8 +70,6 @@
     @SingleProperty.Greeting(GreetWord="Good evening!")
     public SinglePropertyBean myPropertyBean;
 
-    public TestInstantiate(String s) { super(s); }
-
     /**
      * Tests instantiating a custom control programmatically
      */
@@ -66,7 +92,7 @@
      * Tests instantiating a custom control declaratively
      */
 	@Freq("checkin")
-    @Status("inactive")
+    @Status("active")
     public void testDeclarativeInstantiation() throws Exception
     {
 		Report report=new Report();
@@ -84,7 +110,7 @@
      */
 
 	@Freq("detailed")
-    @Status("inactive")
+    @Status("active")
     public void testDeclareWithProperty() throws Exception
     {
 		Report report=new Report();
@@ -126,19 +152,16 @@
 	 * Tests programmically instantiating a control with an external declared propertySet
 	 */
 	@Freq("detailed")
-	@Status("inactive")
+	@Status("active")
     public void testProgramWithExtProperty() throws Exception
     {
 
-		/*
-		We hit another problem here: reset primitive value property using Controls
-		Right now, BeanPropertyMap.setProperty does not allow resetting primitive value.
-
-
+		/* Not sure how to reconfigure primitive property using Controls.
+			Currently, BeanPropertyMap.setProperty() does not support primitive mapping */
 		Report report=new Report();
 
 		BeanPropertyMap greetAttr = new BeanPropertyMap(BoundExtPropertySet.class);
-		greetAttr.setProperty(BoundPropertyControlBean.AgeKey,10);
+		greetAttr.setProperty(BoundPropertyControlBean.AgeKey,Integer.valueOf(10));
 		BoundPropertyControlBean bbean = (BoundPropertyControlBean)Controls.instantiate(
 			Thread.currentThread().getContextClassLoader(),
 			"org.apache.beehive.controls.test.controls.property.BoundPropertyControlBean",
@@ -150,7 +173,7 @@
 		String result=report.getStatus();
 		if (!result.equals(Report.PASS))
 			fail(report.getMessage());
-		*/
+
     }
 
 }