You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/15 14:58:04 UTC

svn commit: r170216 - in /incubator/beehive/trunk/controls/test: build.xml dist-test/build.xml src/units/org/apache/beehive/controls/test/java/s13n/Test.java webapps/build.xml

Author: ekoneil
Date: Sun May 15 05:58:02 2005
New Revision: 170216

URL: http://svn.apache.org/viewcvs?rev=170216&view=rev
Log:
Fixes in controls tests.

- remove controls test infrastructure dependence on the sample DB control and Derby
- fix a serialization test that opened streams but never closed them

BB: self
DRT: Beehive pass


Modified:
    incubator/beehive/trunk/controls/test/build.xml
    incubator/beehive/trunk/controls/test/dist-test/build.xml
    incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/s13n/Test.java
    incubator/beehive/trunk/controls/test/webapps/build.xml

Modified: incubator/beehive/trunk/controls/test/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/build.xml?rev=170216&r1=170215&r2=170216&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml (original)
+++ incubator/beehive/trunk/controls/test/build.xml Sun May 15 05:58:02 2005
@@ -54,13 +54,6 @@
 
     <property name="mantis.run.classpath" refid="mantis.classpath"/>
 
-    <property name="db.control.dir" location="../../samples/controls-db"/>
-    <property name="db.control.jar" location="${db.control.dir}/build/dbControl.jar"/>
-
-    <path id="derby.dependency.path">
-        <pathelement location="${beehive.home}/external/derby/derby_46005.jar"/>
-    </path>
-
     <condition property="test.os" value="windows" >
        <os family="windows" />
     </condition>
@@ -81,7 +74,6 @@
         <path refid="servlet.dependency.path"/>
         <path refid="junit.dependency.path"/>
         <path refid="tools.dependency.path"/>
-        <path refid="derby.dependency.path"/>
         <pathelement location="${milton.jar}"/>
         <pathelement location="${db.control.jar}"/>
         <pathelement path="${build.beans}"/>
@@ -113,7 +105,6 @@
     <path refid="servlet.dependency.path"/>
     <path refid="junit.dependency.path"/>
     <path refid="tools.dependency.path"/>
-    <path refid="derby.dependency.path"/>
 
     <pathelement location="${db.control.jar}"/>
     <pathelement path="${build.beans}"/>
@@ -154,8 +145,6 @@
         <delete dir="${mantis.milton.log.dir}"/>
         <delete dir="${mantis.milton.cases.dir}"/>
 
-        <delete dir="${derby.data}"/>
-        <delete file="derby.log"/>
         <delete file="velocity.log"/>
         <delete><fileset dir="." includes="tch*.*"/></delete>
         <ant dir="webapps" target="clean"/>
@@ -185,25 +174,6 @@
           <mkdir dir="${test.logs}" />
       </target>
       
-      <!--
-          Note that properties are passed to dbControl manually. The reason for
-          doing it is: in a dev environment, there is no BEEHIVE_HOME. We don't
-          want to change the sample since it is used as part of the distribution.
-      -->
-      <target name="dbControl">
-          <ant dir="${db.control.dir}" 
-               antfile="build-svn.xml" 
-               target="build"
-               inheritall="false"/>
-      </target>
-      <target name="dbControl-clean">
-          <ant 
-            dir="${db.control.dir}" 
-            antfile="build-svn.xml" 
-            target="clean"
-            inheritall="false"/>
-      </target>
-
     <target name="build-test-beans" depends="dirs,build-test-auxilaries">
 
         <echo message="** Compiling Controls **"/>

Modified: incubator/beehive/trunk/controls/test/dist-test/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/dist-test/build.xml?rev=170216&r1=170215&r2=170216&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/dist-test/build.xml (original)
+++ incubator/beehive/trunk/controls/test/dist-test/build.xml Sun May 15 05:58:02 2005
@@ -28,7 +28,6 @@
     <!-- ========================================= -->   
 
     <target name="build.tests" description="Build all controls tests">
-        <ant dir="../" antfile="build.xml" target="dbControl" inheritAll="false"/>
         <ant dir="../" antfile="build.xml" target="build" inheritAll="false"/>
         <!--ant dir="../" antfile="build.xml" target="build-test-webapp" inheritAll="false"/-->
     </target>
