JBoss Portal SVN: r8557 - in modules/test/trunk/tooling: src/main/org/jboss/unit/tooling/ant and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-08 08:12:52 -0400 (Mon, 08 Oct 2007)
New Revision: 8557
Modified:
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java
Log:
remove unneeded taskdef and typedef
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-07 23:14:52 UTC (rev 8556)
+++ modules/test/trunk/tooling/build.xml 2007-10-08 12:12:52 UTC (rev 8557)
@@ -211,19 +211,8 @@
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"/>
- <typedef
- name="include"
- classname="org.jboss.unit.tooling.ant.IncludeTask"
- classpathref="jboss.unit.tooling.test.classpath" />
- <typedef
- 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">
Modified: 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 2007-10-07 23:14:52 UTC (rev 8556)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java 2007-10-08 12:12:52 UTC (rev 8557)
@@ -46,6 +46,7 @@
public void addConfiguredTests(TestsTask tests)
{
+ tests.setProject(getProject());
testsTasks.add(tests);
}
Modified: 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 2007-10-07 23:14:52 UTC (rev 8556)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java 2007-10-08 12:12:52 UTC (rev 8557)
@@ -24,6 +24,7 @@
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.taskdefs.Java;
import org.jboss.unit.tooling.IncludeTestFilter;
@@ -43,7 +44,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
*/
-public class TestsTask extends Task
+public class TestsTask
{
private String config;
@@ -53,6 +54,8 @@
private List<ExcludeTask> excludes = new LinkedList();
+ private Project project;
+
private Path path;
@@ -93,6 +96,12 @@
Java javaTask = null;
try
{
+
+ if (getProject() == null)
+ {
+ throw new IllegalStateException("Current project is missing. Task was not setup properly");
+ }
+
javaTask = (Java)getProject().createTask("java");
@@ -267,4 +276,15 @@
{
this.fork = fork;
}
+
+
+ public Project getProject()
+ {
+ return project;
+ }
+
+ public void setProject(Project project)
+ {
+ this.project = project;
+ }
}
16 years, 8 months
JBoss Portal SVN: r8556 - in modules/test/trunk/tooling: src/main/org/jboss/unit/tooling/ant and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-07 19:14:52 -0400 (Sun, 07 Oct 2007)
New Revision: 8556
Modified:
modules/test/trunk/tooling/build.xml
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/TestsTask.java
Log:
make <include> and <exclude> types instead of tasks
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-07 22:51:25 UTC (rev 8555)
+++ modules/test/trunk/tooling/build.xml 2007-10-07 23:14:52 UTC (rev 8556)
@@ -215,11 +215,11 @@
name="tests"
classname="org.jboss.unit.tooling.ant.TestsTask"
classpathref="jboss.unit.tooling.test.classpath"/>
- <taskdef
+ <typedef
name="include"
classname="org.jboss.unit.tooling.ant.IncludeTask"
classpathref="jboss.unit.tooling.test.classpath" />
- <taskdef
+ <typedef
name="exclude"
classname="org.jboss.unit.tooling.ant.ExcludeTask"
classpathref="jboss.unit.tooling.test.classpath"/>
Modified: 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 2007-10-07 22:51:25 UTC (rev 8555)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java 2007-10-07 23:14:52 UTC (rev 8556)
@@ -28,7 +28,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
*/
-public class ExcludeTask extends Task
+public class ExcludeTask
{
private String id;
Modified: 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 2007-10-07 22:51:25 UTC (rev 8555)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java 2007-10-07 23:14:52 UTC (rev 8556)
@@ -28,7 +28,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
*/
-public class IncludeTask extends Task
+public class IncludeTask
{
private String id;
Modified: 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 2007-10-07 22:51:25 UTC (rev 8555)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java 2007-10-07 23:14:52 UTC (rev 8556)
@@ -43,7 +43,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
*/
-public class TestsTask extends Task
+public class TestsTask extends Task
{
private String config;
16 years, 8 months
JBoss Portal SVN: r8555 - in modules/test/trunk: tooling and 13 other directories.
by portal-commits@lists.jboss.org
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
16 years, 8 months
JBoss Portal SVN: r8554 - modules/test/trunk/build.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-07 18:47:08 -0400 (Sun, 07 Oct 2007)
New Revision: 8554
Modified:
modules/test/trunk/build/build-thirdparty.xml
Log:
add ant jars to thirdparty
Modified: modules/test/trunk/build/build-thirdparty.xml
===================================================================
--- modules/test/trunk/build/build-thirdparty.xml 2007-10-07 22:45:55 UTC (rev 8553)
+++ modules/test/trunk/build/build-thirdparty.xml 2007-10-07 22:47:08 UTC (rev 8554)
@@ -49,6 +49,8 @@
<componentref name="jboss-portal/modules/common" version="1.0.0-SNAPSHOT"/>
+ <componentref name="apache-ant" version="1.6.5"/>
+
<componentref name="codehaus/cargo" version="0.9-portal"/>
<componentref name="testng" version="5.5"/>
16 years, 8 months
JBoss Portal SVN: r8553 - modules/test/trunk/build/ide/intellij/idea60/modules/unit.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-07 18:45:55 -0400 (Sun, 07 Oct 2007)
New Revision: 8553
Added:
modules/test/trunk/build/ide/intellij/idea60/modules/unit/tooling.iml
Log:
IDEA file for tooling module
Added: modules/test/trunk/build/ide/intellij/idea60/modules/unit/tooling.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/unit/tooling.iml (rev 0)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/unit/tooling.iml 2007-10-07 22:45:55 UTC (rev 8553)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../../../../../tooling">
+ <sourceFolder url="file://$MODULE_DIR$/../../../../../../tooling/src/main" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../../../../tooling/output" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-ant/lib/ant-launcher.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-ant/lib/ant.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module" module-name="unit" />
+ <orderEntryProperties />
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="ACTIVE_VCS_NAME" value="svn" />
+ <option name="USE_PROJECT_VCS" value="false" />
+ </component>
+</module>
+
16 years, 8 months
JBoss Portal SVN: r8552 - in modules/test/trunk: unit and 7 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-07 18:44:24 -0400 (Sun, 07 Oct 2007)
New Revision: 8552
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/console/
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/console/PrintListener.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/ExcludeTestFilter.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/IncludeTestFilter.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/InfoTestFilter.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainTestFilter.java
Removed:
modules/test/trunk/unit/src/main/org/jboss/test/unit/PrintListener.java
Modified:
modules/test/trunk/tools/etc/buildfragments/defaults.ent
modules/test/trunk/tools/etc/buildfragments/modules.ent
modules/test/trunk/unit/build.xml
modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTests.java
Log:
command line part of tolling support for jboss unit test framework (initial stuff)
Modified: modules/test/trunk/tools/etc/buildfragments/defaults.ent
===================================================================
--- modules/test/trunk/tools/etc/buildfragments/defaults.ent 2007-10-05 19:45:41 UTC (rev 8551)
+++ modules/test/trunk/tools/etc/buildfragments/defaults.ent 2007-10-07 22:44:24 UTC (rev 8552)
@@ -118,8 +118,8 @@
<property name="javac.depend.cachedir" value="${build.cache}/depends"/>
- <property name="javac.source" value="1.4"/>
- <property name="javac.target" value="1.4"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="javac.target" value="1.5"/>
<property name="rmic.stubVersion" value="1.2"/>
<!-- classpath and local.classpath must have a value using with a path -->
Modified: modules/test/trunk/tools/etc/buildfragments/modules.ent
===================================================================
--- modules/test/trunk/tools/etc/buildfragments/modules.ent 2007-10-05 19:45:41 UTC (rev 8551)
+++ modules/test/trunk/tools/etc/buildfragments/modules.ent 2007-10-07 22:44:24 UTC (rev 8552)
@@ -199,4 +199,11 @@
<path id="jboss.portal-samples.classpath">
<pathelement path="${jboss.portal-samples.lib}/portal-samples-lib.jar"/>
</path>
+
+ <!-- unit module -->
+ <property name="jboss.unit.root" value="${project.root}/unit/output"/>
+ <property name="jboss.unit.lib" value="${jboss.unit.root}/lib"/>
+ <path id="jboss.unit.classpath">
+ <pathelement path="${jboss.unit.lib}/jboss-unit-lib.jar"/>
+ </path>
</target>
Modified: modules/test/trunk/unit/build.xml
===================================================================
--- modules/test/trunk/unit/build.xml 2007-10-05 19:45:41 UTC (rev 8551)
+++ modules/test/trunk/unit/build.xml 2007-10-07 22:44:24 UTC (rev 8552)
@@ -85,6 +85,7 @@
<!-- Configure thirdparty libraries -->
&libraries;
<path id="library.classpath">
+
</path>
<!-- Configure modules -->
Deleted: modules/test/trunk/unit/src/main/org/jboss/test/unit/PrintListener.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/PrintListener.java 2007-10-05 19:45:41 UTC (rev 8551)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/PrintListener.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -1,88 +0,0 @@
-/******************************************************************************
- * 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;
-
-import org.jboss.unit.Failure;
-import org.jboss.unit.TestId;
-import org.jboss.unit.runner.TestResult;
-import org.jboss.unit.runner.TestRunnerEvent;
-import org.jboss.unit.runner.TestRunnerEventListener;
-import org.jboss.unit.runner.event.EndRunnerEvent;
-import org.jboss.unit.runner.event.EndTestEvent;
-import org.jboss.unit.runner.event.RunnerFailureEvent;
-import org.jboss.unit.runner.event.StartRunnerEvent;
-import org.jboss.unit.runner.event.StartTestEvent;
-import org.jboss.unit.runner.results.TestFailure;
-import org.jboss.unit.runner.results.TestSuccess;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PrintListener implements TestRunnerEventListener
-{
-
- public void onEvent(TestRunnerEvent event)
- {
- if (event instanceof StartRunnerEvent)
- {
- System.out.println("--- Start ---");
- }
- else if (event instanceof EndRunnerEvent)
- {
- System.out.println("--- End ---");
- }
- else if (event instanceof RunnerFailureEvent)
- {
- RunnerFailureEvent failureEvent = (RunnerFailureEvent)event;
- Failure failure = failureEvent.getFailure();
- System.out.println("Runner failure: " + failure.getType() + " " + failure.getMessage());
- }
- else if (event instanceof StartTestEvent)
- {
- StartTestEvent startTestEvent = (StartTestEvent)event;
- System.out.println("Starting id=" + startTestEvent.getTestId() + " name=" + startTestEvent.getTestInfo().getName() + " description=" + startTestEvent.getTestInfo().getDescription());
- }
- else if (event instanceof EndTestEvent)
- {
- EndTestEvent endTestEvent = (EndTestEvent)event;
- TestId testId = endTestEvent.getTestId();
- TestResult testResult = endTestEvent.getTestResult();
- if (testResult instanceof TestSuccess)
- {
- System.out.println("Test id=" + testId + " is successful");
- }
- else if (testResult instanceof TestFailure)
- {
- TestFailure testFailure = (TestFailure)testResult;
- Failure failure = testFailure.getFailure();
- System.out.println("Test id=" + testId + " " + failure.getType() + " failed " + failure.getMessage());
- if (failure.getCause() != null)
- {
- failure.getCause().printStackTrace();
- }
- }
- }
-
- }
-}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java 2007-10-05 19:45:41 UTC (rev 8551)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -24,7 +24,7 @@
import java.io.InputStream;
-import org.jboss.test.unit.PrintListener;
+import org.jboss.unit.report.impl.console.PrintListener;
import org.jboss.unit.report.junit.JUnitReporter;
import org.jboss.unit.runner.TestRunner;
import org.jboss.unit.runner.TestRunnerEventListener;
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTests.java 2007-10-05 19:45:41 UTC (rev 8551)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTests.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.blah;
-import org.jboss.test.unit.PrintListener;
+import org.jboss.unit.report.impl.console.PrintListener;
import org.jboss.unit.runner.TestRunner;
import org.jboss.unit.runner.model.ModelBuilder;
import org.jboss.unit.runner.model.TestSuiteDef;
Added: modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/console/PrintListener.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/console/PrintListener.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/console/PrintListener.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * 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.report.impl.console;
+
+import org.jboss.unit.Failure;
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.TestResult;
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.event.EndRunnerEvent;
+import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.RunnerFailureEvent;
+import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.results.TestFailure;
+import org.jboss.unit.runner.results.TestSuccess;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PrintListener implements TestRunnerEventListener
+{
+
+ public void onEvent(TestRunnerEvent event)
+ {
+ if (event instanceof StartRunnerEvent)
+ {
+ System.out.println("--- Start ---");
+ }
+ else if (event instanceof EndRunnerEvent)
+ {
+ System.out.println("--- End ---");
+ }
+ else if (event instanceof RunnerFailureEvent)
+ {
+ RunnerFailureEvent failureEvent = (RunnerFailureEvent)event;
+ Failure failure = failureEvent.getFailure();
+ System.out.println("Runner failure: " + failure.getType() + " " + failure.getMessage());
+ failure.getCause().printStackTrace();
+ }
+ else if (event instanceof StartTestEvent)
+ {
+ StartTestEvent startTestEvent = (StartTestEvent)event;
+ System.out.println("Starting id=" + startTestEvent.getTestId() + " name=" + startTestEvent.getTestInfo().getName() + " description=" + startTestEvent.getTestInfo().getDescription());
+ }
+ else if (event instanceof EndTestEvent)
+ {
+ EndTestEvent endTestEvent = (EndTestEvent)event;
+ TestId testId = endTestEvent.getTestId();
+ TestResult testResult = endTestEvent.getTestResult();
+ if (testResult instanceof TestSuccess)
+ {
+ System.out.println("Test id=" + testId + " is successful");
+ }
+ else if (testResult instanceof TestFailure)
+ {
+ TestFailure testFailure = (TestFailure)testResult;
+ Failure failure = testFailure.getFailure();
+ System.out.println("Test id=" + testId + " " + failure.getType() + " failed " + failure.getMessage());
+ if (failure.getCause() != null)
+ {
+ failure.getCause().printStackTrace();
+ }
+ }
+ }
+
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/ExcludeTestFilter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/ExcludeTestFilter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/ExcludeTestFilter.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,78 @@
+/*
+* 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;
+
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.TestFilter;
+import org.jboss.unit.info.TestInfo;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class ExcludeTestFilter extends InfoTestFilter
+{
+
+
+ public ExcludeTestFilter()
+ {
+ }
+
+ public ExcludeTestFilter(Set<String> keywords, Set<String> names, Set<String> namePatterns)
+ {
+ super(keywords, names, namePatterns);
+ }
+
+ public boolean include(TestId testId, TestInfo testInfo)
+ {
+ // First check names
+
+ if (checkName(testInfo.getName()))
+ {
+ return false;
+ }
+
+ // ... then keywords
+
+ if (checkKeywords(testInfo.getKeywords()))
+ {
+ return false;
+ }
+
+ // ... then check if name matches any of provided regex
+
+ if (checkNamePatterns(testInfo.getName()))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+
+
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/IncludeTestFilter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/IncludeTestFilter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/IncludeTestFilter.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,77 @@
+/*
+* 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;
+
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.TestFilter;
+import org.jboss.unit.info.TestInfo;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class IncludeTestFilter extends InfoTestFilter
+{
+
+
+ public IncludeTestFilter()
+ {
+ }
+
+ public IncludeTestFilter(Set<String> keywords, Set<String> names, Set<String> namePatterns)
+ {
+ super(keywords, names, namePatterns);
+ }
+
+ public boolean include(TestId testId, TestInfo testInfo)
+ {
+
+ // First check names
+
+ if (checkName(testInfo.getName()))
+ {
+ return true;
+ }
+
+ // ... then keywords
+
+ if (checkKeywords(testInfo.getKeywords()))
+ {
+ return true;
+ }
+
+ // ... then check if name matches any of provided regex
+
+ if (checkNamePatterns(testInfo.getName()))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/InfoTestFilter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/InfoTestFilter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/InfoTestFilter.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,226 @@
+/*
+* 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;
+
+import org.jboss.unit.runner.TestFilter;
+import org.jboss.unit.TestId;
+import org.jboss.unit.info.TestInfo;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public abstract class InfoTestFilter implements TestFilter
+{
+
+ private Set<String> keywords = new HashSet<String>();
+
+ private Set<String> names = new HashSet<String>();
+
+ private Set<String> namePatterns = new HashSet<String>();
+
+ public InfoTestFilter()
+ {
+ }
+
+ public InfoTestFilter(Set<String> keywords, Set<String> names, Set<String> namePatterns)
+ {
+ if (keywords == null)
+ {
+ throw new IllegalArgumentException("keywords cannot be null");
+ }
+ if (names == null)
+ {
+ throw new IllegalArgumentException("names cannot be null");
+ }
+ if (namePatterns == null)
+ {
+ throw new IllegalArgumentException("namePatterns cannot be null");
+ }
+
+ this.keywords = keywords;
+ this.names = names;
+ this.namePatterns = namePatterns;
+ }
+
+ public InfoTestFilter addKeyword(String keyword)
+ {
+ if (keyword == null)
+ {
+ throw new IllegalArgumentException("keyword cannot be null");
+ }
+
+ keywords.add(keyword);
+
+ return this;
+ }
+
+
+ public InfoTestFilter addUnparsedKeywords(String keywordsString)
+ {
+ if (keywordsString == null)
+ {
+ throw new IllegalArgumentException("keywordsString cannot be null");
+ }
+ String[] keywordValues = keywordsString.split(",");
+ for (String keyword : keywordValues)
+ {
+ this.keywords.add(keyword.trim());
+ }
+ return this;
+ }
+
+ public InfoTestFilter addName(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+ names.add(name);
+
+ return this;
+ }
+
+ public InfoTestFilter addUnparsedNames(String namesString)
+ {
+ if (namesString == null)
+ {
+ throw new IllegalArgumentException("namesString cannot be null");
+ }
+ String[] namesValues = namesString.split(",");
+ for (String name : namesValues)
+ {
+ this.names.add(name.trim());
+ }
+ return this;
+ }
+
+ public InfoTestFilter addNamePattern(String pattern)
+ {
+ if (pattern == null)
+ {
+ throw new IllegalArgumentException("pattern cannot be null");
+ }
+ namePatterns.add(pattern);
+
+ return this;
+ }
+
+ public InfoTestFilter addUnparsedNamePatterns(String patternString)
+ {
+ if (patternString == null)
+ {
+ throw new IllegalArgumentException("patternString cannot be null");
+ }
+ String[] patternValues = patternString.split(",");
+ for (String pattern : patternValues)
+ {
+ this.namePatterns.add(pattern.trim());
+ }
+ return this;
+ }
+
+ public abstract boolean include(TestId testId, TestInfo testInfo);
+
+ public boolean include(TestId testId, Map<String, String> parametrization, TestInfo testInfo)
+ {
+ // At the moment no parametrization match
+
+ return include (testId, testInfo);
+ }
+
+ boolean checkName(String name)
+ {
+ for (String s : names)
+ {
+ if (s.equals(name))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ boolean checkKeywords(Set<String> keywords)
+ {
+ for (String keyword : this.keywords)
+ {
+ for (String toMatch : keywords)
+ {
+ if (keyword.equals(toMatch))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ boolean checkNamePatterns(String name)
+ {
+ for (String regex : this.namePatterns)
+ {
+ if (name.matches(regex))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Filter: ")
+ .append(getClass().getName())
+ .append("; names: ")
+ .append(names.toString())
+ .append("; keywords: ")
+ .append(keywords.toString())
+ .append("; namePatterns: ")
+ .append(namePatterns.toString())
+ .append(";");
+ return sb.toString();
+ }
+
+
+ public Set<String> getKeywords()
+ {
+ return keywords;
+ }
+
+ public Set<String> getNames()
+ {
+ return names;
+ }
+
+ public Set<String> getNamePatterns()
+ {
+ return namePatterns;
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,218 @@
+/*
+* 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;
+
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.TestRunner;
+import org.jboss.unit.runner.model.TestSuiteDef;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class Main
+{
+
+ private final MainTestFilter mainFilter;
+
+ private final Set<TestRunnerEventListener> listeners;
+
+ private final TestRunner runner;
+
+ private final TestSuiteDef suiteDef;
+
+// public static final String JBOSS_UNIT_NAMES = "jboss.unit.names";
+//
+// public static final String JBOSS_UNIT_KEYWORDS = "jboss.unit.keywords";
+//
+// public static final String JBOSS_UNIT_PATTERNS = "jboss.unit.patterns";
+//
+// public static final String JBOSS_UNIT_CONFIG = "jboss.unit.config";
+//
+// public static final String JBOSS_UNIT_SUITE_NAME = "jboss.unit.suite_name";
+
+ public static final String OPT_ID = "--id";
+
+ public static final String OPT_NAMES = "--names";
+
+ public static final String OPT_KEYWORDS = "--keywords";
+
+ public static final String OPT_PATTERNS = "--patterns";
+
+ public static final String OPT_EX_ID = "--ex_id";
+
+ public static final String OPT_EX_NAMES = "--ex_names";
+
+ public static final String OPT_EX_KEYWORDS = "--ex_keywords";
+
+ public static final String OPT_EX_PATTERNS = "--ex_patterns";
+
+ public static final String OPT_CONFIG = "--config";
+
+ public static final String OPT_SUITE_NAME = "--suite_name";
+
+ public static final String OPT_NO_CONSOLE = "--noconsole";
+
+ public static final String OPT_XML_REPORT_DIR = "--xml_report_dir";
+
+ public static final String OPT_HTML_REPORT_DIR = "--html_report_dir";
+
+ public static final Set options;
+
+ static {
+ Set<String> opts = new HashSet<String>();
+ opts.add(OPT_ID);
+ opts.add(OPT_NAMES);
+ opts.add(OPT_KEYWORDS);
+ opts.add(OPT_PATTERNS);
+ opts.add(OPT_EX_ID);
+ opts.add(OPT_EX_NAMES);
+ opts.add(OPT_EX_KEYWORDS);
+ opts.add(OPT_EX_PATTERNS);
+ opts.add(OPT_CONFIG);
+ opts.add(OPT_SUITE_NAME);
+
+ options = Collections.unmodifiableSet(opts);
+ }
+
+ private Main()
+ {
+ mainFilter = null;
+ listeners = null;
+ runner = null;
+ suiteDef = null;
+ }
+
+ public Main(TestRunner runner, MainTestFilter mainFilter, Set<TestRunnerEventListener> listeners, TestSuiteDef suiteDef)
+ {
+ if (runner == null)
+ {
+ throw new IllegalArgumentException("runner cannot be null");
+ }
+
+ if (mainFilter == null)
+ {
+ throw new IllegalArgumentException("mainFilter cannot be null");
+ }
+
+ if (listeners == null)
+ {
+ throw new IllegalArgumentException("listeners cannot be null");
+ }
+
+ if (suiteDef == null)
+ {
+ throw new IllegalArgumentException("suiteDef cannot be null");
+ }
+
+ this.mainFilter = mainFilter;
+ this.listeners = listeners;
+ this.runner = runner;
+ this.suiteDef = suiteDef;
+ }
+
+ public void execute()
+ {
+ runner.run(mainFilter);
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ Map<String, String> arguments = new HashMap();
+
+ for (String arg : args)
+ {
+ String[] params = arg.split("=",2);
+ if (params.length < 2)
+ {
+ throw new IllegalArgumentException("Argument '" + arg + "' doesn't follow the name=value pattern");
+ }
+ arguments.put(params[0], params[1]);
+ }
+
+ if (!arguments.keySet().contains(OPT_CONFIG))
+ {
+ throw new IllegalArgumentException("Argument '" + OPT_CONFIG + "' is missing");
+ }
+
+ if (!arguments.keySet().contains(OPT_SUITE_NAME))
+ {
+ throw new IllegalArgumentException("Argument '" + OPT_SUITE_NAME + "' is missing");
+ }
+
+ MainBuilder builder = new MainBuilder(arguments.get(OPT_CONFIG), arguments.get(OPT_SUITE_NAME));
+
+ if (arguments.keySet().contains(OPT_NAMES))
+ {
+ builder.addUnparsedNames(arguments.get(OPT_NAMES));
+ }
+
+ if (arguments.keySet().contains(OPT_ID))
+ {
+ builder.addName(arguments.get(OPT_ID));
+ }
+
+ if (arguments.keySet().contains(OPT_KEYWORDS))
+ {
+ builder.addUnparsedKeywords(arguments.get(OPT_KEYWORDS));
+ }
+
+ if (arguments.keySet().contains(OPT_PATTERNS))
+ {
+ builder.addUnparsedNamePatterns(arguments.get(OPT_PATTERNS));
+ }
+
+ if (arguments.keySet().contains(OPT_EX_NAMES))
+ {
+ builder.addUnparsedExcludeNames(arguments.get(OPT_EX_NAMES));
+ }
+
+ if (arguments.keySet().contains(OPT_EX_ID))
+ {
+ builder.addExcludeName(arguments.get(OPT_EX_ID));
+ }
+
+ if (arguments.keySet().contains(OPT_EX_KEYWORDS))
+ {
+ builder.addUnparsedExcludeKeywords(arguments.get(OPT_EX_KEYWORDS));
+ }
+
+ if (arguments.keySet().contains(OPT_EX_PATTERNS))
+ {
+ builder.addUnparsedExcludeNamePatterns(arguments.get(OPT_EX_PATTERNS));
+ }
+
+
+ Main main = builder.build();
+
+ main.execute();
+
+
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,308 @@
+/*
+* 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;
+
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.TestRunner;
+import org.jboss.unit.runner.filter.NullFilter;
+import org.jboss.unit.runner.model.ModelBuilder;
+import org.jboss.unit.runner.model.TestSuiteDef;
+import org.jboss.unit.report.junit.JUnitReporter;
+import org.jboss.unit.report.impl.console.PrintListener;
+import org.xml.sax.InputSource;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.io.InputStream;
+import java.io.FileInputStream;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class MainBuilder
+{
+
+ private Set<String> keywords = new HashSet();
+
+ private Set<String> names = new HashSet();
+
+ private Set<String> namePatterns = new HashSet();
+
+ private Set<String> excludeKeywords = new HashSet();
+
+ private Set<String> excludeNames = new HashSet();
+
+ private Set<String> excludeNamePatterns = new HashSet();
+
+ private Set<TestRunnerEventListener> listeners = new HashSet();
+
+ private String name = "noname";
+
+ private String configFile;
+
+
+ private MainBuilder()
+ {
+
+ }
+
+ public MainBuilder(String configFile, String name)
+ {
+ if (configFile == null)
+ {
+ throw new IllegalArgumentException("configFile cannot be null");
+ }
+
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+
+ this.configFile = configFile;
+ this.name = name;
+
+ }
+
+ public MainBuilder addKeyword(String keyword)
+ {
+ if (keyword == null)
+ {
+ throw new IllegalArgumentException("keyword cannot be null");
+ }
+
+ keywords.add(keyword);
+ return this;
+ }
+
+ public MainBuilder addExcludeKeyword(String keyword)
+ {
+ if (keyword == null)
+ {
+ throw new IllegalArgumentException("keyword cannot be null");
+ }
+
+ excludeKeywords.add(keyword);
+ return this;
+ }
+
+ public MainBuilder addUnparsedKeywords(String keywordsString)
+ {
+ if (keywordsString == null)
+ {
+ throw new IllegalArgumentException("keywordsString cannot be null");
+ }
+ String[] keywordValues = keywordsString.split(",");
+ for (String keyword : keywordValues)
+ {
+ this.keywords.add(keyword.trim());
+ }
+ return this;
+ }
+
+ public MainBuilder addUnparsedExcludeKeywords(String keywordsString)
+ {
+ if (keywordsString == null)
+ {
+ throw new IllegalArgumentException("keywordsString cannot be null");
+ }
+ String[] keywordValues = keywordsString.split(",");
+ for (String keyword : keywordValues)
+ {
+ this.excludeKeywords.add(keyword.trim());
+ }
+ return this;
+ }
+
+ public MainBuilder addName(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+
+ names.add(name);
+ return this;
+ }
+
+ public MainBuilder addExcludeName(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+
+ excludeNames.add(name);
+ return this;
+ }
+
+ public MainBuilder addUnparsedNames(String namesString)
+ {
+ if (namesString == null)
+ {
+ throw new IllegalArgumentException("namesString cannot be null");
+ }
+ String[] namesValues = namesString.split(",");
+ for (String name : namesValues)
+ {
+ this.names.add(name.trim());
+ }
+ return this;
+ }
+
+ public MainBuilder addUnparsedExcludeNames(String namesString)
+ {
+ if (namesString == null)
+ {
+ throw new IllegalArgumentException("namesString cannot be null");
+ }
+ String[] namesValues = namesString.split(",");
+ for (String name : namesValues)
+ {
+ this.excludeNames.add(name.trim());
+ }
+ return this;
+ }
+
+ public MainBuilder addNamePattern(String pattern)
+ {
+ if (pattern == null)
+ {
+ throw new IllegalArgumentException("pattern cannot be null");
+ }
+
+ namePatterns.add(pattern);
+ return this;
+ }
+
+ public MainBuilder addExcludeNamePattern(String pattern)
+ {
+ if (pattern == null)
+ {
+ throw new IllegalArgumentException("pattern cannot be null");
+ }
+
+ excludeNamePatterns.add(pattern);
+ return this;
+ }
+
+ public MainBuilder addUnparsedNamePatterns(String patternString)
+ {
+ if (patternString == null )
+ {
+ throw new IllegalArgumentException("patternString cannot be null");
+ }
+ String[] patternValues = patternString.split(",");
+ for (String pattern : patternValues)
+ {
+ this.namePatterns.add(pattern.trim());
+ }
+ return this;
+ }
+
+ public MainBuilder addUnparsedExcludeNamePatterns(String patternString)
+ {
+ if (patternString == null)
+ {
+ throw new IllegalArgumentException("patternString cannot be null");
+ }
+ String[] patternValues = patternString.split(",");
+ for (String pattern : patternValues)
+ {
+ this.excludeNamePatterns.add(pattern.trim());
+ }
+ return this;
+ }
+
+ public MainBuilder addJunitReporting(String directory)
+ {
+ if (directory == null)
+ {
+ throw new IllegalArgumentException("directory cannot be null");
+ }
+
+ listeners.add(new JUnitReporter(directory, name));
+
+ return this;
+ }
+
+
+ public MainBuilder addXMLReporting(String directory)
+ {
+ throw new RuntimeException("NYI");
+
+ }
+
+ public MainBuilder addHTMLReporting(String directory)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Main build() throws Exception
+ {
+
+
+ InputStream in;// = Thread.currentThread().getContextClassLoader().getResourceAsStream(configFile);
+ in = new FileInputStream(configFile);
+ InputSource source = new InputSource(in);
+ ModelBuilder builder = new ModelBuilder(source);
+ TestSuiteDef suite = builder.build();
+ TestRunner runner = suite.createRunner();
+
+ // Add listeners
+
+ for (TestRunnerEventListener listener : listeners)
+ {
+ runner.addListener(listener);
+ }
+
+ //add PrintListener by default
+ runner.addListener(new PrintListener());
+
+
+
+ MainTestFilter filter = new MainTestFilter();
+
+ if (keywords.size() == 0 && names.size() == 0 && namePatterns.size() == 0)
+ {
+ // If no conditions - add filter that match all
+
+ filter.addIncludeFilter(new NullFilter());
+ }
+ else
+ {
+ filter.addIncludeFilter(new IncludeTestFilter(keywords, names, namePatterns));
+ }
+
+ // Add exclude filter only if there is a need for one...
+
+ if (excludeKeywords.size() != 0 || excludeNames.size() != 0 || excludeNamePatterns.size() != 0)
+ {
+ filter.addExcludeFilter(new ExcludeTestFilter(excludeKeywords, excludeNames, excludeNamePatterns));
+ }
+
+
+ return new Main(runner, filter, listeners, suite);
+ }
+
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainTestFilter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainTestFilter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainTestFilter.java 2007-10-07 22:44:24 UTC (rev 8552)
@@ -0,0 +1,122 @@
+/*
+* 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;
+
+import org.jboss.unit.runner.TestFilter;
+import org.jboss.unit.TestId;
+import org.jboss.unit.info.TestInfo;
+
+import java.util.Map;
+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 MainTestFilter implements TestFilter
+{
+
+ private List<TestFilter> includeFilters = new LinkedList();
+
+ private List<TestFilter> excludeFilters = new LinkedList();
+
+
+ public MainTestFilter()
+ {
+ }
+
+ public MainTestFilter(List<TestFilter> matchFilters, List<TestFilter> excludeFilters)
+ {
+ if (matchFilters == null)
+ {
+ throw new IllegalArgumentException("includeFilters cannot be null");
+ }
+ if (excludeFilters == null)
+ {
+ throw new IllegalArgumentException("excludeFilters cannot be null");
+ }
+
+
+ this.includeFilters = matchFilters;
+ this.excludeFilters = excludeFilters;
+ }
+
+ public boolean include(TestId testId, TestInfo testInfo)
+ {
+
+ // First check if test isn't excluded
+
+ // Make logic OR on all filters
+
+ for (TestFilter ef : excludeFilters)
+ {
+ if (!ef.include(testId, testInfo))
+ {
+ return false;
+ }
+ }
+
+ // make logic OR on all match filters
+
+ for (TestFilter mf : includeFilters)
+ {
+ if (mf.include(testId, testInfo))
+ {
+ return true;
+ }
+
+ }
+
+
+ return false;
+ }
+
+ public boolean include(TestId testId, Map<String, String> parametrization, TestInfo testInfo)
+ {
+
+ // At the moment no parametrization match
+
+ return include (testId, testInfo);
+ }
+
+ public void addIncludeFilter(TestFilter filter)
+ {
+ if (filter == null)
+ {
+ throw new IllegalArgumentException("filter cannot be null");
+ }
+ includeFilters.add(filter);
+ }
+
+ public void addExcludeFilter(TestFilter filter)
+ {
+ if (filter == null)
+ {
+ throw new IllegalArgumentException("filter cannot be null");
+ }
+ excludeFilters.add(filter);
+ }
+
+
+}
16 years, 8 months
JBoss Portal SVN: r8551 - modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-05 15:45:41 -0400 (Fri, 05 Oct 2007)
New Revision: 8551
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java
Log:
- minor javadoc
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java 2007-10-05 19:40:47 UTC (rev 8550)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java 2007-10-05 19:45:41 UTC (rev 8551)
@@ -31,6 +31,9 @@
import java.lang.annotation.ElementType;
/**
+ * An annotation used to specify the test provider of a pojo. It can be used either directly on a tested pojo class
+ * or as a meta annotation for annotating an annotation of a tested pojo class.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -39,5 +42,10 @@
@Target({ElementType.ANNOTATION_TYPE,ElementType.TYPE})
public @interface Provider
{
+ /**
+ * The test provider class to use instead of the regular one.
+ *
+ * @return the test provider class
+ */
Class<? extends TestProvider> value();
}
16 years, 8 months
JBoss Portal SVN: r8549 - in modules/test/trunk/unit/src/main/org/jboss: test/unit/pojo/junit and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-05 15:39:43 -0400 (Fri, 05 Oct 2007)
New Revision: 8549
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOParameterInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestCaseInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteDriver.java
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteInfo.java
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestDriverPOJOTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
Log:
renamed org.jboss.unit.unit.pojo -> org.jboss.unit.driver.impl.pojo
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestDriverPOJOTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestDriverPOJOTests.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestDriverPOJOTests.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -23,7 +23,7 @@
package org.jboss.test.unit.pojo;
import org.jboss.unit.driver.TestDriver;
-import org.jboss.unit.unit.pojo.POJOTestSuiteDriver;
+import org.jboss.unit.driver.impl.pojo.POJOTestSuiteDriver;
import static org.jboss.unit.api.Assert.*;
/**
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.pojo.junit;
-import org.jboss.unit.unit.pojo.POJOTestSuiteDriver;
+import org.jboss.unit.driver.impl.pojo.POJOTestSuiteDriver;
import static org.jboss.unit.util.CollectionTools.*;
import static org.jboss.unit.api.Assert.*;
Added: modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOParameterInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOParameterInfo.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOParameterInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.driver.impl.pojo;
+
+import org.jboss.unit.spi.pojo.ParameterDescriptor;
+import org.jboss.unit.info.ParameterInfo;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOParameterInfo implements ParameterInfo
+{
+
+ /** . */
+ private final ParameterDescriptor descriptor;
+
+ public POJOParameterInfo(ParameterDescriptor descriptor)
+ {
+ this.descriptor = descriptor;
+ }
+
+ public String getName()
+ {
+ return descriptor.getName();
+ }
+
+ public String getDescription()
+ {
+ return descriptor.getDescription();
+ }
+
+ public List<String> getDefaultValues()
+ {
+ return descriptor.getDefaultValues();
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestCaseInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestCaseInfo.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestCaseInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.driver.impl.pojo;
+
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
+import org.jboss.unit.info.TestCaseInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOTestCaseInfo extends POJOTestInfo implements TestCaseInfo
+{
+
+ /** . */
+ private TestCaseDescriptor descriptor;
+
+ public POJOTestCaseInfo(TestCaseDescriptor descriptor)
+ {
+ super(descriptor.getParameters(), descriptor.getKeywords());
+
+ //
+ this.descriptor = descriptor;
+ }
+
+ public String getName()
+ {
+ return descriptor.getName();
+ }
+
+ public String getDescription()
+ {
+ return descriptor.getDescription();
+ }
+
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestInfo.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.driver.impl.pojo;
+
+import org.jboss.unit.info.ParameterInfo;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.spi.pojo.ParameterDescriptor;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class POJOTestInfo implements TestInfo
+{
+
+ /** . */
+ private Map<String,POJOParameterInfo> parameters;
+
+ /** . */
+ private Set<String> keywords;
+
+ public POJOTestInfo(Map<String,? extends ParameterDescriptor> parameterDescriptors, Set<String> keywords)
+ {
+ Map<String, POJOParameterInfo> parameters = new HashMap<String, POJOParameterInfo>();
+ for (ParameterDescriptor parameterDescriptor : parameterDescriptors.values())
+ {
+ POJOParameterInfo parameterInfo = new POJOParameterInfo(parameterDescriptor);
+ parameters.put(parameterInfo.getName(), parameterInfo);
+ }
+
+ //
+ this.parameters = parameters;
+ this.keywords = keywords;
+ }
+
+ public Map<String, ? extends ParameterInfo> getParameters()
+ {
+ return parameters;
+ }
+
+ public Set<String> getKeywords()
+ {
+ return keywords;
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteDriver.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteDriver.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteDriver.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -0,0 +1,203 @@
+/******************************************************************************
+ * 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.driver.impl.pojo;
+
+import org.jboss.unit.spi.pojo.TestProvider;
+import org.jboss.unit.spi.pojo.TestProviderSupport;
+import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
+import org.jboss.unit.spi.pojo.TestLifeCycle;
+import org.jboss.unit.spi.pojo.TestCase;
+import org.jboss.unit.spi.pojo.annotations.Provider;
+import org.jboss.unit.driver.TestDriver;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.driver.command.StartTestCommand;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.TestSuiteInfo;
+import org.jboss.unit.TestId;
+import org.jboss.unit.Failure;
+
+import java.util.Map;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOTestSuiteDriver implements TestDriver
+{
+
+ /** . */
+ private TestProvider provider;
+
+ /** . */
+ private TestSuiteInfo info;
+
+ public POJOTestSuiteDriver(Class testClass) throws InstantiationException, IllegalAccessException
+ {
+ // Get provider annotation
+ Provider provider = ((AnnotatedElement)testClass).getAnnotation(Provider.class);
+
+ // Scan meta annotations
+ if (provider == null)
+ {
+ for (Annotation annotation : testClass.getAnnotations())
+ {
+ Class blah = annotation.annotationType();
+ provider = ((AnnotatedElement)blah).getAnnotation(Provider.class);
+ if (provider != null)
+ {
+ break;
+ }
+ }
+ }
+
+ if (provider != null)
+ {
+ try
+ {
+ Class<? extends TestProvider> providerClass = provider.value();
+ Constructor<? extends TestProvider> providerCtor = providerClass.getConstructor(Class.class);
+ this.provider = providerCtor.newInstance(testClass);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ }
+// else if (TestHandler.class.isAssignableFrom(testClass))
+// {
+// handler = (TestHandler)testClass.newInstance();
+// }
+ else
+ {
+ this.provider = new TestProviderSupport(testClass);
+ }
+
+ //
+ info = new POJOTestSuiteInfo(this.provider.getDescriptor());
+ }
+
+ public TestInfo getInfo()
+ {
+ return info;
+ }
+
+ public DriverResponse invoke(TestId id, DriverCommand command)
+ {
+ if (command instanceof StartTestCommand)
+ {
+ StartTestCommand start = (StartTestCommand)command;
+
+ //
+ if (id.getLength() == 0)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ TestLifeCycle lifeCycle = provider.getLifeCycle();
+
+ //
+ String name = id.getName(0);
+
+ //
+ TestCase testCase;
+ try
+ {
+ testCase = lifeCycle.newTestCase(name);
+ }
+ catch (Exception e)
+ {
+ return createResponse(e);
+ }
+
+ //
+ Map<String,String> parametrization = start.getParametrization();
+
+ //
+ try
+ {
+ lifeCycle.testCaseParametrize(testCase, parametrization);
+ }
+ catch (Exception e)
+ {
+ return createResponse(e);
+ }
+
+ //
+ try
+ {
+ lifeCycle.testCaseCreate(testCase);
+
+ //
+ lifeCycle.testCaseInvoke(testCase);
+ }
+ catch (Exception e)
+ {
+ return createResponse(e);
+ }
+ finally
+ {
+ lifeCycle.testCaseDestroy(testCase);
+ }
+
+ //
+ return new EndTestResponse();
+ }
+ else
+ {
+ throw new IllegalArgumentException(); // convert to response style
+ }
+ }
+
+ private DriverResponse createResponse(Throwable t)
+ {
+ if (t instanceof TestCaseLifeCycleException)
+ {
+ if (t.getCause() != null)
+ {
+ t = t.getCause();
+ }
+ }
+
+ //
+ if (t instanceof AssertionError)
+ {
+ return new FailureResponse(Failure.createAssertionFailure((AssertionError)t));
+ }
+ else
+ {
+ return new FailureResponse(Failure.createErrorFailure(t));
+ }
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteInfo.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/pojo/POJOTestSuiteInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * 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.driver.impl.pojo;
+
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
+import org.jboss.unit.spi.pojo.TestSuiteDescriptor;
+import org.jboss.unit.info.TestSuiteInfo;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.TestId;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOTestSuiteInfo extends POJOTestInfo implements TestSuiteInfo
+{
+
+ /** . */
+ private TestSuiteDescriptor descriptor;
+
+ /** . */
+ private Map<String,POJOTestCaseInfo> testCases;
+
+ public POJOTestSuiteInfo(TestSuiteDescriptor descriptor)
+ {
+ super(descriptor.getParameters(), descriptor.getKeywords());
+
+ //
+ HashMap<String, POJOTestCaseInfo> testCases = new HashMap<String, POJOTestCaseInfo>();
+ for (TestCaseDescriptor testCaseDescriptor : descriptor.getTestCases().values())
+ {
+ POJOTestCaseInfo testCase = new POJOTestCaseInfo(testCaseDescriptor);
+ testCases.put(testCase.getName(), testCase);
+ }
+
+ //
+ this.descriptor = descriptor;
+ this.testCases = testCases;
+ }
+
+ public String getName()
+ {
+ return descriptor.getName();
+ }
+
+ public String getDescription()
+ {
+ return descriptor.getDescription();
+ }
+
+ public TestInfo getTest(String name)
+ {
+ return testCases.get(name);
+ }
+
+ public Set<String> getNames()
+ {
+ return testCases.keySet();
+ }
+
+ public TestInfo findTest(TestId id)
+ {
+ switch(id.getLength())
+ {
+ case 0:
+ return this;
+ case 1:
+ return getTest(id.getName(0));
+ default:
+ return null;
+ }
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -33,18 +33,16 @@
import org.jboss.unit.runner.model.pojo.TestClassDef;
import org.jboss.unit.runner.model.pojo.TestCaseDef;
import org.jboss.unit.runner.model.TestDef;
-import org.jboss.unit.FailureType;
import org.jboss.unit.TestId;
import org.jboss.unit.Failure;
import org.jboss.unit.info.TestSuiteInfo;
import org.jboss.unit.info.TestCaseInfo;
-import org.jboss.unit.unit.pojo.POJOTestSuiteDriver;
+import org.jboss.unit.driver.impl.pojo.POJOTestSuiteDriver;
import org.jboss.unit.driver.TestDriver;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -1,59 +0,0 @@
-/******************************************************************************
- * 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.unit.pojo;
-
-import org.jboss.unit.spi.pojo.ParameterDescriptor;
-import org.jboss.unit.info.ParameterInfo;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class POJOParameterInfo implements ParameterInfo
-{
-
- /** . */
- private final ParameterDescriptor descriptor;
-
- public POJOParameterInfo(ParameterDescriptor descriptor)
- {
- this.descriptor = descriptor;
- }
-
- public String getName()
- {
- return descriptor.getName();
- }
-
- public String getDescription()
- {
- return descriptor.getDescription();
- }
-
- public List<String> getDefaultValues()
- {
- return descriptor.getDefaultValues();
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -1,56 +0,0 @@
-/******************************************************************************
- * 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.unit.pojo;
-
-import org.jboss.unit.spi.pojo.TestCaseDescriptor;
-import org.jboss.unit.info.TestCaseInfo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class POJOTestCaseInfo extends POJOTestInfo implements TestCaseInfo
-{
-
- /** . */
- private TestCaseDescriptor descriptor;
-
- public POJOTestCaseInfo(TestCaseDescriptor descriptor)
- {
- super(descriptor.getParameters(), descriptor.getKeywords());
-
- //
- this.descriptor = descriptor;
- }
-
- public String getName()
- {
- return descriptor.getName();
- }
-
- public String getDescription()
- {
- return descriptor.getDescription();
- }
-
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -1,69 +0,0 @@
-/******************************************************************************
- * 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.unit.pojo;
-
-import org.jboss.unit.info.ParameterInfo;
-import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.spi.pojo.ParameterDescriptor;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class POJOTestInfo implements TestInfo
-{
-
- /** . */
- private Map<String,POJOParameterInfo> parameters;
-
- /** . */
- private Set<String> keywords;
-
- public POJOTestInfo(Map<String,? extends ParameterDescriptor> parameterDescriptors, Set<String> keywords)
- {
- Map<String, POJOParameterInfo> parameters = new HashMap<String, POJOParameterInfo>();
- for (ParameterDescriptor parameterDescriptor : parameterDescriptors.values())
- {
- POJOParameterInfo parameterInfo = new POJOParameterInfo(parameterDescriptor);
- parameters.put(parameterInfo.getName(), parameterInfo);
- }
-
- //
- this.parameters = parameters;
- this.keywords = keywords;
- }
-
- public Map<String, ? extends ParameterInfo> getParameters()
- {
- return parameters;
- }
-
- public Set<String> getKeywords()
- {
- return keywords;
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -1,203 +0,0 @@
-/******************************************************************************
- * 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.unit.pojo;
-
-import org.jboss.unit.spi.pojo.TestProvider;
-import org.jboss.unit.spi.pojo.TestProviderSupport;
-import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
-import org.jboss.unit.spi.pojo.TestLifeCycle;
-import org.jboss.unit.spi.pojo.TestCase;
-import org.jboss.unit.spi.pojo.annotations.Provider;
-import org.jboss.unit.driver.TestDriver;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.DriverCommand;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.driver.response.FailureResponse;
-import org.jboss.unit.driver.command.StartTestCommand;
-import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.info.TestSuiteInfo;
-import org.jboss.unit.TestId;
-import org.jboss.unit.Failure;
-
-import java.util.Map;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.annotation.Annotation;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class POJOTestSuiteDriver implements TestDriver
-{
-
- /** . */
- private TestProvider provider;
-
- /** . */
- private TestSuiteInfo info;
-
- public POJOTestSuiteDriver(Class testClass) throws InstantiationException, IllegalAccessException
- {
- // Get provider annotation
- Provider provider = ((AnnotatedElement)testClass).getAnnotation(Provider.class);
-
- // Scan meta annotations
- if (provider == null)
- {
- for (Annotation annotation : testClass.getAnnotations())
- {
- Class blah = annotation.annotationType();
- provider = ((AnnotatedElement)blah).getAnnotation(Provider.class);
- if (provider != null)
- {
- break;
- }
- }
- }
-
- if (provider != null)
- {
- try
- {
- Class<? extends TestProvider> providerClass = provider.value();
- Constructor<? extends TestProvider> providerCtor = providerClass.getConstructor(Class.class);
- this.provider = providerCtor.newInstance(testClass);
- }
- catch (NoSuchMethodException e)
- {
- throw new IllegalArgumentException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new IllegalArgumentException(e);
- }
- }
-// else if (TestHandler.class.isAssignableFrom(testClass))
-// {
-// handler = (TestHandler)testClass.newInstance();
-// }
- else
- {
- this.provider = new TestProviderSupport(testClass);
- }
-
- //
- info = new POJOTestSuiteInfo(this.provider.getDescriptor());
- }
-
- public TestInfo getInfo()
- {
- return info;
- }
-
- public DriverResponse invoke(TestId id, DriverCommand command)
- {
- if (command instanceof StartTestCommand)
- {
- StartTestCommand start = (StartTestCommand)command;
-
- //
- if (id.getLength() == 0)
- {
- throw new IllegalArgumentException();
- }
-
- //
- TestLifeCycle lifeCycle = provider.getLifeCycle();
-
- //
- String name = id.getName(0);
-
- //
- TestCase testCase;
- try
- {
- testCase = lifeCycle.newTestCase(name);
- }
- catch (Exception e)
- {
- return createResponse(e);
- }
-
- //
- Map<String,String> parametrization = start.getParametrization();
-
- //
- try
- {
- lifeCycle.testCaseParametrize(testCase, parametrization);
- }
- catch (Exception e)
- {
- return createResponse(e);
- }
-
- //
- try
- {
- lifeCycle.testCaseCreate(testCase);
-
- //
- lifeCycle.testCaseInvoke(testCase);
- }
- catch (Exception e)
- {
- return createResponse(e);
- }
- finally
- {
- lifeCycle.testCaseDestroy(testCase);
- }
-
- //
- return new EndTestResponse();
- }
- else
- {
- throw new IllegalArgumentException(); // convert to response style
- }
- }
-
- private DriverResponse createResponse(Throwable t)
- {
- if (t instanceof TestCaseLifeCycleException)
- {
- if (t.getCause() != null)
- {
- t = t.getCause();
- }
- }
-
- //
- if (t instanceof AssertionError)
- {
- return new FailureResponse(Failure.createAssertionFailure((AssertionError)t));
- }
- else
- {
- return new FailureResponse(Failure.createErrorFailure(t));
- }
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java 2007-10-05 16:38:43 UTC (rev 8548)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java 2007-10-05 19:39:43 UTC (rev 8549)
@@ -1,97 +0,0 @@
-/******************************************************************************
- * 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.unit.pojo;
-
-import org.jboss.unit.spi.pojo.TestCaseDescriptor;
-import org.jboss.unit.spi.pojo.TestSuiteDescriptor;
-import org.jboss.unit.info.TestSuiteInfo;
-import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.TestId;
-
-import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class POJOTestSuiteInfo extends POJOTestInfo implements TestSuiteInfo
-{
-
- /** . */
- private TestSuiteDescriptor descriptor;
-
- /** . */
- private Map<String,POJOTestCaseInfo> testCases;
-
- public POJOTestSuiteInfo(TestSuiteDescriptor descriptor)
- {
- super(descriptor.getParameters(), descriptor.getKeywords());
-
- //
- HashMap<String, POJOTestCaseInfo> testCases = new HashMap<String, POJOTestCaseInfo>();
- for (TestCaseDescriptor testCaseDescriptor : descriptor.getTestCases().values())
- {
- POJOTestCaseInfo testCase = new POJOTestCaseInfo(testCaseDescriptor);
- testCases.put(testCase.getName(), testCase);
- }
-
- //
- this.descriptor = descriptor;
- this.testCases = testCases;
- }
-
- public String getName()
- {
- return descriptor.getName();
- }
-
- public String getDescription()
- {
- return descriptor.getDescription();
- }
-
- public TestInfo getTest(String name)
- {
- return testCases.get(name);
- }
-
- public Set<String> getNames()
- {
- return testCases.keySet();
- }
-
- public TestInfo findTest(TestId id)
- {
- switch(id.getLength())
- {
- case 0:
- return this;
- case 1:
- return getTest(id.getName(0));
- default:
- return null;
- }
- }
-}
16 years, 8 months
JBoss Portal SVN: r8548 - modules/common/trunk/portal.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-05 12:38:43 -0400 (Fri, 05 Oct 2007)
New Revision: 8548
Modified:
modules/common/trunk/portal/pom.xml
Log:
typo
Modified: modules/common/trunk/portal/pom.xml
===================================================================
--- modules/common/trunk/portal/pom.xml 2007-10-05 16:37:23 UTC (rev 8547)
+++ modules/common/trunk/portal/pom.xml 2007-10-05 16:38:43 UTC (rev 8548)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>jboss-portal-modules-common-portal</artifactId>
<packaging>jar</packaging>
- <name>Jboss Portal Modules Common Portal</name>
+ <name>JBoss Portal Modules Common Portal</name>
<dependencies/>
16 years, 8 months