You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/06/12 11:37:18 UTC

svn commit: rev 21125 - in avalon/trunk/tools/magic/engine: . src/test/java src/test/java/org src/test/java/org/apache/avalon/magic src/test/org src/test/resources src/test/resources/org src/test/resources/org/apache src/test/resources/org/apache/avalon src/test/resources/org/apache/avalon/magic

Author: niclas
Date: Sat Jun 12 02:37:17 2004
New Revision: 21125

Added:
   avalon/trunk/tools/magic/engine/src/test/java/
   avalon/trunk/tools/magic/engine/src/test/java/org/
      - copied from rev 21121, avalon/trunk/tools/magic/engine/src/test/org/
   avalon/trunk/tools/magic/engine/src/test/resources/
   avalon/trunk/tools/magic/engine/src/test/resources/org/
   avalon/trunk/tools/magic/engine/src/test/resources/org/apache/
   avalon/trunk/tools/magic/engine/src/test/resources/org/apache/avalon/
   avalon/trunk/tools/magic/engine/src/test/resources/org/apache/avalon/magic/
Removed:
   avalon/trunk/tools/magic/engine/src/test/org/
Modified:
   avalon/trunk/tools/magic/engine/build.properties
   avalon/trunk/tools/magic/engine/build.xml
   avalon/trunk/tools/magic/engine/src/test/java/org/apache/avalon/magic/PluginContextTestCase.java
Log:
As usual, need to commit before can proceed. This is annoying.

Modified: avalon/trunk/tools/magic/engine/build.properties
==============================================================================
--- avalon/trunk/tools/magic/engine/build.properties	(original)
+++ avalon/trunk/tools/magic/engine/build.properties	Sat Jun 12 02:37:17 2004
@@ -30,3 +30,44 @@
 jar.file.dir=${build.dest.dir}
 
 build.dist.dir=${build.dest.dir}/dist
+
+test.dir=${src.dir}/test
+test.src.dir=${test.dir}/java
+test.resources.dir=${test.dir}/resources
+test.environment.dir=${test.dir}/environment
+
+test.build.dir=${build.dest.dir}/${test.dir}
+test.build.src.dir=${build.dest.dir}/${test.src.dir}
+test.build.resources.dir=${build.dest.dir}/${test.resources.dir}
+test.build.environment.dir=${build.dest.dir}/${test.environment.dir}
+
+test.build.classes.dir=${build.dest.dir}/test-classes
+
+test.reports.dir=${build.dest.dir}/test-reports
+test.fancy.reports.dir=${test.reports.dir}/html
+
+test.fork=true
+test.compile.fork=false
+test.compile.debug=true
+
+test.halt.on.failure=off
+test.halt.on.error=off
+
+test.print.summary=true
+test.show.output=true
+test.reload.classes=true
+test.filter.stack.trace=on
+
+test.includes=**/*TestCase.java
+
+test.excludes=**/Abstract*TestCase.java
+
+# Creation of Fancy Test Report.
+# Default: false
+test.fancy.report=true
+test.fancy.report.format=frames
+
+
+# To include the Fancy Report in the Distribution
+# Default: false
+test.fancy.report.dist=true

Modified: avalon/trunk/tools/magic/engine/build.xml
==============================================================================
--- avalon/trunk/tools/magic/engine/build.xml	(original)
+++ avalon/trunk/tools/magic/engine/build.xml	Sat Jun 12 02:37:17 2004
@@ -8,6 +8,9 @@
     <mkdir dir="${java.build.src.dir}" />
     <mkdir dir="${java.build.classes.dir}" />
     <mkdir dir="${jar.build.resources.dir}" />
+    <available file="${test.src.dir}" property="test-sources-available" />
+    <available file="${test.resources.dir}" property="test-resources-available" />
+    <available file="${test.environment.dir}" property="test-environment-available" />
     
     <copy todir="${build.src.dir}" filtering="on">
       <fileset dir="${src.dir}"  >
@@ -35,8 +38,8 @@
            fork="${java.compile.fork}"
     >
       <classpath>
-        <path location="${maven.repository}/avalon-framework/jars/avalon-framework-api-4.2.0.jar" />
-        <path location="${maven.repository}/avalon-framework/jars/avalon-framework-impl-4.2.0.jar" />
+        <path location="${maven.repository}/avalon/framework/jars/avalon-framework-api-4.2.0.jar" />
+        <path location="${maven.repository}/avalon/framework/jars/avalon-framework-impl-4.2.0.jar" />
         <path location="${maven.repository}/bsh/jars/bsh-2.0b1.jar" />
         <path location="${maven.repository}/ant/jars/ant-1.6.jar" />
       </classpath>
@@ -44,7 +47,7 @@
   </target>
   
   <target name="package" depends="build" >
-    <property name="jar-built-file" value="${jar.file.dir}/magic.jar" />
+    <property name="jar-built-file" value="${basedir}/${jar.file.dir}/magic.jar" />
     <jar destfile="${jar-built-file}"
          basedir="${jar.classes.dir}"
          manifest="${jar.manifest.file}"
@@ -64,13 +67,111 @@
       <fileset dir="${build.src.dir}/dist" includes="**" />
     </copy>
     <copy todir="${build.dist.dir}/bin" >
-      <fileset dir="${maven.repository}/avalon-framework/jars/" includes="avalon-framework-api-4.2.0.jar" />
-      <fileset dir="${maven.repository}/avalon-framework/jars/" includes="avalon-framework-impl-4.2.0.jar" />
+      <fileset dir="${maven.repository}/avalon/framework/jars/" includes="avalon-framework-api-4.2.0.jar" />
+      <fileset dir="${maven.repository}/avalon/framework/jars/" includes="avalon-framework-impl-4.2.0.jar" />
       <fileset dir="${maven.repository}/bsh/jars/" includes="bsh-2.0b1.jar" />
     </copy>
     
     <copy todir="${build.dist.dir}/bin" file="${jar-built-file}" />
     <chmod file="${build.dist.dir}/bin/magic" perm="+x" />