@@ -108,8 +107,6 @@
        </copy>
 
        <!-- Copy test jars -->
-       <copy file="../../../samples/controls-db/build/dbControl.jar" 
-             tofile="${test.dist.base.dir}/beehive-test-dist/controls/test/jars/dbControl.jar"/>
        <copy file="../build/controlstestbeans.jar" 
              tofile="${test.dist.base.dir}/beehive-test-dist/controls/test/jars/controlstestbeans.jar"/>
        <copy file="../build/controlstestdrivers.jar" 
@@ -121,8 +118,6 @@
        <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/cases">
        		<fileset dir="../build/mantis.tch.cases" />
        </copy>
-
-       <!--we need to make sure availability of location="${db.control.jar}"/-->
 
        <!-- Copy the web application to beehive-test-dist/controls/test/webapps-->
        <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/controlsWeb">

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=170216&r1=170215&r2=170216&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 Sun May 15 05:58:02 2005
@@ -23,8 +23,6 @@
 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;
@@ -54,31 +52,45 @@
 			hc.setName("TheName");
 			hc.changeTransient("A different value");
 
-		try{
-			FileOutputStream   fos = new FileOutputStream("objects.ser");
-			ObjectOutputStream oos = new ObjectOutputStream( fos );
-
-			oos.writeObject(hc);
-
-			//To read them back in, reverse the process with:
-
-			FileInputStream fis = new FileInputStream( "objects.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());
-		}
-
+            FileOutputStream fos = null;
+        ObjectOutputStream oos = null;
+        try{
+            fos = new FileOutputStream("objects.ser");
+            oos = new ObjectOutputStream( fos );
+            oos.writeObject(hc);
+        }
+        catch(IOException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+        finally {
+            if(oos != null) oos.close();
+            if(fos != null) fos.close();
+        }
+
+        FileInputStream fis = null;
+        ObjectInputStream ois = null;
+        try {
+            //To read them back in, reverse the process with:
+            fis = new FileInputStream( "objects.ser");
+            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());
+        }
+        finally {
+            if(ois != null) ois.close();
+            if(fis != null) fis.close();
+        }
     }
 }

Modified: incubator/beehive/trunk/controls/test/webapps/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/webapps/build.xml?rev=170216&r1=170215&r2=170216&view=diff
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/build.xml (original)
+++ incubator/beehive/trunk/controls/test/webapps/build.xml Sun May 15 05:58:02 2005
@@ -15,8 +15,6 @@
     
     <property name="server.root.url" value="http://localhost:8080"/>
     <property name="webapp.waitfor.url" value="${server.root.url}/${controls.test.webapp.name}"/>
-    <property name="dbControl.jar" location="${beehive.home}/samples/controls-db/build/dbControl.jar"/>
-    <property name="derby.jar" location="${beehive.home}/external/derby/derby_46005.jar"/>
 
   <target name="usage">
     <echo message="" />
@@ -104,8 +102,6 @@
         <antcall target="-inject.netui"/>
         <antcall target="-inject.wsm"/>
         <antcall target="-inject.milton"/>
-        <antcall target="-inject.derby"/>
-        <antcall target="-inject.dbControl"/>        
         <antcall target="-inject.test.controls"/>
         <antcall target="-inject.test.drivers"/>
         <antcall target="-inject.test.systemcontrols"/>
@@ -148,20 +144,6 @@
                 <include name="resources/**"/>
             </fileset>
         </copy>
-    </target>
- 
-    <target name="-inject.derby" if="do.inject.derby">
-        <echo message="Injecting ${derby.jar} to ${controls.test.webapp.name}"/>
-        <copy todir="${webapp.dir}/WEB-INF/lib" 
-              file="${derby.jar}" verbose="true" 
-              overwrite="true" failonerror="true"/>
-    </target>
-
-    <target name="-inject.dbControl" if="do.inject.dbControl">
-        <echo message="Injecting ${dbControl.jar} to ${controls.test.webapp.name}"/>
-        <copy todir="${webapp.dir}/WEB-INF/lib" 
-              file="${dbControl.jar}" verbose="true" 
-              overwrite="true" failonerror="true"/>
     </target>
 
     <target name="-inject.test.controls" if="do.inject.test.controls">