Author: julien(a)jboss.com
Date: 2007-10-20 08:45:09 -0400 (Sat, 20 Oct 2007)
New Revision: 8721
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestDriver1.java
Modified:
modules/test/trunk/unit/build.xml
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java
modules/test/trunk/unit/src/main/org/jboss/unit/driver/AbstractTestDriver.java
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml
Log:
added a generic test driver in the samples
Modified: modules/test/trunk/unit/build.xml
===================================================================
--- modules/test/trunk/unit/build.xml 2007-10-20 00:32:11 UTC (rev 8720)
+++ modules/test/trunk/unit/build.xml 2007-10-20 12:45:09 UTC (rev 8721)
@@ -200,4 +200,13 @@
</target>
+ <target name="reports" depends="init">
+ <junitreport todir="output/tests">
+ <fileset dir="output/tests">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="output/tests"/>
+ </junitreport>
+ </target>
+
</project>
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java 2007-10-20
00:32:11 UTC (rev 8720)
+++
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java 2007-10-20
12:45:09 UTC (rev 8721)
@@ -79,7 +79,7 @@
TestRunner runner = suite.createRunner();
- TestRunnerEventListener junitReporter = new JUnitReporter("output",
SampleTests.class.getName());
+ TestRunnerEventListener junitReporter = new JUnitReporter("output/tests",
SampleTests.class.getName());
// add listeners
TestRunnerEventBroadcaster broadcaster = new TestRunnerEventBroadcaster();
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestDriver1.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestDriver1.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestDriver1.java 2007-10-20
12:45:09 UTC (rev 8721)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * 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.sample;
+
+import org.jboss.unit.Failure;
+import org.jboss.unit.TestId;
+import org.jboss.unit.driver.AbstractTestDriver;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.DriverException;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.impl.composite.CompositeTestDriver;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestDriver1 extends CompositeTestDriver
+{
+ public TestDriver1() throws DriverException
+ {
+ mount(new AbstractTestDriver()
+ {
+ public TestInfo getInfo()
+ {
+ return new SimpleTestCaseInfo("test1");
+ }
+ public DriverResponse invoke(TestId id, DriverCommand command)
+ {
+ return new EndTestResponse();
+ }
+ });
+ mount(new AbstractTestDriver()
+ {
+ public TestInfo getInfo()
+ {
+ return new SimpleTestCaseInfo("test2");
+ }
+ public DriverResponse invoke(TestId id, DriverCommand command)
+ {
+ return new
FailureResponse(Failure.createAssertionFailure("failure"));
+ }
+ });
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java 2007-10-20
00:32:11 UTC (rev 8720)
+++
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java 2007-10-20
12:45:09 UTC (rev 8721)
@@ -46,5 +46,4 @@
{
assertEquals("foo", foo);
}
-
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/driver/AbstractTestDriver.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/driver/AbstractTestDriver.java 2007-10-20
00:32:11 UTC (rev 8720)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/driver/AbstractTestDriver.java 2007-10-20
12:45:09 UTC (rev 8721)
@@ -32,7 +32,7 @@
/** . */
private DriverContext context;
- public void initDriver(DriverContext context)
+ public void initDriver(DriverContext context) throws DriverException
{
this.context = context;
@@ -40,7 +40,7 @@
doInit();
}
- protected void doInit()
+ protected void doInit() throws DriverException
{
}
Modified: modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml
===================================================================
---
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml 2007-10-20
00:32:11 UTC (rev 8720)
+++
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml 2007-10-20
12:45:09 UTC (rev 8721)
@@ -24,4 +24,7 @@
<class name="XYZ"/>
</test>
</pojo>
+ <generic>
+ <class name="org.jboss.test.unit.sample.TestDriver1"/>
+ </generic>
</jboss-unit>