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 2005/05/25 01:37:49 UTC
svn commit: r178324 - in /incubator/beehive/trunk/controls/test/src:
controls/org/apache/beehive/controls/test/controls/extension/
units/org/apache/beehive/controls/test/java/event/
units/org/apache/beehive/controls/test/java/s13n/
Author: jsong
Date: Tue May 24 16:37:47 2005
New Revision: 178324
URL: http://svn.apache.org/viewcvs?rev=178324&view=rev
Log:
Minor update of controls tests:
1. Close input stream and output stream at the end of test;
2. Remove un-necessary System.out;
3. Remove "Transient='true'" from ExtensibleControlImpl.jcs.
drt passed.
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/ExtensibleControlImpl.jcs
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/EventHandlerTest.java
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/ExtensibleControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/ExtensibleControlImpl.jcs?rev=178324&r1=178323&r2=178324&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/ExtensibleControlImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/ExtensibleControlImpl.jcs Tue May 24 16:37:47 2005
@@ -18,6 +18,7 @@
package org.apache.beehive.controls.test.controls.extension;
+import java.io.Serializable;
import java.lang.reflect.Method;
import org.apache.beehive.controls.api.context.Context;
import org.apache.beehive.controls.api.context.ControlBeanContext;
@@ -29,8 +30,8 @@
* By implementing Extensible, this impl makes itself extensible
*/
-@ControlImplementation(isTransient=true)
-public class ExtensibleControlImpl implements ExtensibleControl, Extensible
+@ControlImplementation
+public class ExtensibleControlImpl implements ExtensibleControl, Extensible,Serializable
{
@Context ControlBeanContext context;
Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs?rev=178324&r1=178323&r2=178324&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs (original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControlImpl.jcs Tue May 24 16:37:47 2005
@@ -29,7 +29,7 @@
* its own interface.
*/
@ControlImplementation
-public class SubControlImpl extends ExtensibleControlImpl
+public class SubControlImpl extends ExtensibleControlImpl
implements SubControl, java.io.Serializable
{
@Context ControlBeanContext context;
Modified: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/EventHandlerTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/EventHandlerTest.java?rev=178324&r1=178323&r2=178324&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/EventHandlerTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/event/EventHandlerTest.java Tue May 24 16:37:47 2005
@@ -67,9 +67,6 @@
public void myHelloBeanMessageHandler()
{
// Invoked with event is received
- System.out.println("***************************************");
- System.out.println("EventSet1 receive!");
- System.out.println("***************************************");
event1Received=true;
}
@@ -81,9 +78,6 @@
public int myHelloBeanMessageHandler2()
{
// Invoked when event is received
- System.out.println("***************************************************");
- System.out.println("EventSet2 receive!");
- System.out.println("***************************************************");
event2Received=true;
return 0;
}
@@ -95,19 +89,10 @@
*/
public void testHandlerReceiveEvents() throws Exception
{
- System.out.println("************************************");
- System.out.println("****** entered TestHandlerReceiveEvents ******");
- System.out.println("************************************");
Assert.assertNotNull(myHellobean);
- System.out.println("************************************");
- System.out.println("****** myHelloBean is valid ******");
- System.out.println("************************************");
/* Invokes the method on the control while will trigger the events*/
try{
myHellobean.triggerEvents();
- System.out.println("************************************");
- System.out.println("****** events triggered ******");
- System.out.println("************************************");
/*Wait for the events*/
Thread.currentThread().sleep(1000);
@@ -122,5 +107,4 @@
fail("exception caught");
}
}
-
}
Modified: 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=178324&r1=178323&r2=178324&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java (original)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/DeclarativeTest.java Tue May 24 16:37:47 2005
@@ -23,13 +23,12 @@
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;
@@ -75,16 +74,29 @@
myHelloBean.setName("TheName");
myHelloBean.changeTransient("A different value");
+ FileOutputStream fos=null;
+ ObjectOutputStream oos =null;
try{
- FileOutputStream fos = new FileOutputStream("objects2.ser");
- ObjectOutputStream oos = new ObjectOutputStream( fos );
-
+ fos = new FileOutputStream("objects2.ser");
+ oos = new ObjectOutputStream( fos );
oos.writeObject(myHelloBean);
+ }
+ catch(IOException e){
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ finally {
+ if(oos != null) oos.close();
+ if(fos != null) fos.close();
+ }
+
+ //To read them back in, reverse the process with:
+ FileInputStream fis =null;
+ ObjectInputStream ois =null;
- //To read them back in, reverse the process with:
-
- FileInputStream fis = new FileInputStream( "objects2.ser");
- ObjectInputStream ois = new ObjectInputStream( fis );
+ try{
+ fis = new FileInputStream( "objects2.ser");
+ ois = new ObjectInputStream( fis );
HelloControlBean hc2 = (HelloControlBean)ois.readObject();
int qty=hc2.getQuantity();
@@ -100,6 +112,9 @@
e.printStackTrace();
fail(e.getMessage());
}
-
+ finally {
+ if(ois != null) ois.close();
+ if(fis != null) fis.close();
+ }
}
}