Author: manik.surtani(a)jboss.com
Date: 2009-01-16 12:23:19 -0500 (Fri, 16 Jan 2009)
New Revision: 7494
Added:
core/branches/flat/src/test/java/org/horizon/util/
core/branches/flat/src/test/java/org/horizon/util/UnitTestTestNGListener.java
Removed:
core/branches/flat/src/main/java/org/horizon/util/UnitTestTestNGListener.java
Log:
Moved test helper class to test src root
Deleted: core/branches/flat/src/main/java/org/horizon/util/UnitTestTestNGListener.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/util/UnitTestTestNGListener.java 2009-01-16
17:13:29 UTC (rev 7493)
+++
core/branches/flat/src/main/java/org/horizon/util/UnitTestTestNGListener.java 2009-01-16
17:23:19 UTC (rev 7494)
@@ -1,93 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.horizon.util;
-
-import org.testng.IClass;
-import org.testng.ITestContext;
-import org.testng.ITestListener;
-import org.testng.ITestResult;
-
-/**
- * @author dpospisi
- * @since 1.0
- */
-public class UnitTestTestNGListener implements ITestListener {
-
- /**
- * Holds test classes actually running in all threads.
- */
- private ThreadLocal<IClass> threadTestClass = new ThreadLocal<IClass>();
-
- private int failed = 0;
- private int succeded = 0;
- private int skipped = 0;
-
- public void onTestStart(ITestResult res) {
- System.out.println(getThreadId() + " Starting test " +
getTestDesc(res));
-
- /*
- IClass testClass = threadTestClass.get();
- if ((testClass != null) && (! res.getTestClass().equals(testClass))) {
-
- System.out.println(getThreadId() + " New test class" +
res.getTestClass() + ", was " + testClass);
-
- // the thread has started testing a new test class
-
- // clean all possibly running caches created in current thread
- boolean cleaned = new UnitTestCacheFactory().cleanUp();
- if (cleaned) {
- // previous test left a cache
- System.out.println(getThreadId() +" WARNING
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- System.out.println(getThreadId() +" A test method in " +
testClass.getName() + " did not clean all cache instances properly.");
- System.out.println(getThreadId() +" Use UnitTestCacheFactory.cleanUp()
or TestngUtil.killCaches(...) ");
- System.out.println(getThreadId() +" WARNING
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- }
- }
- */
-
- threadTestClass.set(res.getTestClass());
- }
-
- synchronized public void onTestSuccess(ITestResult arg0) {
- System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + "
succeded.");
- succeded++;
- printStatus();
- }
-
- synchronized public void onTestFailure(ITestResult arg0) {
- System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + "
failed.");
- failed++;
- printStatus();
- }
-
- synchronized public void onTestSkipped(ITestResult arg0) {
- System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + "
skipped.");
- skipped++;
- printStatus();
- }
-
- public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
- }
-
- public void onStart(ITestContext arg0) {
- }
-
- public void onFinish(ITestContext arg0) {
- }
-
- private String getThreadId() {
- return "[" + Thread.currentThread().getName() + "]";
- }
-
- private String getTestDesc(ITestResult res) {
- return res.getMethod().getMethodName() + "(" +
res.getTestClass().getName() + ")";
- }
-
- private void printStatus() {
- System.out.println("Testsuite execution progress: tests succeded " +
succeded + ", failed " + failed + ", skipped " + skipped +
".");
- }
-
-}
Copied: core/branches/flat/src/test/java/org/horizon/util/UnitTestTestNGListener.java
(from rev 7491,
core/branches/flat/src/main/java/org/horizon/util/UnitTestTestNGListener.java)
===================================================================
--- core/branches/flat/src/test/java/org/horizon/util/UnitTestTestNGListener.java
(rev 0)
+++
core/branches/flat/src/test/java/org/horizon/util/UnitTestTestNGListener.java 2009-01-16
17:23:19 UTC (rev 7494)
@@ -0,0 +1,93 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.horizon.util;
+
+import org.testng.IClass;
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+
+/**
+ * @author dpospisi
+ * @since 1.0
+ */
+public class UnitTestTestNGListener implements ITestListener {
+
+ /**
+ * Holds test classes actually running in all threads.
+ */
+ private ThreadLocal<IClass> threadTestClass = new ThreadLocal<IClass>();
+
+ private int failed = 0;
+ private int succeded = 0;
+ private int skipped = 0;
+
+ public void onTestStart(ITestResult res) {
+ System.out.println(getThreadId() + " Starting test " +
getTestDesc(res));
+
+ /*
+ IClass testClass = threadTestClass.get();
+ if ((testClass != null) && (! res.getTestClass().equals(testClass))) {
+
+ System.out.println(getThreadId() + " New test class" +
res.getTestClass() + ", was " + testClass);
+
+ // the thread has started testing a new test class
+
+ // clean all possibly running caches created in current thread
+ boolean cleaned = new UnitTestCacheFactory().cleanUp();
+ if (cleaned) {
+ // previous test left a cache
+ System.out.println(getThreadId() +" WARNING
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ System.out.println(getThreadId() +" A test method in " +
testClass.getName() + " did not clean all cache instances properly.");
+ System.out.println(getThreadId() +" Use UnitTestCacheFactory.cleanUp()
or TestngUtil.killCaches(...) ");
+ System.out.println(getThreadId() +" WARNING
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ }
+ }
+ */
+
+ threadTestClass.set(res.getTestClass());
+ }
+
+ synchronized public void onTestSuccess(ITestResult arg0) {
+ System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + "
succeded.");
+ succeded++;
+ printStatus();
+ }
+
+ synchronized public void onTestFailure(ITestResult arg0) {
+ System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + "
failed.");
+ failed++;
+ printStatus();
+ }
+
+ synchronized public void onTestSkipped(ITestResult arg0) {
+ System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + "
skipped.");
+ skipped++;
+ printStatus();
+ }
+
+ public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
+ }
+
+ public void onStart(ITestContext arg0) {
+ }
+
+ public void onFinish(ITestContext arg0) {
+ }
+
+ private String getThreadId() {
+ return "[" + Thread.currentThread().getName() + "]";
+ }
+
+ private String getTestDesc(ITestResult res) {
+ return res.getMethod().getMethodName() + "(" +
res.getTestClass().getName() + ")";
+ }
+
+ private void printStatus() {
+ System.out.println("Testsuite execution progress: tests succeded " +
succeded + ", failed " + failed + ", skipped " + skipped +
".");
+ }
+
+}
Property changes on:
core/branches/flat/src/test/java/org/horizon/util/UnitTestTestNGListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Show replies by date