Author: bdaw
Date: 2007-10-07 18:51:25 -0400 (Sun, 07 Oct 2007)
New Revision: 8555
Added:
modules/test/trunk/tooling/
modules/test/trunk/tooling/build.bat
modules/test/trunk/tooling/build.sh
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/
modules/test/trunk/tooling/src/main/
modules/test/trunk/tooling/src/main/org/
modules/test/trunk/tooling/src/main/org/jboss/
modules/test/trunk/tooling/src/main/org/jboss/test/
modules/test/trunk/tooling/src/main/org/jboss/test/unit/
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java
modules/test/trunk/tooling/src/main/org/jboss/unit/
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TaskExecutingThread.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java
modules/test/trunk/tooling/src/resources/
modules/test/trunk/tooling/src/resources/test/
modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
Log:
jboss unit ant support
Added: modules/test/trunk/tooling/build.bat
===================================================================
--- modules/test/trunk/tooling/build.bat (rev 0)
+++ modules/test/trunk/tooling/build.bat 2007-10-07 22:51:25 UTC (rev 8555)
@@ -0,0 +1,54 @@
+@echo off
+rem
+rem Invokes a script of the same name in the 'tools' module.
+rem
+rem The 'tools' module is expected to be a peer directory of the directory
+rem in which this script lives.
+rem
+rem @author Jason Dillon <jason(a)planet57.com>
+rem
+
+rem $Id: build.bat 1829 2006-03-05 13:20:08Z julien $
+
+setlocal
+
+set PROGNAME=%~nx0
+set DIRNAME=%~dp0
+
+rem Legacy shell support
+if x%PROGNAME%==x set PROGNAME=build.bat
+if x%DIRNAME%==x set DIRNAME=.\
+
+set MODULE_ROOT=%DIRNAME%
+if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
+set TARGET=%TOOLS_ROOT%\bin\build.bat
+set ARGS=%*
+
+rem Start'er up yo
+goto main
+
+:debug
+if not x%DEBUG%==x echo %PROGNAME%: %*
+goto :EOF
+
+:main
+call :debug PROGNAME=%PROGNAME%
+call :debug DIRNAME=%DIRNAME%
+call :debug TOOLS_ROOT=%TOOLS_ROOT%
+call :debug TARGET=%TARGET%
+
+if exist %TARGET% call :call-script & goto :EOF
+rem else fail, we can not go on
+
+echo %PROGNAME%: *ERROR* The target executable does not exist:
+echo %PROGNAME%:
+echo %PROGNAME%: %TARGET%
+echo %PROGNAME%:
+echo %PROGNAME%: Please make sure you have checked out the 'tools' module
+echo %PROGNAME%: and make sure it is up to date.
+goto :EOF
+
+:call-script
+call :debug Executing %TARGET% %ARGS%
+call %TARGET% %ARGS%
+goto :EOF
Property changes on: modules/test/trunk/tooling/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/test/trunk/tooling/build.sh
===================================================================
--- modules/test/trunk/tooling/build.sh (rev 0)
+++ modules/test/trunk/tooling/build.sh 2007-10-07 22:51:25 UTC (rev 8555)
@@ -0,0 +1,49 @@
+#!/bin/sh
+##
+## Invokes a script of the same name in the 'tools' module.
+##
+## The 'tools' module is expected to be a peer directory of the directory
+## in which this script lives.
+##
+## @author Jason Dillon <jason(a)planet57.com>
+##
+
+# $Id: build.sh 1829 2006-03-05 13:20:08Z julien $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+
+# Buss it yo
+main() {
+ if [ "x$TOOLS_ROOT" = "x" ]; then
+ TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
+ fi
+
+ MODULE_ROOT=`cd $DIRNAME; pwd`
+ export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
+
+ # Where is the target script?
+ target="$TOOLS_ROOT/bin/$PROGNAME"
+ if [ ! -f "$target" ]; then
+ echo "${PROGNAME}: *ERROR* The target executable does not exist:"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: $target"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: Please make sure you have checked out the 'tools'
module"
+ echo "${PROGNAME}: and make sure it is up to date."
+ exit 2
+ fi
+
+ # Get busy yo!
+ if [ "x$DEBUG" != "x" ]; then
+ echo "${PROGNAME}: Executing: /bin/sh $target $@"
+ fi
+ if [ "x$TRACE" = "x" ]; then
+ exec /bin/sh $target "$@"
+ else
+ exec /bin/sh -x $target "$@"
+ fi
+}
+
+# Lets get ready to rumble!
+main "$@"
Property changes on: modules/test/trunk/tooling/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml (rev 0)
+++ modules/test/trunk/tooling/build.xml 2007-10-07 22:51:25 UTC (rev 8555)
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE project [
+ <!ENTITY buildmagic SYSTEM
"../tools/etc/buildfragments/buildmagic.ent">
+ <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
+ <!ENTITY defaults SYSTEM
"../tools/etc/buildfragments/defaults.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
+ ]>
+
+<!-- $Id: build.xml 7954 2007-08-16 14:51:00Z julien(a)jboss.com $ -->
+
+<!--+======================================================================+-->
+<!--| JBoss Portal (The OpenSource Portal) Build File |-->
+<!--| |-->
+<!--| Distributable under LGPL license. |-->
+<!--| See terms of license at
http://www.gnu.org. |-->
+<!--| |-->
+<!--| This file has been designed to work with the 'tools' module and
|-->
+<!--| Buildmagic extentions. |-->
+<!--+======================================================================+-->
+
+<project default="main" name="JBoss Portal">
+
+ <!--+====================================================================+-->
+ <!--| Setup |-->
+ <!--| |-->
+ <!--| Include the common build elements. |-->
+ <!--| |-->
+ <!--| This defines several different targets, properties and paths. |-->
+ <!--| It also sets up the basic extention tasks amoung other things. |-->
+ <!--+====================================================================+-->
+
+ &buildmagic;
+ &modules;
+ &defaults;
+ &tools;
+ &targets;
+
+
+ <!-- ================================================================== -->
+ <!-- Initialization -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Initialize the build system. Must depend on '_buildmagic:init'.
+ | Other targets should depend on 'init' or things will mysteriously fail.
+ -->
+
+ <target name="init" unless="init.disable"
depends="_buildmagic:init">
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Configuration |-->
+ <!--| |-->
+ <!--| This target is invoked by the Buildmagic initialization logic |-->
+ <!--| and should contain module specific configuration elements. |-->
+ <!--+====================================================================+-->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- Configure thirdparty libraries -->
+ &libraries;
+ <path id="library.classpath">
+ <path refid="apache.ant.classpath"/>
+ <path location="${project.root}/unit/"/>
+ </path>
+
+ <!-- Configure modules -->
+ <call target="configure-modules"/>
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.unit.classpath"/>
+ </path>
+
+ <!--+=======================================+-->
+ <!--| Override any default properties here. |-->
+ <!--+=======================================+-->
+
+ <!--+=======================================+-->
+ <!--| Define module specific elements here. |-->
+ <!--+=======================================+-->
+ <property name="javadoc.private" value="false"/>
+ <property name="javadoc.protected" value="false"/>
+ <property name="javadoc.packages"
value="org.jboss.unit.*"/>
+
+ <!-- Configure defaults & build tools -->
+ <call target="configure-defaults"/>
+ <call target="configure-tools"/>
+
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Compile |-->
+ <!--| |-->
+ <!--| This target should depend on other compile-* targets for each |-->
+ <!--| different type of compile that needs to be performed, short of |-->
+ <!--| documentation compiles. |-->
+ <!--+====================================================================+-->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes,
+ _default:compile-etc,
+ _default:compile-resources">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Generate Output |-->
+ <!--| |-->
+ <!--| Generates the target output for this module. Target output is |-->
+ <!--| the output which is ment to be released or used by external |-->
+ <!--| modules. |-->
+ <!--+====================================================================+-->
+
+ <target name="output"
+ description="Generate all target output."
+ depends="compile">
+
+ <mkdir dir="${build.lib}"/>
+
+ <jar jarfile="${build.lib}/jboss-unit-tooling-lib.jar">
+ <fileset dir="${build.classes}">
+ <exclude name="org/jboss/test/**"/>
+ </fileset>
+ <!--<fileset dir="${build.resources}/jboss-unit-jar"/>-->
+ </jar>
+
+ <jar jarfile="${build.lib}/jboss-unit-tooling-test.jar">
+ <fileset dir="${build.classes}">
+ <exclude name="org/jboss/unit/**"/>
+ </fileset>
+ </jar>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Cleaning -->
+ <!-- ================================================================== -->
+
+ <!-- Clean up all build output -->
+ <target name="clean" depends="_default:clean">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Documents |-->
+ <!--| |-->
+ <!--| Generate all documentation for this module. |-->
+ <!--+====================================================================+-->
+
+ <target name="docs" depends="_default:docs">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Misc. -->
+ <!-- ================================================================== -->
+
+ <target name="main" depends="most"/>
+ <target name="all" depends="_default:all"/>
+ <target name="most" depends="_default:most"/>
+ <target name="help" depends="_default:help"/>
+
+ <!--<target name="test" depends="output">
+
+ <java classname="org.jboss.test.unit.AllTests"
fork="true">
+--><!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg
value="-Xrunjdwp:transport=dt_socket,address=7878,server=y,suspend=y"/>
+--><!--
+ <classpath>
+ <path location="${build.lib}/jboss-unit-lib.jar"/>
+ <path location="${build.lib}/jboss-unit-test.jar"/>
+ <path location="${build.resources}/test"/>
+ </classpath>
+ </java>
+
+ </target>-->
+
+ <target name="tests-ant" depends="output" >
+ <path id="jboss.unit.tooling.test.classpath">
+ <pathelement
location="${build.lib}/jboss-unit-tooling-lib.jar"/>
+ <pathelement
location="${build.lib}/jboss-unit-tooling-test.jar"/>
+ <path refid="dependentmodule.classpath"/>
+ </path>
+ <taskdef
+ name="jboss-unit"
+ classname="org.jboss.unit.tooling.ant.JBossUnitTask"
+ classpathref="jboss.unit.tooling.test.classpath"/>
+ <taskdef
+ name="tests"
+ classname="org.jboss.unit.tooling.ant.TestsTask"
+ classpathref="jboss.unit.tooling.test.classpath"/>
+ <taskdef
+ name="include"
+ classname="org.jboss.unit.tooling.ant.IncludeTask"
+ classpathref="jboss.unit.tooling.test.classpath" />
+ <taskdef
+ name="exclude"
+ classname="org.jboss.unit.tooling.ant.ExcludeTask"
+ classpathref="jboss.unit.tooling.test.classpath"/>
+
+ <jboss-unit>
+
+ <tests
config="/home/bdaw/Workshop/JBoss/portal/modules/test/trunk/tooling/output/resources/test/bobo-tests.xml">
+ <include names="testOne,otherTestOne"/>
+ <exclude namePatterns="test.*"/>
+ </tests>
+
+ <tests config="./output/resources/test/bobo-tests.xml">
+ <include namePatterns="other.*,test.*"/>
+ <exclude id="otherTestTwo"/>
+ </tests>
+
+ <tests config="./output/resources/test/bobo-tests.xml">
+ <!-- invoke all -->
+ <include names="testOne"/>
+ <include names="otherTestOne"/>
+ <exclude namePatterns="test.*"/>
+ </tests>
+
+ <tests config="output/resources/test/bobo-tests.xml">
+ <include id="otherTestOne"/>
+ <include id="testOne"/>
+ <include id="otherTestTwo"/>
+ </tests>
+
+ <classpath>
+
+ <path location="${build.lib}/jboss-unit-tooling-lib.jar"/>
+ <path location="${build.lib}/jboss-unit-tooling-test.jar"/>
+ <path refid="dependentmodule.classpath"/>
+
+ </classpath>
+
+
+ </jboss-unit >
+
+
+
+ </target>
+
+</project>
Property changes on: modules/test/trunk/tooling/build.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java 2007-10-07
22:51:25 UTC (rev 8555)
@@ -0,0 +1,57 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.test.unit.tooling.bobo;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class BoboTest1
+{
+ @Test(name = "testOne")
+ public void test1()
+ {
+ System.out.println("Executed testOne");
+ }
+
+ @Test(name = "testTwo")
+ public void test2()
+ {
+ System.out.println("Executed testTwo");
+
+ }
+
+ @Test(name = "otherTestOne")
+ public void test3()
+ {
+ System.out.println("Executed otherTestOne");
+ }
+
+ @Test(name = "otherTestTwo")
+ public void test4()
+ {
+ System.out.println("Executed otherTestTwo");
+ }
+}
Added: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java 2007-10-07
22:51:25 UTC (rev 8555)
@@ -0,0 +1,85 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.unit.tooling.ant;
+
+import org.apache.tools.ant.Task;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class ExcludeTask extends Task
+{
+ private String id;
+
+ private String names;
+
+ private String namePatterns;
+
+ private String keywords;
+
+
+ public ExcludeTask()
+ {
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getNames()
+ {
+ return names;
+ }
+
+ public void setNames(String names)
+ {
+ this.names = names;
+ }
+
+ public String getNamePatterns()
+ {
+ return namePatterns;
+ }
+
+ public void setNamePatterns(String namePatterns)
+ {
+ this.namePatterns = namePatterns;
+ }
+
+ public String getKeywords()
+ {
+ return keywords;
+ }
+
+ public void setKeywords(String keywords)
+ {
+ this.keywords = keywords;
+ }
+}
Added: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java 2007-10-07
22:51:25 UTC (rev 8555)
@@ -0,0 +1,85 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.unit.tooling.ant;
+
+import org.apache.tools.ant.Task;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class IncludeTask extends Task
+{
+ private String id;
+
+ private String names;
+
+ private String namePatterns;
+
+ private String keywords;
+
+
+ public IncludeTask()
+ {
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getNames()
+ {
+ return names;
+ }
+
+ public void setNames(String names)
+ {
+ this.names = names;
+ }
+
+ public String getNamePatterns()
+ {
+ return namePatterns;
+ }
+
+ public void setNamePatterns(String namePatterns)
+ {
+ this.namePatterns = namePatterns;
+ }
+
+ public String getKeywords()
+ {
+ return keywords;
+ }
+
+ public void setKeywords(String keywords)
+ {
+ this.keywords = keywords;
+ }
+}
Added: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java 2007-10-07
22:51:25 UTC (rev 8555)
@@ -0,0 +1,75 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.unit.tooling.ant;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Path;
+
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class JBossUnitTask extends Task
+{
+
+ List<TestsTask> testsTasks = new LinkedList();
+
+ private Path path;
+
+ public JBossUnitTask()
+ {
+ }
+
+ public void addConfiguredTests(TestsTask tests)
+ {
+ testsTasks.add(tests);
+ }
+
+ public void addConfiguredClasspath(Path path)
+ {
+ System.out.println("Adding path: " + path.toString());
+ this.path = path;
+ }
+
+ public void execute() throws BuildException
+ {
+ System.out.println("Executing JBossUnit. tests: " + testsTasks.size());
+ for (TestsTask testsTask : testsTasks)
+ {
+
+ // Local classpath for tests overide the global one
+ if (testsTask.getClasspath() == null && path != null)
+ {
+ testsTask.addConfiguredClasspath(path);
+ }
+
+ testsTask.execute();
+ }
+ }
+
+
+}
Added:
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TaskExecutingThread.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TaskExecutingThread.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TaskExecutingThread.java 2007-10-07
22:51:25 UTC (rev 8555)
@@ -0,0 +1,50 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.unit.tooling.ant;
+
+import org.apache.tools.ant.taskdefs.Java;
+import org.apache.tools.ant.Task;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class TaskExecutingThread extends Thread
+{
+
+ private Task task;
+
+ private TaskExecutingThread()
+ {
+ }
+
+ public TaskExecutingThread(Task task)
+ {
+ this.task = task;
+ }
+
+ public void run()
+ {
+ this.task.execute();
+ }
+}
Added: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java 2007-10-07
22:51:25 UTC (rev 8555)
@@ -0,0 +1,270 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.unit.tooling.ant;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.taskdefs.Java;
+import org.jboss.unit.tooling.IncludeTestFilter;
+import org.jboss.unit.tooling.ExcludeTestFilter;
+import org.jboss.unit.tooling.MainTestFilter;
+import org.jboss.unit.tooling.MainBuilder;
+import org.jboss.unit.tooling.Main;
+import org.jboss.unit.tooling.InfoTestFilter;
+import org.jboss.unit.runner.TestFilter;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class TestsTask extends Task
+{
+ private String config;
+
+ private boolean fork = true;
+
+ private List<IncludeTask> includes = new LinkedList();
+
+ private List<ExcludeTask> excludes = new LinkedList();
+
+ private Path path;
+
+
+ public TestsTask()
+ {
+ }
+
+
+ public void execute() throws BuildException
+ {
+ System.out.println("Executing Task. Includes: " + includes.size() +
" excludes: " + excludes.size() + " config: " + config);
+
+ //Evaluate all the include filters
+
+ Java javaTask = createJava();
+
+ addArguments(javaTask);
+
+
+
+ javaTask.setClassname("org.jboss.unit.tooling.Main");
+
+ try
+ {
+ System.out.println("Invoking java: " +
javaTask.getCommandLine().toString());
+ TaskExecutingThread executor = new TaskExecutingThread(javaTask);
+ executor.run();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+ private Java createJava()
+ {
+ Java javaTask = null;
+ try
+ {
+ javaTask = (Java)getProject().createTask("java");
+
+
+ // Apply task classpath
+ if (getClasspath() != null)
+ {
+ Path javaPath = javaTask.createClasspath();
+ javaPath.add(getClasspath());
+ }
+
+ // Set fork
+ if (isFork())
+ {
+ javaTask.setFork(true);
+ }
+
+
+
+ }
+ catch (BuildException e)
+ {
+ throw new IllegalStateException("Failed to create <java> ant task:
", e);
+ }
+
+ return javaTask;
+ }
+
+ private void addArguments(Java javaTask)
+ {
+ javaTask.createArg().setValue(Main.OPT_CONFIG + "=" + config);
+
+ //TODO: change bilto
+ javaTask.createArg().setValue(Main.OPT_SUITE_NAME + "=" +
"bilto");
+
+
+ // Filters to aggregate all the values
+ IncludeTestFilter includeFilter = new IncludeTestFilter();
+
+ ExcludeTestFilter excludeFilter = new ExcludeTestFilter();
+
+ for (IncludeTask include : includes)
+ {
+ if (include.getNames() != null)
+ {
+ includeFilter.addUnparsedNames(include.getNames());
+ }
+ if (include.getKeywords() != null)
+ {
+ includeFilter.addUnparsedKeywords(include.getKeywords());
+ }
+ if (include.getNamePatterns() != null)
+ {
+ includeFilter.addUnparsedNamePatterns(include.getNamePatterns());
+ }
+ if (include.getId() != null)
+ {
+ includeFilter.addUnparsedNames(include.getId());
+ }
+ }
+
+ if (includeFilter.getNames().size() != 0)
+ {
+ javaTask.createArg().setValue(generateArgument(includeFilter.getNames(),
Main.OPT_NAMES));
+ }
+
+ if (includeFilter.getNamePatterns().size() != 0)
+ {
+ javaTask.createArg().setValue(generateArgument(includeFilter.getNamePatterns(),
Main.OPT_PATTERNS));
+ }
+
+ if (includeFilter.getKeywords().size() != 0)
+ {
+ javaTask.createArg().setValue(generateArgument(includeFilter.getKeywords(),
Main.OPT_KEYWORDS));
+ }
+
+
+// List<TestFilter> excludeFilters = new LinkedList<TestFilter>();
+
+ for (ExcludeTask exclude : excludes)
+ {
+ if (exclude.getNames() != null)
+ {
+ excludeFilter.addUnparsedNames(exclude.getNames());
+ }
+ if (exclude.getKeywords() != null)
+ {
+ excludeFilter.addUnparsedKeywords(exclude.getKeywords());
+ }
+ if (exclude.getNamePatterns() != null)
+ {
+ excludeFilter.addUnparsedNamePatterns(exclude.getNamePatterns());
+ }
+ if (exclude.getId() != null)
+ {
+ excludeFilter.addUnparsedNames(exclude.getId());
+ }
+ }
+
+ if (excludeFilter.getNames().size() != 0)
+ {
+ javaTask.createArg().setValue(generateArgument(excludeFilter.getNames(),
Main.OPT_EX_NAMES));
+ }
+
+ if (excludeFilter.getNamePatterns().size() != 0)
+ {
+ javaTask.createArg().setValue(generateArgument(excludeFilter.getNamePatterns(),
Main.OPT_EX_PATTERNS));
+ }
+
+ if (excludeFilter.getKeywords().size() != 0)
+ {
+ javaTask.createArg().setValue(generateArgument(excludeFilter.getKeywords(),
Main.OPT_EX_KEYWORDS));
+ }
+ }
+
+ private String generateArgument(Set<String> values, String argumentName)
+ {
+
+ StringBuffer argument = new StringBuffer(argumentName).append("=");
+ for (String s : values)
+ {
+ argument.append(s).append(",");
+ }
+ // Remove last ','
+ argument.deleteCharAt(argument.length() - 1);
+ return argument.toString();
+ }
+
+
+ public void addConfiguredInclude(IncludeTask include)
+ {
+ includes.add(include);
+ }
+
+ public void addConfiguredExclude(ExcludeTask exclude)
+ {
+ excludes.add(exclude);
+ }
+
+ public void addTask(Task task)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(String config)
+ {
+ this.config = config;
+ }
+
+
+ public Path getClasspath()
+ {
+ return path;
+ }
+
+ public void addConfiguredClasspath(Path path)
+ {
+ this.path = path;
+ }
+
+
+ public boolean isFork()
+ {
+ return fork;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+}
Added: modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
===================================================================
--- modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
(rev 0)
+++ modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-07 22:51:25 UTC
(rev 8555)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-unit PUBLIC
+ "-//JBoss Portal//JBoss Unit 1.0//EN"
+ "http://www.jboss.org/portal/dtd/jboss-unit.dtd">
+<jboss-unit>
+ <pojo>
+ <test-def id="bobo">
+ <class name="org.jboss.test.unit.tooling.bobo.BoboTest1"/>
+ </test-def>
+ <test refid="bobo">
+ </test>
+ </pojo>
+</jboss-unit>
\ No newline at end of file