James--

Hey; just a note on some of the files below (and other tests which have gone in recently).

They're missing the ASF license / copyright. Could you take that from another source or XML file and make sure it's in all of your source files? If it helps, there's an instance in beehive/trunk/build.xml.

  Thanks!

Eddie



[EMAIL PROTECTED] wrote:
Author: jsong
Date: Thu May 12 21:24:50 2005
New Revision: 169933

URL: http://svn.apache.org/viewcvs?rev=169933&view=rev
Log:
Add a test on serialization of a control instantiated declaratively.

Added:
    
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java
Modified:
    
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/Test.java

Added: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java?rev=169933&view=auto
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java
 Thu May 12 21:24:50 2005
@@ -0,0 +1,87 @@
+package org.apache.beehive.controls.test.java.s13n;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.test.controls.serialization.HelloControl;
+import 
org.apache.beehive.controls.test.controls.serialization.HelloControlBean;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
+
+import org.apache.beehive.controls.test.controls.util.TestBeanContext;
+
+/**
+ * Test serialization of a controls instantiated declaratively
+ */
[EMAIL PROTECTED]("detailed")
+public class DeclarativeTest extends TestCase
+{
+
+    private TestBeanContext _testContext;
+
+       /**
+        * A simple control with one method, no property declared
+        */
+    @Control
+    private HelloControlBean myHelloBean;
+
+    public DeclarativeTest(String name) throws Exception
+    {
+               super(name);
+       _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
+
+
+    public void testWriteRead() throws Exception
+    {
+               myHelloBean.setQuantity(100);
+               myHelloBean.setName("TheName");
+               myHelloBean.changeTransient("A different value");
+
+               try{
+                       FileOutputStream   fos = new 
FileOutputStream("objects2.ser");
+                       ObjectOutputStream oos = new ObjectOutputStream( fos );
+
+                       oos.writeObject(myHelloBean);
+
+                       //To read them back in, reverse the process with:
+
+                       FileInputStream fis = new FileInputStream( 
"objects2.ser");
+                       ObjectInputStream ois = new ObjectInputStream( fis );
+
+                       HelloControlBean hc2 = 
(HelloControlBean)ois.readObject();
+                       int qty=hc2.getQuantity();
+                       String name=hc2.getName();
+                       String theTransient=hc2.getTransient();
+
+                       Assert.assertEquals(100,qty);
+                       Assert.assertEquals("TheName",name);
+                       Assert.assertEquals(null,theTransient);
+
+               }
+               catch(IOException e){
+                       e.printStackTrace();
+                       fail(e.getMessage());
+               }
+
+    }
+}
\ No newline at end of file

Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/Test.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/Test.java?rev=169933&r1=169932&r2=169933&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/Test.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/Test.java Thu May 12 21:24:50 2005
@@ -15,12 +15,7 @@
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
/**
- * A TestCase that tests control composition.
- * The outer control is instantiated declaratively, and the outer
- * control instantiates the nested control declaratively
- *
- * Instantiating controls declaratively is not supported currently.
- * All tests are deactivated until this is supported
+ * Test serialization of a control instantiated programmatically.
*/
@Freq("detailed")
public class Test extends TestCase







Reply via email to