beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From js...@apache.org
Subject svn commit: rev 36481 - in incubator/beehive/trunk/controls/test: . common infra/mantis tools/mantis tools/mantis/src/org/apache/beehive/mantis tools/mantis/src/org/apache/beehive/mantis/annotations/tch tools/mantis/src/org/apache/beehive/mantis/test
Date Mon, 16 Aug 2004 19:08:12 GMT
Author: jsong
Date: Mon Aug 16 12:08:11 2004
New Revision: 36481

Modified:
   incubator/beehive/trunk/controls/test/build.xml
   incubator/beehive/trunk/controls/test/common/path.properties
   incubator/beehive/trunk/controls/test/infra/mantis/mantis.jar
   incubator/beehive/trunk/controls/test/tools/mantis/build.xml
   incubator/beehive/trunk/controls/test/tools/mantis/mantis.xml
   incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/MantisTask.java
   incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/TchProcessor.java
   incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Freq.java
   incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Status.java
   incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/CheckinTest.java
   incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/DetailedTest.java
Log:
Contributed by Jamie Zyskowski: improve error logging from ant task. annotations just take
string values now - if an illegal value (according to tch schema) is used, a mantis runtime
error will occur

Modified: incubator/beehive/trunk/controls/test/build.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml	(original)
+++ incubator/beehive/trunk/controls/test/build.xml	Mon Aug 16 12:08:11 2004
@@ -202,4 +202,47 @@
 		<property name="output.file" value="${basedir}/${tch.base-logfile-name}.html"/>
         </ant>
     </target>  
+
+
+
+  <!-- =========================================================== -->
+  <!-- Mantis settings -->
+  <!-- =========================================================== -->
+  <property name="mantis.srcgen.dir" location="${basedir}/mantis-cases"/>
+  <property name="mantis.bingen.dir" location="${basedir}/mantis-bingen"/>
+  <property name="mantis.log.dir" location="${basedir}/mantis-logs"/>
+  <path id="mantis.classpath">
+	<pathelement path="${tchschema.jar}"/>
+	<pathelement path="${mantis.jar}"/>
+	<pathelement path="${mantis.xbean.jar}"/>
+	<pathelement path="${ant.jar}"/>
+	<pathelement path="${junit.jar}"/>
+	<pathelement path="${mantis.tools.jar}"/>
+	<pathelement path="${build.beans}"/>
+	<pathelement path="${milton.jar}"/>
+	<pathelement path="../build/jars/controls.jar"/>
+	<pathelement path="${servlet24.jar}"/>
+  </path>
+  <property name="mantis.run.classpath" refid="mantis.classpath"/>
+
+
+  <target name="mantis" description="autogen TCH xml based on test source annotations">
+		<delete dir="${mantis.srcgen.dir}"/>
+		<delete dir="${mantis.bingen.dir}"/>
+		<delete dir="${mantis.log.dir}"/>
+    <taskdef name="mantis"
+                classname="org.apache.beehive.mantis.MantisTask"
+                classpathref="mantis.classpath"/>
+  
+    <mantis srcdir="${junit.src.dir}"
+        	includes="**/*.java"
+    		srcgen="${mantis.srcgen.dir}"
+       		bingen="${mantis.bingen.dir}"
+		classpath="${mantis.run.classpath}"
+		logdir="${mantis.log.dir}"
+		config="${mantis.config}"
+		aptcommand="${os.JAVA_HOME}/bin/apt"
+    />
+  </target>
+    
 </project>

Modified: incubator/beehive/trunk/controls/test/common/path.properties
==============================================================================
--- incubator/beehive/trunk/controls/test/common/path.properties	(original)
+++ incubator/beehive/trunk/controls/test/common/path.properties	Mon Aug 16 12:08:11 2004
@@ -17,11 +17,18 @@
 tch.xbean.jar=${tch.home}/xbean-1.0.2.jar
 
 milton.jar=${controls.test.infra.dir}/milton/milton.jar