+  </target>
+  
+  <target name="test" depends="prepare, package, test-copy-resources, test-copy-environment, test-compile, test-execute, test-report" >
+  </target>
+  
+  <target name="test-compile" if="test-sources-available" >
+    <mkdir dir="${test.build.classes.dir}" />
+    <javac srcdir="${test.build.src.dir}"
+           destdir="${test.build.classes.dir}"
+           debug="${test.compile.debug}"
+           fork="${test.compile.fork}"
+    >
+      <classpath>
+        <pathelement path="${jar-built-file}" />
+        <pathelement path="${maven.repository}/avalon/framework/jars/avalon-framework-api-4.2.0.jar" />
+      </classpath>
+    </javac>
+  </target>
+  
+  <target name="test-copy-resources" if="test-resources-available" >
+    <mkdir dir="${test.build.resources.dir}" />
+    <copy todir="${test.build.resources.dir}"
+          overwrite="false"
+    >
+      <fileset dir="${test.resources.dir}" includes="**" />
+    </copy>
+  </target>
+  
+  <target name="test-copy-environment" if="test-environment-available" >
+    <mkdir dir="${test.build.environment.dir}" />
+    <copy todir="${test.build.environment.dir}"
+          overwrite="false"
+    >
+      <fileset dir="${test.environment.dir}" includes="**" />
+    </copy>
+  </target>
+  
+  <target name="test-execute" if="test-sources-available" >
+    <mkdir dir="${test.build.environment.dir}/temp" />
+    <mkdir dir="${test.reports.dir}" />
+    <mkdir dir="${test.fancy.reports.dir}" />
+    <junit 
+        fork="${test.fork}"
+        printsummary="${test.print.summary}" 
+        haltonfailure="${test.halt.on.failure}"
+        haltonerror="${test.halt.on.error}"
+        errorproperty="test-errors"
+        failureproperty="test-failures"
+        dir="${test.build.environment.dir}"
+        showoutput="${test.show.output}"
+        tempdir="${test.build.environment.dir}/temp"
+        reloading="${test.reload.classes}"
+        filtertrace="${test.filter.stack.trace}"
+    >
+      <classpath>
+        <pathelement path="${jar-built-file}" />
+        <pathelement path="${basedir}/${test.build.classes.dir}" />
+        <pathelement path="${basedir}/${test.build.resources.dir}" />
+        <pathelement path="${maven.repository}/avalon/framework/jars/avalon-framework-api-4.2.0.jar" />
+      </classpath>
+      <sysproperty key="basedir" value="${basedir}"/>      
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+
+      <batchtest todir="${test.reports.dir}">
+        <fileset dir="${test.build.src.dir}">
+          <include name="${test.includes}"/>
+          <exclude name="${test.excludes}"/>
+        </fileset>
+      </batchtest>
+    </junit>
+    <condition property="test-produce-reports" >
+      <and>
+        <istrue value="${test.fancy.report}" />
+        <istrue value="${test-sources-available}" />
+      </and>
+    </condition>
+  </target>
+  
+  <target name="test-report" if="test-produce-reports"  >
+    <mkdir dir="${test.reports.dir}" />
+    <mkdir dir="${test.fancy.reports.dir}" />
+    <junitreport todir="${test.reports.dir}" >
+      <fileset dir=".">
+        <include name="**/TEST-*.xml"/>
+      </fileset>
+      <report 
+            format="${test.fancy.report.format}" 
+            todir="${test.fancy.reports.dir}"
+      />
+    </junitreport>
+    <fail if="test-errors" >There were Unittest ERRORS.</fail>
+    <fail if="test-failures" >There were Unittest FAILURES.</fail>
+  </target>
+  
+  <!-- Include the Fancy test report in the distribution  -->
+  <target name="test-report-package" if="test.fancy.report.dist" >
+  
   </target>
   
   <target name="clean" depends="prepare" >

Modified: avalon/trunk/tools/magic/engine/src/test/java/org/apache/avalon/magic/PluginContextTestCase.java
==============================================================================
--- avalon/trunk/tools/magic/engine/src/test/org/apache/avalon/magic/PluginContextTestCase.java	(original)
+++ avalon/trunk/tools/magic/engine/src/test/java/org/apache/avalon/magic/PluginContextTestCase.java	Sat Jun 12 02:37:17 2004
@@ -5,6 +5,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tools.ant.Project;
 
 /**
  * @author Niclas Hedhman, niclas@hedhman.org
@@ -16,6 +17,9 @@
     private File m_PluginDir;
     private File m_SystemDir;
     private File m_ProjectDir;
+    private File m_ProjectSystemDir;
+    private File m_TempDir;
+    private Project m_Project;
     
     /*
      * @see TestCase#setUp()
@@ -35,9 +39,19 @@
         
         m_SystemDir = new File( "target/system");
         m_SystemDir.mkdir();
-
-        m_Context = new PluginContext( " testcase project ", m_ProjectDir, projectProps,
-                "testcase plugin", m_PluginDir, m_SystemDir );
+        
+        m_Context = new PluginContext
+        ( 
+            " testcase project ", 
+            m_ProjectDir,
+            m_ProjectSystemDir, 
+            projectProps,
+            "testcase plugin", 
+            m_PluginDir, 
+            m_SystemDir,
+            m_TempDir,
+            m_Project
+        );
         m_Context.setPluginClassname( "TestCasePlugin");
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org