[jboss-cvs] JBossAS SVN: r62157 - in trunk/embedded: docs/tutorial/junit/ide and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Apr 6 10:49:31 EDT 2007
Author: bill.burke at jboss.com
Date: 2007-04-06 10:49:31 -0400 (Fri, 06 Apr 2007)
New Revision: 62157
Added:
trunk/embedded/docs/tutorial/junit/ide/build.xml
trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/AllTests.java
Modified:
trunk/embedded/build.xml
trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/junit/EjbTestCase.java
trunk/embedded/src/main/java/org/jboss/embedded/junit/BaseTestCase.java
Log:
fine tune junit testing as well as tutorials
Modified: trunk/embedded/build.xml
===================================================================
--- trunk/embedded/build.xml 2007-04-06 13:50:08 UTC (rev 62156)
+++ trunk/embedded/build.xml 2007-04-06 14:49:31 UTC (rev 62157)
@@ -457,6 +457,9 @@
<exclude name="**/.svn/**"/>
<exclude name="**/*.wiki"/>
</zipfileset>
+ <zipfileset dir="../testsuite/src" prefix="${embedded.version}/docs/tutorial/junit/ide">
+ <include name="stylesheets/**"/>
+ </zipfileset>
</zip>
</target>
Added: trunk/embedded/docs/tutorial/junit/ide/build.xml
===================================================================
--- trunk/embedded/docs/tutorial/junit/ide/build.xml (rev 0)
+++ trunk/embedded/docs/tutorial/junit/ide/build.xml 2007-04-06 14:49:31 UTC (rev 62157)
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="test" basedir=".">
+ <property name="src.dir" value="${basedir}/src/main/java"/>
+ <property name="test.src.dir" value="${basedir}/src/test/java"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.reports" value="${basedir}/build/reports"/>
+ <property name="build.stylesheets" value="${basedir}/build/stylesheets"/>
+ <property name="src.stylesheets" value="${basedir}/stylesheets"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="build.test.classes.dir" value="${build.dir}/test-classes"/>
+ <property name="lib.dir" value="../../../../lib"/>
+ <property name="optional.lib.dir" value="../../../../optional-lib"/>
+ <property name="conf.dir" value="../../../../bootstrap"/>
+
+ <!-- =================================================================== -->
+ <!-- Prepares the build directory -->
+ <!-- =================================================================== -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${build.test.classes.dir}"/>
+ <!-- Build classpath -->
+ <path id="build.classpath">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${optional.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="${build.classes.dir}"/>
+ </path>
+
+ <path id="junit.classpath">
+ <pathelement location="${conf.dir}"/>
+ <pathelement location="${build.test.classes.dir}"/>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${optional.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${build.dir}">
+ <include name="tutorial.jar"/>
+ </fileset>
+ </path>
+
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the source code -->
+ <!-- =================================================================== -->
+ <target name="compile" depends="prepare">
+ <javac srcdir="${src.dir}"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="**">
+ <classpath refid="build.classpath"/>
+ </javac>
+ <javac srcdir="${test.src.dir}"
+ destdir="${build.test.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="**">
+ <classpath refid="build.classpath"/>
+ </javac>
+ </target>
+
+ <target name="ejbjar" depends="compile">
+ <jar jarfile="build/tutorial.jar">
+ <fileset dir="${build.classes.dir}">
+ <include name="**/beans/*.class"/>
+ </fileset>
+ <fileset dir="src/main/resources">
+ <include name="*.xml"/>
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="test" depends="ejbjar">
+
+ <mkdir dir="${build.reports}"/>
+ <junit printsummary="yes"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <!-- clean shutdown so we don't keep any file locks -->
+ <sysproperty key="shutdown.embedded.jboss" value="true"/>
+
+ <classpath>
+ <path refid="junit.classpath"/>
+ </classpath>
+
+ <formatter type="plain" usefile="true"/>
+ <formatter type="xml" usefile="true"/>
+
+ <batchtest todir="${build.reports}"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <fileset dir="${build.test.classes.dir}">
+ <include name="**/*TestCase.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="all-tests" depends="ejbjar">
+
+ <mkdir dir="${build.reports}"/>
+ <junit printsummary="yes"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <classpath>
+ <path refid="junit.classpath"/>
+ </classpath>
+
+ <formatter type="plain" usefile="true"/>
+ <formatter type="xml" usefile="true"/>
+
+ <test
+ name="org.jboss.embedded.tutorial.AllTests"
+ todir="${build.reports}"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true"/>
+ </junit>
+ </target>
+
+
+ <target name="compile-stylesheets">
+ <mkdir dir="${build.stylesheets}"/>
+ <copy todir="${build.stylesheets}" filtering="yes">
+ <fileset dir="${src.stylesheets}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="tests-report-html" depends="compile-stylesheets">
+ <mkdir dir="${build.reports}/html"/>
+
+ <junitreport todir="${build.reports}">
+ <fileset dir="${build.reports}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames"
+ todir="${build.reports}/html"
+ styledir="${build.stylesheets}"
+ />
+ </junitreport>
+ </target>
+
+ <target name="tests-report-clean">
+ <delete dir="${build.reports}"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- Cleans up generated stuff -->
+ <!-- =================================================================== -->
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+
+</project>
+
Added: trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/AllTests.java
===================================================================
--- trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/AllTests.java (rev 0)
+++ trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/AllTests.java 2007-04-06 14:49:31 UTC (rev 62157)
@@ -0,0 +1,74 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.embedded.tutorial;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.jboss.embedded.Bootstrap;
+import org.jboss.embedded.tutorial.junit.EasierEjbTestCase;
+import org.jboss.embedded.tutorial.junit.EjbTestCase;
+import org.jboss.embedded.tutorial.junit.JarByResourceTestCase;
+import org.jboss.embedded.tutorial.junit.MdbTestCase;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class AllTests extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("All Tests");
+
+ suite.addTest(EasierEjbTestCase.suite());
+ suite.addTest(EjbTestCase.suite());
+ suite.addTest(JarByResourceTestCase.suite());
+ suite.addTest(MdbTestCase.suite());
+
+ return new TestSetup(suite)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ Bootstrap.getInstance().bootstrap();
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ Bootstrap.getInstance().shutdown();
+ super.tearDown();
+ }
+ };
+
+ }
+}
\ No newline at end of file
Modified: trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/junit/EjbTestCase.java
===================================================================
--- trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/junit/EjbTestCase.java 2007-04-06 13:50:08 UTC (rev 62156)
+++ trunk/embedded/docs/tutorial/junit/ide/src/test/java/org/jboss/embedded/tutorial/junit/EjbTestCase.java 2007-04-06 14:49:31 UTC (rev 62157)
@@ -57,7 +57,6 @@
private static void deploy()
{
- EmbeddedTestSetup.testSetup();
jar = AssembledContextFactory.getInstance().create("ejbTestCase.jar");
jar.addClass(Customer.class);
jar.addClass(CustomerDAOBean.class);
@@ -101,6 +100,10 @@
protected void setUp() throws Exception
{
super.setUp();
+ if (!Bootstrap.getInstance().isStarted())
+ {
+ Bootstrap.getInstance().bootstrap();
+ }
deploy();
}
@@ -108,6 +111,7 @@
protected void tearDown() throws Exception
{
undeploy();
+ if (System.getProperty("shutdown.embedded.jboss") != null) Bootstrap.getInstance().shutdown();
super.tearDown();
}
};
Modified: trunk/embedded/src/main/java/org/jboss/embedded/junit/BaseTestCase.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/junit/BaseTestCase.java 2007-04-06 13:50:08 UTC (rev 62156)
+++ trunk/embedded/src/main/java/org/jboss/embedded/junit/BaseTestCase.java 2007-04-06 14:49:31 UTC (rev 62157)
@@ -87,6 +87,7 @@
catch (NoSuchMethodException ignored)
{
}
+ if (System.getProperty("shutdown.embedded.jboss") != null) Bootstrap.getInstance().shutdown();
}
private static void bootstrap()
@@ -148,6 +149,7 @@
catch (NoSuchMethodException ignored)
{
}
+ if (System.getProperty("shutdown.embedded.jboss") != null) Bootstrap.getInstance().shutdown();
super.tearDown();
}
finally
More information about the jboss-cvs-commits
mailing list