-mantis.jar=${controls.test.infra.dir}/mantis/mantis.jar
 
 crimson.jar=${external.dir}/crimson/crimson-1.1.jar
 jakarta.jar=${external.dir}/jakarta/jakarta-regexp-1.2.jar
 jaxp.jar=${external.dir}/jaxp/jaxp.jar
 xerces.jar=${external.dir}/xerces/xerces-1.4.4.jar
 xbean.jar=${external.dir}/xmlbeans/apache-xbeans.jar
-httpunit.jar=${external.dir}/httpunit/httpunit.jar
\ No newline at end of file
+httpunit.jar=${external.dir}/httpunit/httpunit.jar
+
+#properties for mantis
+mantis.home=${controls.test.infra.dir}/mantis
+mantis.jar=${mantis.home}/mantis.jar
+tchschema.jar=${mantis.home}/tchschema.jar
+mantis.tools.jar=${os.JAVA_HOME}/lib/tools.jar
+mantis.xbean.jar=${mantis.home}/xbean-1.0.2.jar
+mantis.config=${mantis.home}/mantis.properties
\ No newline at end of file

Modified: incubator/beehive/trunk/controls/test/infra/mantis/mantis.jar
==============================================================================
Binary files. No diff available.

Modified: incubator/beehive/trunk/controls/test/tools/mantis/build.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/build.xml	(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/build.xml	Mon Aug 16 12:08:11 2004
@@ -27,7 +27,7 @@
 	<property name="doc.dir" value="${mantis.root}/build/doc"/>
 	<property name="temp.dir" value="${mantis.root}/temp"/>
 	<property name="lib.dir" value="${mantis.root}/lib"/>
-	<property name="mantis.jar" value="${deploy.dir}/mantis.jar"/>
+	<property name="mantis.local.deploy.jar" value="${deploy.dir}/mantis.jar"/>
 	<property name="tchschema.jar" value="${lib.dir}/tchschema.jar"/>
 	<property name="mantis.xbean.jar" value="${lib.dir}/xbean-1.0.2.jar"/>
 
@@ -92,7 +92,7 @@
 	<target name="deploy">
 		<delete dir="${deploy.dir}"/>
 		<mkdir dir="${deploy.dir}"/>
-		<jar destfile="${mantis.jar}"
+		<jar destfile="${mantis.local.deploy.jar}"
 				 basedir="${build.dir}"
 				 excludes="**/test/**"/>
 	</target>

Modified: incubator/beehive/trunk/controls/test/tools/mantis/mantis.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/mantis.xml	(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/mantis.xml	Mon Aug 16 12:08:11 2004
@@ -41,6 +41,8 @@
 		<pathelement path="${mantis.build.dir}"/>
 		<pathelement path="${junit.jar}"/>
 		<pathelement path="${tch.jar}"/>
+		<pathelement path="${tch.home}/schema.jar"/>
+		<pathelement path="${mantis.xbean.jar}"/>
 		<pathelement path="${ant.jar}"/>
 		<pathelement path="${ant.home}/lib/ant-launcher.jar"/>
 		<pathelement path="${jakarta.jar}"/>

Modified: incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/MantisTask.java
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/MantisTask.java
(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/MantisTask.java
Mon Aug 16 12:08:11 2004
@@ -143,7 +143,8 @@
   private void logStreams(BufferedInputStream p_stdout, BufferedInputStream p_stderr) throws
IOException
   {
     int c;
-    // capture stdout
+
+    // capture stderr
     if(null == _logdir)
       _logdir = _srcgen;
     else
@@ -151,15 +152,6 @@
       File fLogdir = new File(_logdir);
       fLogdir.mkdirs();
     }
-    FileWriter stdoutWriter = new FileWriter(new File(_logdir+P+"mantis.out"));
-    while( (c=p_stdout.read()) != -1)
-    {
-      stdoutWriter.write(c);
-    }
-    stdoutWriter.flush();
-    stdoutWriter.close();
-
-    // capture stderr
     FileWriter stderrWriter = new FileWriter(new File(_logdir+P+"mantis.err"));
     while( (c = p_stderr.read()) != -1)
     {
@@ -167,6 +159,15 @@
     }
     stderrWriter.flush();
     stderrWriter.close();
+
+    // capture stdout
+    FileWriter stdoutWriter = new FileWriter(new File(_logdir+P+"mantis.out"));
+    while( (c=p_stdout.read()) != -1)
+    {
+      stdoutWriter.write(c);
+    }
+    stdoutWriter.flush();
+    stdoutWriter.close();
   }
 
 

Modified: incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/TchProcessor.java
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/TchProcessor.java
(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/TchProcessor.java
Mon Aug 16 12:08:11 2004
@@ -197,16 +197,12 @@
     TestMetadataType sMeta = test.addNewTestMetadata();
     if(null != mfreq)
     {
-      ArrayList<String> alFreq = new ArrayList<String>();
-      alFreq.add(mfreq.value());
-      sMeta.setFreq(alFreq);
+      sMeta.setFreq(createStringArrayList(mfreq.value()));
     }
 
     if(null != mstatus)
     {
-      ArrayList<String> alStatus = new ArrayList<String>();
-      alStatus.add(mstatus.value());
-      sMeta.setStatus(alStatus);
+      sMeta.setStatus(createStringArrayList(mstatus.value()));
     }
 
     if(null != mdesc)
@@ -266,7 +262,16 @@
         pw.close();
       }
     }
-
   }
 
+  private ArrayList<String> createStringArrayList(String p_input)
+  {
+    String[] values = p_input.split(" ");
+    ArrayList<String> result = new ArrayList<String>();
+    for(int i=0; i<values.length; i++)
+    {
+      result.add(values[i]);
+    }
+    return result;
+  }
 }

Modified: incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Freq.java
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Freq.java
(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Freq.java
Mon Aug 16 12:08:11 2004
@@ -2,7 +2,5 @@
 
 public @interface Freq
 {
-	String value() default Freq.CHECKIN; 
-  public static final String CHECKIN = "checkin";
-  public static final String DETAILED = "detailed";
+	String value() default "detailed"; 
 }

Modified: incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Status.java
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Status.java
(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/annotations/tch/Status.java
Mon Aug 16 12:08:11 2004
@@ -2,7 +2,5 @@
 
 public @interface Status
 {
-  String value() default Status.ACTIVE;
-  public static final String ACTIVE = "active";
-  public static final String INACTIVE = "inactive";
+  String value() default "active";
 }

Modified: incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/CheckinTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/CheckinTest.java
(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/CheckinTest.java
Mon Aug 16 12:08:11 2004
@@ -4,8 +4,8 @@
 import org.apache.beehive.mantis.annotations.tch.*;
 
 
-@Freq(Freq.CHECKIN)
-@Status(Status.ACTIVE)
+@Freq("checkin")
+@Status("active")
 @Desc("a class desc")
 @Misc("a class misc")
 public class CheckinTest extends TestCase
@@ -15,8 +15,8 @@
 		super(name);
 	}
 
-  @Freq(Freq.DETAILED)
-  @Status(Status.INACTIVE)
+  @Freq("detailed")
+  @Status("inactive")
   @Desc("a method desc")
   @Misc("a method misc")
 	public void testPass() throws Exception

Modified: incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/DetailedTest.java
==============================================================================
--- incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/DetailedTest.java
(original)
+++ incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/mantis/test/DetailedTest.java
Mon Aug 16 12:08:11 2004
@@ -11,8 +11,8 @@
 		super(name);
 	}
 
-  @Freq(Freq.DETAILED)
-  @Status(Status.ACTIVE)
+  @Freq("detailed")
+  @Status("active")
   @Desc("a method desc")
   @Misc("a method misc")
 	public void testPass() throws Exception

Mime
View raw message