p-unit-devel Mailing List for p-unit (Page 4)
Status: Beta
Brought to you by:
zhanghuangzhu
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(182) |
Jun
(46) |
Jul
(3) |
Aug
(2) |
Sep
(1) |
Oct
(7) |
Nov
(18) |
Dec
(8) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(9) |
Feb
(5) |
Mar
(10) |
Apr
(17) |
May
(16) |
Jun
(16) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <zha...@us...> - 2007-12-25 14:02:37
|
Revision: 265
http://p-unit.svn.sourceforge.net/p-unit/?rev=265&view=rev
Author: zhanghuangzhu
Date: 2007-12-25 06:02:40 -0800 (Tue, 25 Dec 2007)
Log Message:
-----------
Andrew Zhang: use generated serial id
Modified Paths:
--------------
trunk/punit.android/src/org/punit/runner/AndroidLogger.java
trunk/punit.android/src/org/punit/runner/AndroidRunner.java
Modified: trunk/punit.android/src/org/punit/runner/AndroidLogger.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidLogger.java 2007-12-25 14:00:59 UTC (rev 264)
+++ trunk/punit.android/src/org/punit/runner/AndroidLogger.java 2007-12-25 14:02:40 UTC (rev 265)
@@ -5,13 +5,11 @@
import org.punit.reporter.stream.StreamLogger;
public class AndroidLogger extends StreamLogger {
+
+ private static final long serialVersionUID = -8248525427209731348L;
+
public AndroidLogger() {
super(new PrintWriter(new AndroidWriter()));
}
- public boolean supportParentRunner() {
- // TODO Auto-generated method stub
- return false;
- }
-
}
Modified: trunk/punit.android/src/org/punit/runner/AndroidRunner.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidRunner.java 2007-12-25 14:00:59 UTC (rev 264)
+++ trunk/punit.android/src/org/punit/runner/AndroidRunner.java 2007-12-25 14:02:40 UTC (rev 265)
@@ -3,6 +3,9 @@
import org.punit.method.runner.*;
public class AndroidRunner extends VanillaRunner {
+
+ private static final long serialVersionUID = -9095745917786031406L;
+
public AndroidRunner(AbstractRunner runner) {
super(runner);
runner.removeConsoleLogger();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-12-25 14:00:54
|
Revision: 264
http://p-unit.svn.sourceforge.net/p-unit/?rev=264&view=rev
Author: zhanghuangzhu
Date: 2007-12-25 06:00:59 -0800 (Tue, 25 Dec 2007)
Log Message:
-----------
Andrew Zhang: use generated serial id
Modified Paths:
--------------
trunk/punit/src/org/punit/method/runner/VanillaRunner.java
Modified: trunk/punit/src/org/punit/method/runner/VanillaRunner.java
===================================================================
--- trunk/punit/src/org/punit/method/runner/VanillaRunner.java 2007-12-25 13:07:01 UTC (rev 263)
+++ trunk/punit/src/org/punit/method/runner/VanillaRunner.java 2007-12-25 14:00:59 UTC (rev 264)
@@ -10,6 +10,9 @@
import org.punit.suite.builder.*;
public class VanillaRunner implements Runner {
+
+ private static final long serialVersionUID = -3536655499041726649L;
+
private Runner _runner;
public VanillaRunner(Runner runner) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-12-25 13:06:57
|
Revision: 263
http://p-unit.svn.sourceforge.net/p-unit/?rev=263&view=rev
Author: zhanghuangzhu
Date: 2007-12-25 05:07:01 -0800 (Tue, 25 Dec 2007)
Log Message:
-----------
Andrew Zhang: refactored AbstractWatcher. Changed the start sequence of watcher list.
Modified Paths:
--------------
trunk/punit/src/org/punit/method/runner/AbstractMethodRunner.java
trunk/punit/src/org/punit/watcher/AbstractWatcher.java
trunk/punit/src/org/punit/watcher/CustomWatcher.java
trunk/punit/src/org/punit/watcher/MemoryWatcher.java
trunk/punit/src/org/punit/watcher/TimeWatcher.java
Modified: trunk/punit/src/org/punit/method/runner/AbstractMethodRunner.java
===================================================================
--- trunk/punit/src/org/punit/method/runner/AbstractMethodRunner.java 2007-12-25 12:35:17 UTC (rev 262)
+++ trunk/punit/src/org/punit/method/runner/AbstractMethodRunner.java 2007-12-25 13:07:01 UTC (rev 263)
@@ -257,13 +257,11 @@
protected final void startWatchers(final Object testInstance,
final Method method, final Object[] params) {
onWatchersStart(testInstance, method, params);
- TraverserUtil.traverse(_watchers.iterator(), new Traverser() {
- public void traverse(Object obj) {
- Watcher watcher = (Watcher) obj;
- onWatcherStart(watcher, testInstance, method, params);
- watcher.start();
- }
- });
+ for(int i = _watchers.size() - 1; i >= 0; i--) {
+ Watcher watcher = (Watcher) _watchers.get(i);
+ onWatcherStart(watcher, testInstance, method, params);
+ watcher.start();
+ }
}
private void onWatchersStart(final Object testInstance,
Modified: trunk/punit/src/org/punit/watcher/AbstractWatcher.java
===================================================================
--- trunk/punit/src/org/punit/watcher/AbstractWatcher.java 2007-12-25 12:35:17 UTC (rev 262)
+++ trunk/punit/src/org/punit/watcher/AbstractWatcher.java 2007-12-25 13:07:01 UTC (rev 263)
@@ -5,21 +5,9 @@
import org.punit.exception.ReflectionException;
public abstract class AbstractWatcher implements Watcher {
-
- transient long _scale = 1;
- transient long _value;
-
- public double value() {
- return ((double) _value) / _scale;
- }
-
public String stringValue() {
- if (_scale == 1) {
- return _value + unit(); //$NON-NLS-1$
- } else {
- return value() + unit();
- }
+ return value() + unit();
}
public Watcher cloneSelf() {
Modified: trunk/punit/src/org/punit/watcher/CustomWatcher.java
===================================================================
--- trunk/punit/src/org/punit/watcher/CustomWatcher.java 2007-12-25 12:35:17 UTC (rev 262)
+++ trunk/punit/src/org/punit/watcher/CustomWatcher.java 2007-12-25 13:07:01 UTC (rev 263)
@@ -19,6 +19,10 @@
private String _name;
private String _unit;
+
+ transient long _value;
+
+ transient long _scale;
private transient static MethodRunner _methodRunner;
@@ -40,6 +44,10 @@
public void stop() {
}
+
+ public double value() {
+ return ((double)_value)/_scale;
+ }
/**
* Updates all registered <code>CustomWatcher</code> for this method
Modified: trunk/punit/src/org/punit/watcher/MemoryWatcher.java
===================================================================
--- trunk/punit/src/org/punit/watcher/MemoryWatcher.java 2007-12-25 12:35:17 UTC (rev 262)
+++ trunk/punit/src/org/punit/watcher/MemoryWatcher.java 2007-12-25 13:07:01 UTC (rev 263)
@@ -13,6 +13,8 @@
private transient long _startUsedMemory;
private transient boolean _stop;
+
+ private transient long _value;
public void start() {
_stop = false;
@@ -26,6 +28,10 @@
_stop = true;
monitorMemory();
}
+
+ public double value() {
+ return _value;
+ }
private void monitorMemory() {
long usedMemory = MemoryUtil.usedMemory() - _startUsedMemory;
Modified: trunk/punit/src/org/punit/watcher/TimeWatcher.java
===================================================================
--- trunk/punit/src/org/punit/watcher/TimeWatcher.java 2007-12-25 12:35:17 UTC (rev 262)
+++ trunk/punit/src/org/punit/watcher/TimeWatcher.java 2007-12-25 13:07:01 UTC (rev 263)
@@ -9,15 +9,22 @@
private static final long serialVersionUID = -1374581076649027519L;
private transient long _startTime;
-
+
+ private transient long _value;
+
+ private static final int _SCALE = 1000000;
+
public void start() {
_startTime = System.nanoTime();
- _scale = 1000000;
}
public void stop() {
_value = System.nanoTime() - _startTime;
}
+
+ public double value() {
+ return ((double)_value)/_SCALE;
+ }
public String punitName() {
return Messages.getString("watcher.time"); //$NON-NLS-1$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-12-25 12:35:12
|
Revision: 262
http://p-unit.svn.sourceforge.net/p-unit/?rev=262&view=rev
Author: zhanghuangzhu
Date: 2007-12-25 04:35:17 -0800 (Tue, 25 Dec 2007)
Log Message:
-----------
Andrew Zhang: introduced VanillaEventListener
Modified Paths:
--------------
trunk/punit.extension/src/org/punit/listener/FieldSetter.java
trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java
Modified: trunk/punit.extension/src/org/punit/listener/FieldSetter.java
===================================================================
--- trunk/punit.extension/src/org/punit/listener/FieldSetter.java 2007-12-25 12:35:05 UTC (rev 261)
+++ trunk/punit.extension/src/org/punit/listener/FieldSetter.java 2007-12-25 12:35:17 UTC (rev 262)
@@ -1,21 +1,16 @@
/* (C) Copyright 2007, by Andrew Zhang */
package org.punit.listener;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Properties;
-
-import org.punit.events.EventListener;
-import org.punit.runner.Runner;
-import org.punit.type.TestSuite;
-import org.punit.watcher.Watcher;
import java.lang.reflect.*;
+import java.util.*;
+
+import org.punit.events.*;
import org.punit.util.*;
/**
* The listener sets class public fields using properties.
*/
-public class FieldSetter implements EventListener {
+public class FieldSetter extends VanillaEventListener {
private static final long serialVersionUID = 5194809928409791777L;
@@ -25,61 +20,10 @@
_properties = properties;
}
- @SuppressWarnings("unchecked")
- public void onMethodEnd(Method method, Object testInstance,
- Object[] params, Throwable t, List Watchers) {
- }
-
- public void onClassEnd(Object testInstance, Throwable t) {
- }
-
public void onClassStart(Object testInstance) {
setClassFields(testInstance, _properties);
}
- public void onMethodStart(Method method, Object testInstance,
- Object[] params) {
-
- }
-
- @SuppressWarnings("unchecked")
- public void onRunnerEnd(Class clazz, Runner runner) {
- }
-
- @SuppressWarnings("unchecked")
- public void onRunnerStart(Class clazz, Runner runner) {
- }
-
- public void onSuiteEnd(TestSuite suite) {
-
- }
-
- public void onSuiteStart(TestSuite suite) {
-
- }
-
- public void onWatcherEnd(Watcher watcher) {
-
- }
-
- public void onWatcherStart(Watcher watcher) {
-
- }
-
- @SuppressWarnings("unchecked")
- public void onWatchersEnd(List watchers) {
-
- }
-
- @SuppressWarnings("unchecked")
- public void onWatchersStart(List watchers) {
-
- }
-
- public boolean supportParentRunner() {
- return false;
- }
-
private final String PACKAGE_SEPARATOR = "."; //$NON-NLS-1$
/**
Modified: trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java
===================================================================
--- trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java 2007-12-25 12:35:05 UTC (rev 261)
+++ trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java 2007-12-25 12:35:17 UTC (rev 262)
@@ -12,7 +12,7 @@
import org.jfree.chart.JFreeChart;
import org.jfree.data.category.DefaultCategoryDataset;
-import org.punit.events.EventListener;
+import org.punit.events.*;
import org.punit.exception.IOException;
import org.punit.message.Messages;
import org.punit.reporter.chart.image.ImageConstants;
@@ -26,7 +26,7 @@
import org.punit.util.TraverserUtil;
import org.punit.watcher.Watcher;
-public abstract class AbstractChartReporter implements EventListener {
+public abstract class AbstractChartReporter extends VanillaEventListener {
private Hashtable<DatasetKey, DefaultCategoryDataset> _datasets = new Hashtable<DatasetKey, DefaultCategoryDataset>();
@@ -221,27 +221,4 @@
});
}
- public void onWatcherStart(Watcher watcher) {
- // nothing needs to be done
- }
-
- public void onWatcherEnd(Watcher watcher) {
- // nothing needs to be done
- }
-
- @SuppressWarnings("unchecked")
- public void onWatchersStart(List watchers) {
- // nothing needs to be done
- }
-
- @SuppressWarnings("unchecked")
- public void onWatchersEnd(List watchers) {
- // nothing needs to be done
- }
-
- public void onMethodStart(Method method, Object testInstance,
- Object[] params) {
- // nothing needs to be done
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-12-25 12:35:01
|
Revision: 261
http://p-unit.svn.sourceforge.net/p-unit/?rev=261&view=rev
Author: zhanghuangzhu
Date: 2007-12-25 04:35:05 -0800 (Tue, 25 Dec 2007)
Log Message:
-----------
Andrew Zhang: introduced VanillaEventListener
Modified Paths:
--------------
trunk/punit/src/org/punit/reporter/TestResult.java
trunk/punit/src/org/punit/reporter/stream/StreamLogger.java
trunk/punit/src/org/punit/watcher/AbstractWatcher.java
Added Paths:
-----------
trunk/punit/src/org/punit/events/VanillaEventListener.java
Added: trunk/punit/src/org/punit/events/VanillaEventListener.java
===================================================================
--- trunk/punit/src/org/punit/events/VanillaEventListener.java (rev 0)
+++ trunk/punit/src/org/punit/events/VanillaEventListener.java 2007-12-25 12:35:05 UTC (rev 261)
@@ -0,0 +1,77 @@
+package org.punit.events;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.punit.runner.*;
+import org.punit.type.*;
+import org.punit.watcher.*;
+
+public class VanillaEventListener implements EventListener {
+
+ private static final long serialVersionUID = -2413131933921801719L;
+
+ public VanillaEventListener() {
+
+ }
+
+ public void onClassEnd(Object testInstance, Throwable t) {
+
+ }
+
+ public void onClassStart(Object testInstance) {
+
+ }
+
+ public void onMethodEnd(Method method, Object testInstance,
+ Object[] params, Throwable t, List Watchers) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onMethodStart(Method method, Object testInstance,
+ Object[] params) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onRunnerEnd(Class clazz, Runner runner) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onRunnerStart(Class clazz, Runner runner) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onSuiteEnd(TestSuite suite) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onSuiteStart(TestSuite suite) {
+
+ }
+
+ public void onWatcherEnd(Watcher watcher) {
+
+ }
+
+ public void onWatcherStart(Watcher watcher) {
+
+ }
+
+ public void onWatchersEnd(List watchers) {
+
+ }
+
+ public void onWatchersStart(List watchers) {
+
+ }
+
+ public boolean supportParentRunner() {
+ return false;
+ }
+
+}
Property changes on: trunk/punit/src/org/punit/events/VanillaEventListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/punit/src/org/punit/reporter/TestResult.java
===================================================================
--- trunk/punit/src/org/punit/reporter/TestResult.java 2007-12-25 12:31:15 UTC (rev 260)
+++ trunk/punit/src/org/punit/reporter/TestResult.java 2007-12-25 12:35:05 UTC (rev 261)
@@ -1,16 +1,12 @@
/* (C) Copyright 2007, by Andrew Zhang */
package org.punit.reporter;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
+import java.lang.reflect.*;
+import java.util.*;
-import org.punit.events.EventListener;
-import org.punit.runner.Runner;
-import org.punit.type.TestSuite;
-import org.punit.watcher.Watcher;
+import org.punit.events.*;
-public class TestResult implements EventListener {
+public class TestResult extends VanillaEventListener {
private static final long serialVersionUID = -5770657966003459019L;
@@ -42,61 +38,4 @@
return _failures;
}
- /**
- * A method is required by <code>EventListener</code> interface. It does
- * nothing when a new test class is instantiated.
- */
- public void onClassStart(Object testInstance) {
-
- }
-
- /**
- * A method is required by <code>EventListener</code> interface. It does
- * nothing when a test class execution is completed.
- */
- public void onClassEnd(Object testInstance, Throwable t) {
-
- }
-
- public void onMethodStart(Method method, Object testInstance,
- Object[] params) {
-
- }
-
- public void onRunnerEnd(Class clazz, Runner runner) {
-
- }
-
- public void onRunnerStart(Class clazz, Runner runner) {
-
- }
-
- public void onSuiteEnd(TestSuite suite) {
-
- }
-
- public void onSuiteStart(TestSuite suite) {
-
- }
-
- public void onWatcherEnd(Watcher watcher) {
-
- }
-
- public void onWatcherStart(Watcher watcher) {
-
- }
-
- public void onWatchersEnd(List watchers) {
-
- }
-
- public void onWatchersStart(List watchers) {
-
- }
-
- public boolean supportParentRunner() {
- return false;
- }
-
}
Modified: trunk/punit/src/org/punit/reporter/stream/StreamLogger.java
===================================================================
--- trunk/punit/src/org/punit/reporter/stream/StreamLogger.java 2007-12-25 12:31:15 UTC (rev 260)
+++ trunk/punit/src/org/punit/reporter/stream/StreamLogger.java 2007-12-25 12:35:05 UTC (rev 261)
@@ -2,24 +2,20 @@
package org.punit.reporter.stream;
-import java.io.PrintWriter;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.logging.*;
-import org.punit.events.EventListener;
-import org.punit.message.Messages;
-import org.punit.reporter.TestResult;
-import org.punit.runner.Runner;
-import org.punit.type.TestSuite;
-import org.punit.util.ReporterUtil;
-import org.punit.util.Traverser;
-import org.punit.util.TraverserUtil;
-import org.punit.watcher.TimeWatcher;
-import org.punit.watcher.Watcher;
+import org.punit.events.*;
+import org.punit.message.*;
+import org.punit.reporter.*;
+import org.punit.runner.*;
+import org.punit.type.*;
+import org.punit.util.*;
+import org.punit.watcher.*;
-public abstract class StreamLogger implements EventListener {
+public abstract class StreamLogger extends VanillaEventListener {
protected transient PrintWriter _writer;
@@ -30,7 +26,6 @@
private TimeWatcher _timeWatcher;
public StreamLogger() {
-
}
public StreamLogger(PrintWriter writer) {
@@ -112,10 +107,6 @@
logln(testInstance.getClass().getName(), Level.INFO);
}
- public void onClassEnd(Object testInstance, Throwable t) {
- // nothing needs to be done
- }
-
public void onMethodEnd(Method method, Object instance, Object[] params,
Throwable t, List watchers) {
logTestMethodResult(method, params, watchers, t);
@@ -187,27 +178,4 @@
_level = level;
}
- public void onWatchersStart(List watchers) {
- // nothing needs to be done
- }
-
- public void onWatcherStart(Watcher watcher) {
- // nothing needs to be done
- }
-
- public void onWatchersEnd(List watchers) {
- // nothing needs to be done
- }
-
- public void onWatcherEnd(Watcher watcher) {
- // nothing needs to be done
- }
-
- public void onSuiteEnd(TestSuite suite) {
- // nothing needs to be done
- }
-
- public void onMethodStart(Method method, Object instance, Object[] params) {
- // nothing needs to be done
- }
}
\ No newline at end of file
Modified: trunk/punit/src/org/punit/watcher/AbstractWatcher.java
===================================================================
--- trunk/punit/src/org/punit/watcher/AbstractWatcher.java 2007-12-25 12:31:15 UTC (rev 260)
+++ trunk/punit/src/org/punit/watcher/AbstractWatcher.java 2007-12-25 12:35:05 UTC (rev 261)
@@ -4,18 +4,12 @@
import org.punit.exception.ReflectionException;
-abstract class AbstractWatcher implements Watcher {
+public abstract class AbstractWatcher implements Watcher {
transient long _scale = 1;
transient long _value;
- public void start() {
- }
-
- public void stop() {
- }
-
public double value() {
return ((double) _value) / _scale;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-12-25 12:31:11
|
Revision: 260
http://p-unit.svn.sourceforge.net/p-unit/?rev=260&view=rev
Author: zhanghuangzhu
Date: 2007-12-25 04:31:15 -0800 (Tue, 25 Dec 2007)
Log Message:
-----------
Andrew Zhang: AndroidSoloRunner is unneccesary. use AndroidRunner(runner) instead.
Removed Paths:
-------------
trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java
Deleted: trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java 2007-12-14 10:50:39 UTC (rev 259)
+++ trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java 2007-12-25 12:31:15 UTC (rev 260)
@@ -1,72 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-package org.punit.runner;
-
-import java.util.*;
-
-import org.punit.events.EventListener;
-import org.punit.method.builder.*;
-import org.punit.method.runner.*;
-import org.punit.reporter.*;
-import org.punit.suite.builder.*;
-
-public class AndroidSoloRunner implements Runner {
- private AbstractRunner _runner;
-
- public AndroidSoloRunner() {
- super();
- _runner.removeConsoleLogger();
- _runner.addEventListener(new AndroidLogger());
- }
-
- public TestMethodBuilder methodBuilder() {
- return _runner.methodBuilder();
- }
-
- public MethodRunner methodRunner() {
- return _runner.methodRunner();
- }
-
- public RunnerProperties properties() {
- return _runner.properties();
- }
-
- public void resultFolder(String folder) {
- _runner.resultFolder(folder);
- }
-
- public String resultFolder() {
- return _runner.resultFolder();
- }
-
- public int run(Class clazz) {
- return _runner.run(clazz);
- }
-
- public int run(Class clazz, RunnerProperties properties) {
- return _runner.run(clazz, properties);
- }
-
- public TestSuiteBuilder suiteBuilder() {
- return _runner.suiteBuilder();
- }
-
- public TestResult testResult() {
- return _runner.testResult();
- }
-
- public void addEventListener(EventListener listener) {
- _runner.addEventListener(listener);
- }
-
- public List eventListeners() {
- return _runner.eventListeners();
- }
-
- public void removeEventListener(EventListener listener) {
- _runner.removeEventListener(listener);
- }
-
- public String punitName() {
- return _runner.punitName();
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-12-14 10:50:35
|
Revision: 259
http://p-unit.svn.sourceforge.net/p-unit/?rev=259&view=rev
Author: zhanghuangzhu
Date: 2007-12-14 02:50:39 -0800 (Fri, 14 Dec 2007)
Log Message:
-----------
Andrew Zhang: android license
Added Paths:
-----------
trunk/punit.android/lib/
trunk/punit.android/lib/android.license.txt
Added: trunk/punit.android/lib/android.license.txt
===================================================================
--- trunk/punit.android/lib/android.license.txt (rev 0)
+++ trunk/punit.android/lib/android.license.txt 2007-12-14 10:50:39 UTC (rev 259)
@@ -0,0 +1,144 @@
+ANDROID SOFTWARE DEVELOPMENT KIT
+LICENSE AGREEMENT
+
+1. Introduction
+
+1.1 Your use of the Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the packaged APIs) is subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK.
+
+1.2 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States.
+
+1.3 This version of the Android SDK is being offered to the developer community on an "Early Look" basis. With the help and input of the developer community, Google will continue to add new functionality and features to continually improve the SDK. Once the SDK reaches a more finished form, Google intends to release most of the components under the Apache v2.0 open source license.
+
+2. Accepting this License Agreement
+
+2.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the SDK if you do not accept this License Agreement.
+
+2.2 You can accept this License Agreement by:
+
+ (A) clicking to accept or agree to this License Agreement, where this option is made available to you; or
+
+ (B) by actually using the SDK. In this case, you agree that use of the SDK constitutes acceptance of the Licensing Agreement from that point onwards.
+
+2.3 You may not use the SDK and may not accept the Licensing Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries including the country in which you are resident or from which you use the SDK.
+
+2.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to this License Agreement. If you do not have the requisite authority, you may not accept the Licensing Agreement or use the SDK on behalf of your employer or other entity.
+
+3. SDK License from Google
+
+3.1 Subject to the terms of this License Agreement, Google gives you a limited, worldwide, royalty-free, non-assignable and non-exclusive license to use the SDK to develop applications for use on the Android platform.
+
+3.2 You agree that Google (or Google's licensors) own all legal right, title and interest in and to the SDK, including any intellectual property rights which subsist in the SDK. Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not by this License Agreement. Until the SDK is released under an open source license, you may not extract the source code or create a derivative work of the SDK. Nothing in this provision is intended to prevent you from performing the ordinary activities of application development including, but not limited to, debugging, logging, and profiling.
+
+3.3 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Google's sole discretion, without prior notice to you.
+
+3.4 Nothing in this License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, and other distinctive brand features.
+
+3.5 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK.
+
+4. Use of the SDK by You
+
+4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under this License Agreement in or to any software applications that you develop using the SDK, including any intellectual property rights which subsist in those applications.
+
+4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) this License Agreement and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries).
+
+4.3 You agree that if you use the SDK to develop applications for general public users, you will protect the privacy and legal rights of those users. If the users provide you with user names, passwords, or other login information or personal information, your must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If the user provides your application with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, the user has given you permission to do so.
+
+4.4 You agree that you will not engage in any activity with the SDK, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of any third party including, but not limited to, Google or any mobile communications carrier.
+
+4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through the Android platform and/or applications for the Android platform, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so.
+
+4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under this License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach.
+5. Your Developer Credentials
+
+5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials.
+
+6. Privacy and Information
+
+6.1 In order to continually innovate and improve the SDK, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected.
+
+6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Google's Privacy Policy.
+
+7. Third Party Applications for the Android Platform
+
+7.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources.
+
+7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners.
+
+7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, this License Agreement does not affect your legal relationship with these third parties.
+
+8. Using Android APIs
+
+8.1 Android Maps API
+
+8.1.1 If you use the Android Maps API (described in the SDK by the Package name "com.google.android.maps"), the terms of your binding legal agreement with Google include this License Agreement, the Google Maps API Terms of Service and the Google Maps Terms of Service. You must read and agree to those Terms of Service before you use the Android Maps API.
+
+8.1.2 If you use the Android Maps API to retrieve map or satellite image data from Google, you must include the following copyright notice in your application or service in a manner that is reasonably available to users:
+
+"Copyright Notice: Data: (c)2007 TeleAtlas, AND, Europa Technologies, Kingway, Map Data Sciences Pty Ltd, PSMA, ZENRIN, Geocentre, MapLink/TeleAtlas; Imagery: (c)2007 DigitalGlobe, EarthSat, Sanborn, NYGIS, Scankort, TerraMetrics, MassGIS Commonwealth of Massachusetts, Digital Earth Technology."
+
+8.2 Google Data APIs
+
+8.2.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by those who provide that data (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless you have been specifically given permission to do so by the owners of that data.
+
+8.2.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so.
+
+9. Terminating this License Agreement
+
+9.1 This License Agreement will continue to apply until terminated by either you or Google as set out below.
+
+9.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials.
+
+9.3 Google may at any time, terminate this License Agreement with you if:
+
+ (A) you have breached any provision of this License Agreement; or
+
+ (B) Google is required to do so by law; or
+
+ (C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated its relationship with Google or ceased to offer certain parts of the SDK to you; or
+
+ (D) Google decides to no longer providing the SDK or certain parts of the SDK to users in the country in which you are resident or from which you use the service, or the provision of the SDK or certain SDK services to you by Google is, in Google's sole discretion, no longer commercially viable.
+
+9.4 When this License Agreement comes to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst this License Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall continue to apply to such rights, obligations and liabilities indefinitely.
+
+10. DISCLAIMER OF WARRANTIES
+
+10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE.
+
+10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE.
+
+10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+
+11. LIMITATION OF LIABILITY
+
+11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
+
+12. Indemnification
+
+12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you with this License Agreement.
+
+13. Changes to the License Agreement
+
+13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Google will make a new version of the License Agreement available on the website where the SDK is made available and with the SDK downloadable.
+
+13.2 You agree that your use of a specific version of the SDK is governed by the License Agreement included with that version of the SDK.
+
+14. General Legal Terms
+
+14.1 This License Agreement constitute the whole legal agreement between you and Google and govern your use of the SDK (excluding any services which Google may provide to you under a separate written agreement), and completely replace any prior agreements between you and Google in relation to the SDK.
+
+14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in this License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google.
+
+14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of this License Agreement is invalid, then that provision will be removed from this License Agreement without affecting the rest of this License Agreement. The remaining provisions of this License Agreement will continue to be valid and enforceable.
+
+14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to this License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of this License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to this License Agreement.
+
+14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE.
+
+14.6 The rights granted in this License Agreement may not be assigned or transferred by either you or Google without the prior written approval of the other party. Neither you nor Google shall be permitted to delegate their responsibilities or obligations under this License Agreement without the prior written approval of the other party.
+
+14.7 This License Agreement, and your relationship with Google under this License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from this License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
+
+
+November 12, 2007
+
+
Property changes on: trunk/punit.android/lib/android.license.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-27 13:05:12
|
Revision: 258
http://p-unit.svn.sourceforge.net/p-unit/?rev=258&view=rev
Author: zhanghuangzhu
Date: 2007-11-27 05:05:16 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
Share project 'punit.android' into 'https://p-unit.svn.sourceforge.net/svnroot/p-unit'
Added Paths:
-----------
trunk/punit.android/.classpath
trunk/punit.android/.project
trunk/punit.android/android.jar
trunk/punit.android/src/
trunk/punit.android/src/org/
trunk/punit.android/src/org/punit/
trunk/punit.android/src/org/punit/runner/
trunk/punit.android/src/org/punit/runner/AndroidLogger.java
trunk/punit.android/src/org/punit/runner/AndroidRunner.java
trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java
trunk/punit.android/src/org/punit/runner/AndroidWriter.java
Added: trunk/punit.android/.classpath
===================================================================
--- trunk/punit.android/.classpath (rev 0)
+++ trunk/punit.android/.classpath 2007-11-27 13:05:16 UTC (rev 258)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/punit"/>
+ <classpathentry kind="lib" path="android.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/punit.android/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.android/.project
===================================================================
--- trunk/punit.android/.project (rev 0)
+++ trunk/punit.android/.project 2007-11-27 13:05:16 UTC (rev 258)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>punit.android</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/punit.android/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.android/android.jar
===================================================================
(Binary files differ)
Property changes on: trunk/punit.android/android.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/punit.android/src/org/punit/runner/AndroidLogger.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidLogger.java (rev 0)
+++ trunk/punit.android/src/org/punit/runner/AndroidLogger.java 2007-11-27 13:05:16 UTC (rev 258)
@@ -0,0 +1,17 @@
+package org.punit.runner;
+
+import java.io.PrintWriter;
+
+import org.punit.reporter.stream.StreamLogger;
+
+public class AndroidLogger extends StreamLogger {
+ public AndroidLogger() {
+ super(new PrintWriter(new AndroidWriter()));
+ }
+
+ public boolean supportParentRunner() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Property changes on: trunk/punit.android/src/org/punit/runner/AndroidLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.android/src/org/punit/runner/AndroidRunner.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidRunner.java (rev 0)
+++ trunk/punit.android/src/org/punit/runner/AndroidRunner.java 2007-11-27 13:05:16 UTC (rev 258)
@@ -0,0 +1,11 @@
+package org.punit.runner;
+
+import org.punit.method.runner.*;
+
+public class AndroidRunner extends VanillaRunner {
+ public AndroidRunner(AbstractRunner runner) {
+ super(runner);
+ runner.removeConsoleLogger();
+ runner.addEventListener(new AndroidLogger());
+ }
+}
Property changes on: trunk/punit.android/src/org/punit/runner/AndroidRunner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java (rev 0)
+++ trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java 2007-11-27 13:05:16 UTC (rev 258)
@@ -0,0 +1,72 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+package org.punit.runner;
+
+import java.util.*;
+
+import org.punit.events.EventListener;
+import org.punit.method.builder.*;
+import org.punit.method.runner.*;
+import org.punit.reporter.*;
+import org.punit.suite.builder.*;
+
+public class AndroidSoloRunner implements Runner {
+ private AbstractRunner _runner;
+
+ public AndroidSoloRunner() {
+ super();
+ _runner.removeConsoleLogger();
+ _runner.addEventListener(new AndroidLogger());
+ }
+
+ public TestMethodBuilder methodBuilder() {
+ return _runner.methodBuilder();
+ }
+
+ public MethodRunner methodRunner() {
+ return _runner.methodRunner();
+ }
+
+ public RunnerProperties properties() {
+ return _runner.properties();
+ }
+
+ public void resultFolder(String folder) {
+ _runner.resultFolder(folder);
+ }
+
+ public String resultFolder() {
+ return _runner.resultFolder();
+ }
+
+ public int run(Class clazz) {
+ return _runner.run(clazz);
+ }
+
+ public int run(Class clazz, RunnerProperties properties) {
+ return _runner.run(clazz, properties);
+ }
+
+ public TestSuiteBuilder suiteBuilder() {
+ return _runner.suiteBuilder();
+ }
+
+ public TestResult testResult() {
+ return _runner.testResult();
+ }
+
+ public void addEventListener(EventListener listener) {
+ _runner.addEventListener(listener);
+ }
+
+ public List eventListeners() {
+ return _runner.eventListeners();
+ }
+
+ public void removeEventListener(EventListener listener) {
+ _runner.removeEventListener(listener);
+ }
+
+ public String punitName() {
+ return _runner.punitName();
+ }
+}
Property changes on: trunk/punit.android/src/org/punit/runner/AndroidSoloRunner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.android/src/org/punit/runner/AndroidWriter.java
===================================================================
--- trunk/punit.android/src/org/punit/runner/AndroidWriter.java (rev 0)
+++ trunk/punit.android/src/org/punit/runner/AndroidWriter.java 2007-11-27 13:05:16 UTC (rev 258)
@@ -0,0 +1,24 @@
+package org.punit.runner;
+
+import java.io.IOException;
+
+import android.util.Log;
+
+
+public class AndroidWriter extends java.io.Writer {
+
+ public static final String TAG = "p-unit";
+
+ public void close() throws IOException {
+ }
+
+ @Override
+ public void flush() throws IOException {
+ }
+
+ @Override
+ public void write(char[] buf, int offset, int count) throws IOException {
+ Log.e(TAG, new String(buf, offset, count));
+ }
+
+}
Property changes on: trunk/punit.android/src/org/punit/runner/AndroidWriter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-27 12:59:27
|
Revision: 257
http://p-unit.svn.sourceforge.net/p-unit/?rev=257&view=rev
Author: zhanghuangzhu
Date: 2007-11-27 04:59:32 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
Share project 'punit.android' into 'https://p-unit.svn.sourceforge.net/svnroot/p-unit'
Added Paths:
-----------
trunk/punit.android/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-27 12:54:55
|
Revision: 256
http://p-unit.svn.sourceforge.net/p-unit/?rev=256&view=rev
Author: zhanghuangzhu
Date: 2007-11-27 04:55:00 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
az: Added a Message hack, and refactored StreamLogger. Now p-unit is ready for Android!
Modified Paths:
--------------
trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java
trunk/punit.test/src/tests/api/org/punit/reporter/stream/StreamLoggerTest.java
Modified: trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java 2007-11-27 12:54:49 UTC (rev 255)
+++ trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java 2007-11-27 12:55:00 UTC (rev 256)
@@ -6,7 +6,8 @@
public class PUnitAllTests implements TestSuite {
public static void main(String[] args) {
- new SoloRunner().run(PUnitAllTests.class);
+ SoloRunner soloRunner = new SoloRunner();
+ soloRunner.run(PUnitAllTests.class);
}
public Class[] testSuite() {
Modified: trunk/punit.test/src/tests/api/org/punit/reporter/stream/StreamLoggerTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/reporter/stream/StreamLoggerTest.java 2007-11-27 12:54:49 UTC (rev 255)
+++ trunk/punit.test/src/tests/api/org/punit/reporter/stream/StreamLoggerTest.java 2007-11-27 12:55:00 UTC (rev 256)
@@ -1,7 +1,8 @@
package tests.api.org.punit.reporter.stream;
-import java.io.OutputStream;
-import java.io.PrintStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
import java.util.logging.Level;
import junit.framework.TestCase;
@@ -13,11 +14,11 @@
public class StreamLoggerTest extends TestCase {
ConsoleLogger _logger = new ConsoleLogger();
- private MockPrintStream _mockPrintStream;
+ private MockPrintWriter _mockPrintStream;
protected void setUp() throws Exception {
- _mockPrintStream = new MockPrintStream(System.err);
- _logger.setStream(_mockPrintStream, _mockPrintStream);
+ _mockPrintStream = new MockPrintWriter();
+ _logger.setWriter(new PrintWriter(_mockPrintStream));
}
public void test1() {
@@ -40,8 +41,7 @@
public void testSerializable() throws Exception {
ConsoleLogger logger = (ConsoleLogger) TestUtil.getSerialiableObject(_logger);
- assertSame(System.out, logger.outPrintStream());
- assertSame(System.err, logger.errPrintStream());
+ assertNotNull(logger.writer());
}
private void assertPrinted() {
@@ -52,17 +52,26 @@
assertFalse(_mockPrintStream._printed);
}
- private static class MockPrintStream extends PrintStream {
+ private static class MockPrintWriter extends Writer {
+ public MockPrintWriter() {
+ }
- public boolean _printed;
+ public boolean _printed;
- public MockPrintStream(OutputStream out) {
- super(out);
- }
-
public void print(String s) {
_printed = true;
}
+ public void close() throws IOException {
+
+ }
+
+ public void flush() throws IOException {
+ }
+
+ public void write(char[] arg0, int arg1, int arg2) throws IOException {
+ _printed = true;
+ }
+
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-27 12:54:44
|
Revision: 255
http://p-unit.svn.sourceforge.net/p-unit/?rev=255&view=rev
Author: zhanghuangzhu
Date: 2007-11-27 04:54:49 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
az: Added a Message hack, and refactored StreamLogger. Now p-unit is ready for Android!
Modified Paths:
--------------
trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java
Modified: trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java
===================================================================
--- trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java 2007-11-27 12:54:38 UTC (rev 254)
+++ trunk/punit.extension/src/org/punit/reporter/chart/AbstractChartReporter.java 2007-11-27 12:54:49 UTC (rev 255)
@@ -46,6 +46,7 @@
@SuppressWarnings("unchecked")
public void onRunnerStart(final Class clazz, Runner runner) {
+ ReporterUtil.initResultFolder(runner);
_runnerProperties = runner.properties();
if (!isIntermediate()) {
_render.onRunnerStart(clazz, runner);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-27 12:54:35
|
Revision: 254
http://p-unit.svn.sourceforge.net/p-unit/?rev=254&view=rev
Author: zhanghuangzhu
Date: 2007-11-27 04:54:38 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
az: Added a Message hack, and refactored StreamLogger. Now p-unit is ready for Android!
Modified Paths:
--------------
trunk/punit/src/org/punit/message/Messages.java
trunk/punit/src/org/punit/reporter/stream/StreamLogger.java
trunk/punit/src/org/punit/reporter/stream/console/ConsoleLogger.java
trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java
trunk/punit/src/org/punit/runner/AbstractRunner.java
trunk/punit/src/org/punit/util/ReporterUtil.java
Added Paths:
-----------
trunk/punit/src/org/punit/message/MessageStrings.java
trunk/punit/src/org/punit/method/runner/VanillaRunner.java
Added: trunk/punit/src/org/punit/message/MessageStrings.java
===================================================================
--- trunk/punit/src/org/punit/message/MessageStrings.java (rev 0)
+++ trunk/punit/src/org/punit/message/MessageStrings.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -0,0 +1,30 @@
+package org.punit.message;
+
+public class MessageStrings {
+ public static String[][] DATA = new String[][] {
+ {"builder.01", "\\ should implement"},
+ {"logger.01", "Starting"},
+ {"logger.total", "total:"},
+ {"logger.failures","failures:"},
+ {"logger.green","GREEN"},
+ {"logger.red", "RED"},
+ {"logger.06", "TestSuite:"},
+ {"runner.01", "solo"},
+ {"runner.02", "solo.param"},
+ {"runner.03", "concurrent"},
+ {"runner.04", "concurrent.param"},
+ {"runner.arguments", "\\ arguments"},
+ {"watcher.bytes", "bytes"},
+ {"watcher.ms", "ms"},
+ {"watcher.memory", "Memory"},
+ {"watcher.time", "Time"},
+ {"reporter.01", "result"},
+ {"reporter.02", "overview"},
+ {"PDFRender.01", "PUnit result\n"},
+ {"PDFRender.02", "the open source performance benchmark framework\n"},
+ {"assert.expected", "Expected"},
+ {"assert.got", ", but got"},
+ {"assert.notsame", "Expected a different object:"},
+ };
+
+}
Property changes on: trunk/punit/src/org/punit/message/MessageStrings.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/punit/src/org/punit/message/Messages.java
===================================================================
--- trunk/punit/src/org/punit/message/Messages.java 2007-11-19 05:22:16 UTC (rev 253)
+++ trunk/punit/src/org/punit/message/Messages.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -5,17 +5,46 @@
public class Messages {
private static final String BUNDLE_NAME = "punit"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static ResourceBundle RESOURCE_BUNDLE = null;
+ private static Hashtable MESSAGE_TABLE = null;
+
+ private static boolean isAndroid;
+
private Messages() {
}
+ static {
+ // TODO: The code is a temp quick hack for Android, and will be removed
+ // when Android supports i18n (which has been committed).
+ isAndroid = isAndroid();
+ if (isAndroid) {
+ initMessageTable();
+ } else {
+ RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+ }
+ }
+
+ private static void initMessageTable() {
+ MESSAGE_TABLE = new Hashtable();
+ for (int i = 0; i < MessageStrings.DATA.length; ++i) {
+ MESSAGE_TABLE.put(MessageStrings.DATA[i][0],
+ MessageStrings.DATA[i][1]);
+ }
+ }
+
public static String getString(String key) {
+ if(isAndroid) {
+ return (String) MESSAGE_TABLE.get(key);
+ }
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
+
+ public static boolean isAndroid() {
+ return "Dalvik".equals(System.getProperty("java.vm.name"));
+ }
}
Added: trunk/punit/src/org/punit/method/runner/VanillaRunner.java
===================================================================
--- trunk/punit/src/org/punit/method/runner/VanillaRunner.java (rev 0)
+++ trunk/punit/src/org/punit/method/runner/VanillaRunner.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -0,0 +1,70 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+package org.punit.method.runner;
+
+import java.util.*;
+
+import org.punit.events.EventListener;
+import org.punit.method.builder.*;
+import org.punit.reporter.*;
+import org.punit.runner.*;
+import org.punit.suite.builder.*;
+
+public class VanillaRunner implements Runner {
+ private Runner _runner;
+
+ public VanillaRunner(Runner runner) {
+ _runner = runner;
+ }
+
+ public TestMethodBuilder methodBuilder() {
+ return _runner.methodBuilder();
+ }
+
+ public MethodRunner methodRunner() {
+ return _runner.methodRunner();
+ }
+
+ public RunnerProperties properties() {
+ return _runner.properties();
+ }
+
+ public void resultFolder(String folder) {
+ _runner.resultFolder(folder);
+ }
+
+ public String resultFolder() {
+ return _runner.resultFolder();
+ }
+
+ public int run(Class clazz) {
+ return _runner.run(clazz);
+ }
+
+ public int run(Class clazz, RunnerProperties properties) {
+ return _runner.run(clazz, properties);
+ }
+
+ public TestSuiteBuilder suiteBuilder() {
+ return _runner.suiteBuilder();
+ }
+
+ public TestResult testResult() {
+ return _runner.testResult();
+ }
+
+ public void addEventListener(EventListener listener) {
+ _runner.addEventListener(listener);
+ }
+
+ public List eventListeners() {
+ return _runner.eventListeners();
+ }
+
+ public void removeEventListener(EventListener listener) {
+ _runner.removeEventListener(listener);
+ }
+
+ public String punitName() {
+ return _runner.punitName();
+ }
+}
Property changes on: trunk/punit/src/org/punit/method/runner/VanillaRunner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/punit/src/org/punit/reporter/stream/StreamLogger.java
===================================================================
--- trunk/punit/src/org/punit/reporter/stream/StreamLogger.java 2007-11-19 05:22:16 UTC (rev 253)
+++ trunk/punit/src/org/punit/reporter/stream/StreamLogger.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -2,7 +2,7 @@
package org.punit.reporter.stream;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
@@ -21,10 +21,8 @@
public abstract class StreamLogger implements EventListener {
- protected transient PrintStream _outStream;
+ protected transient PrintWriter _writer;
- protected transient PrintStream _errStream;
-
protected transient TestResult _result;
public Level _level = Level.INFO;
@@ -32,11 +30,11 @@
private TimeWatcher _timeWatcher;
public StreamLogger() {
+
}
- public StreamLogger(PrintStream out, PrintStream err) {
- _outStream = out;
- _errStream = err;
+ public StreamLogger(PrintWriter writer) {
+ _writer = writer;
}
public void onRunnerStart(Class clazz, Runner runner) {
@@ -60,8 +58,13 @@
public void onRunnerEnd(Class clazz, Runner runner) {
logResult();
+ closeStream();
}
+ protected void closeStream() {
+ _writer.close();
+ }
+
public void logResult() {
stopTimeWatcher();
StringBuffer sb = new StringBuffer();
@@ -81,13 +84,13 @@
sb.append(") - "); //$NON-NLS-1$
sb.append(_timeWatcher.stringValue());
sb.append(ReporterUtil.LINE_SEPERATOR);
- logErr(sb.toString(), Level.SEVERE);
+ log(sb.toString(), Level.SEVERE);
TraverserUtil.traverse(failures.iterator(), new Traverser() {
int count = 0;
public void traverse(Object obj) {
- logErr(++count + ")", Level.SEVERE); //$NON-NLS-1$
+ log(++count + ")", Level.SEVERE); //$NON-NLS-1$
if(shouldLog(Level.SEVERE)) {
- ((Throwable) obj).printStackTrace(_errStream);
+ ((Throwable) obj).printStackTrace(_writer);
}
}
});
@@ -106,7 +109,7 @@
}
public void onClassStart(Object testInstance) {
- // logln(testInstance.getClass().getName(), Level.INFO);
+ logln(testInstance.getClass().getName(), Level.INFO);
}
public void onClassEnd(Object testInstance, Throwable t) {
@@ -145,17 +148,13 @@
log(sb.toString(), Level.INFO);
}
- public void setStream(PrintStream out, PrintStream err) {
- _outStream = out;
- _errStream = err;
+ public void setWriter(PrintWriter writer) {
+ _writer = writer;
}
- public PrintStream outPrintStream() {
- return _outStream;
- }
- public PrintStream errPrintStream() {
- return _errStream;
+ public PrintWriter writer() {
+ return _writer;
}
public void logln(Level level) {
@@ -167,14 +166,10 @@
}
public void log(String message, Level level) {
- log(_outStream, message, level);
+ log(_writer, message, level);
}
- public void logErr(String message, Level level) {
- log(_errStream, message, level);
- }
-
- private void log(PrintStream ps, String message, Level level) {
+ private void log(PrintWriter ps, String message, Level level) {
if (ps == null) {
return;
}
Modified: trunk/punit/src/org/punit/reporter/stream/console/ConsoleLogger.java
===================================================================
--- trunk/punit/src/org/punit/reporter/stream/console/ConsoleLogger.java 2007-11-19 05:22:16 UTC (rev 253)
+++ trunk/punit/src/org/punit/reporter/stream/console/ConsoleLogger.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -2,6 +2,8 @@
package org.punit.reporter.stream.console;
+import java.io.PrintWriter;
+
import org.punit.reporter.stream.StreamLogger;
public class ConsoleLogger extends StreamLogger {
@@ -10,15 +12,18 @@
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException, ClassNotFoundException {
- _outStream = System.out;
- _errStream = System.err;
+ _writer = new PrintWriter(System.err);
}
public ConsoleLogger() {
- super(System.out, System.err);
+ super(new PrintWriter(System.err));
}
public boolean supportParentRunner() {
return false;
}
+
+ protected void closeStream() {
+
+ }
}
Modified: trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java
===================================================================
--- trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java 2007-11-19 05:22:16 UTC (rev 253)
+++ trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -2,7 +2,7 @@
package org.punit.reporter.stream.file;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.punit.reporter.stream.StreamLogger;
import org.punit.runner.Runner;
@@ -24,13 +24,14 @@
public void onRunnerStart(Class clazz, Runner runner) {
if(_fileName == null) {
+ ReporterUtil.initResultFolder(runner);
_fileName = ReporterUtil.defaultFileName(clazz, runner) + ".txt"; //$NON-NLS-1$
_fileName = ReporterUtil.generateFileName(_fileName, runner);
}
try {
- PrintStream ps = new PrintStream(_fileName);
- setStream(ps, ps);
+ PrintWriter ps = new PrintWriter(_fileName);
+ setWriter(ps);
} catch (Exception e) {
throw new IllegalStateException(e);
}
@@ -39,9 +40,11 @@
public void onRunnerEnd(Class clazz, Runner runner) {
super.onRunnerEnd(clazz, runner);
- _outStream.close();
}
+ public void close() {
+ _writer.close();
+ }
public boolean supportParentRunner() {
return false;
}
Modified: trunk/punit/src/org/punit/runner/AbstractRunner.java
===================================================================
--- trunk/punit/src/org/punit/runner/AbstractRunner.java 2007-11-19 05:22:16 UTC (rev 253)
+++ trunk/punit/src/org/punit/runner/AbstractRunner.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -70,7 +70,6 @@
}
public int run(Class clazz) {
- initResultFolder();
onRunnerStart(clazz);
Object[] testClasses = _testSuiteBuiler.buildTestClasses(clazz);
runTestClasses(testClasses);
@@ -78,10 +77,6 @@
return _testResult.failures().size();
}
- private void initResultFolder() {
- new File(resultFolder()).mkdirs();
- }
-
public int run(Class clazz, RunnerProperties properties) {
setRunnerProperties(properties);
return run(clazz);
Modified: trunk/punit/src/org/punit/util/ReporterUtil.java
===================================================================
--- trunk/punit/src/org/punit/util/ReporterUtil.java 2007-11-19 05:22:16 UTC (rev 253)
+++ trunk/punit/src/org/punit/util/ReporterUtil.java 2007-11-27 12:54:38 UTC (rev 254)
@@ -1,3 +1,5 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
package org.punit.util;
import java.io.File;
@@ -7,7 +9,10 @@
import org.punit.runner.RunnerProperties;
public class ReporterUtil {
+
public final static String LINE_SEPERATOR;
+
+ private static boolean _isResultFolderCreated;
static {
LINE_SEPERATOR = System.getProperty("line.separator"); //$NON-NLS-1$
@@ -59,5 +64,13 @@
}
return sb.toString();
}
-
+
+ public static void initResultFolder(Runner runner) {
+ if(_isResultFolderCreated) {
+ return;
+ }
+ _isResultFolderCreated = true;
+ new File(runner.resultFolder()).mkdirs();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 05:22:12
|
Revision: 253
http://p-unit.svn.sourceforge.net/p-unit/?rev=253&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 21:22:16 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: make result folder configurable.
Modified Paths:
--------------
trunk/punit/src/org/punit/reporter/stream/StreamLogger.java
trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java
trunk/punit/src/org/punit/runner/AbstractRunner.java
trunk/punit/src/org/punit/runner/Runner.java
trunk/punit/src/org/punit/util/ReporterUtil.java
Removed Paths:
-------------
trunk/punit/src/org/punit/runner/RunnerConstants.java
Modified: trunk/punit/src/org/punit/reporter/stream/StreamLogger.java
===================================================================
--- trunk/punit/src/org/punit/reporter/stream/StreamLogger.java 2007-11-19 05:21:48 UTC (rev 252)
+++ trunk/punit/src/org/punit/reporter/stream/StreamLogger.java 2007-11-19 05:22:16 UTC (rev 253)
@@ -174,7 +174,7 @@
log(_errStream, message, level);
}
- public void log(PrintStream ps, String message, Level level) {
+ private void log(PrintStream ps, String message, Level level) {
if (ps == null) {
return;
}
Modified: trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java
===================================================================
--- trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java 2007-11-19 05:21:48 UTC (rev 252)
+++ trunk/punit/src/org/punit/reporter/stream/file/FileLogger.java 2007-11-19 05:22:16 UTC (rev 253)
@@ -25,10 +25,11 @@
public void onRunnerStart(Class clazz, Runner runner) {
if(_fileName == null) {
_fileName = ReporterUtil.defaultFileName(clazz, runner) + ".txt"; //$NON-NLS-1$
+ _fileName = ReporterUtil.generateFileName(_fileName, runner);
}
- String fileName = ReporterUtil.generateFileName(_fileName);
+
try {
- PrintStream ps = new PrintStream(fileName);
+ PrintStream ps = new PrintStream(_fileName);
setStream(ps, ps);
} catch (Exception e) {
throw new IllegalStateException(e);
Modified: trunk/punit/src/org/punit/runner/AbstractRunner.java
===================================================================
--- trunk/punit/src/org/punit/runner/AbstractRunner.java 2007-11-19 05:21:48 UTC (rev 252)
+++ trunk/punit/src/org/punit/runner/AbstractRunner.java 2007-11-19 05:22:16 UTC (rev 253)
@@ -13,6 +13,7 @@
import org.punit.events.EventListener;
import org.punit.exception.IOException;
import org.punit.exception.ReflectionException;
+import org.punit.message.Messages;
import org.punit.method.builder.TestMethodBuilder;
import org.punit.method.runner.MethodRunner;
import org.punit.reporter.TestResult;
@@ -48,6 +49,8 @@
private Convention _convention;
+ private String _folder;
+
public AbstractRunner(TestSuiteBuilder testSuiteBuiler,
TestMethodBuilder testMethodBuilder, MethodRunner testMethodRunner) {
_testSuiteBuiler = testSuiteBuiler;
@@ -67,7 +70,7 @@
}
public int run(Class clazz) {
- initResultFolder();
+ initResultFolder();
onRunnerStart(clazz);
Object[] testClasses = _testSuiteBuiler.buildTestClasses(clazz);
runTestClasses(testClasses);
@@ -75,7 +78,11 @@
return _testResult.failures().size();
}
- public int run(Class clazz, RunnerProperties properties) {
+ private void initResultFolder() {
+ new File(resultFolder()).mkdirs();
+ }
+
+ public int run(Class clazz, RunnerProperties properties) {
setRunnerProperties(properties);
return run(clazz);
}
@@ -115,7 +122,6 @@
}
public void runVMs(Class clazz, VM[] vms) {
- initResultFolder();
_properties.isParent = true;
_properties.vms = vms;
for (int i = 0; i < vms.length; ++i) {
@@ -180,12 +186,12 @@
}
private String runnerConfigFileName(VM vm) {
- return RunnerConstants.RESULT_FOLDER + File.separator + vm.punitName()
+ return resultFolder() + File.separator + vm.punitName()
+ ".cfg"; //$NON-NLS-1$
}
private String runnerPropertiesFileName(VM vm) {
- return RunnerConstants.RESULT_FOLDER + File.separator + vm.punitName()
+ return resultFolder() + File.separator + vm.punitName()
+ ".props"; //$NON-NLS-1$
}
@@ -215,10 +221,6 @@
});
}
- private void initResultFolder() {
- new File(RunnerConstants.RESULT_FOLDER).mkdir();
- }
-
private void onRunnerEnd(final Class clazz) {
TraverserUtil.traverse(_eventListeners.iterator(), new Traverser() {
public void traverse(Object obj) {
@@ -235,6 +237,17 @@
}
}
+ public void resultFolder(String folder) {
+ _folder = folder;
+ }
+
+ public String resultFolder() {
+ if(_folder == null) {
+ _folder = Messages.getString("reporter.01"); //$NON-NLS-1$
+ }
+ return _folder;
+ }
+
private class RunTestClassTask implements Runnable {
private Class _clazz;
Modified: trunk/punit/src/org/punit/runner/Runner.java
===================================================================
--- trunk/punit/src/org/punit/runner/Runner.java 2007-11-19 05:21:48 UTC (rev 252)
+++ trunk/punit/src/org/punit/runner/Runner.java 2007-11-19 05:22:16 UTC (rev 253)
@@ -27,4 +27,8 @@
public TestResult testResult();
+ public void resultFolder(String folder);
+
+ public String resultFolder();
+
}
Deleted: trunk/punit/src/org/punit/runner/RunnerConstants.java
===================================================================
--- trunk/punit/src/org/punit/runner/RunnerConstants.java 2007-11-19 05:21:48 UTC (rev 252)
+++ trunk/punit/src/org/punit/runner/RunnerConstants.java 2007-11-19 05:22:16 UTC (rev 253)
@@ -1,10 +0,0 @@
-package org.punit.runner;
-
-import org.punit.message.*;
-
-public class RunnerConstants {
-
- public static final String RESULT_FOLDER = Messages
- .getString("reporter.01"); //$NON-NLS-1$
-
-}
Modified: trunk/punit/src/org/punit/util/ReporterUtil.java
===================================================================
--- trunk/punit/src/org/punit/util/ReporterUtil.java 2007-11-19 05:21:48 UTC (rev 252)
+++ trunk/punit/src/org/punit/util/ReporterUtil.java 2007-11-19 05:22:16 UTC (rev 253)
@@ -4,7 +4,6 @@
import java.lang.reflect.Method;
import org.punit.runner.Runner;
-import org.punit.runner.RunnerConstants;
import org.punit.runner.RunnerProperties;
public class ReporterUtil {
@@ -38,11 +37,11 @@
return sb.toString();
}
- public static String generateFileName(String fileName) {
+ public static String generateFileName(String fileName, Runner runner) {
StringBuffer sb = new StringBuffer();
sb.append(IOUtil.getCurrentPath());
sb.append(File.separator);
- sb.append(RunnerConstants.RESULT_FOLDER);
+ sb.append(runner.resultFolder());
sb.append(File.separator);
sb.append(fileName);
return sb.toString();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 05:21:48
|
Revision: 252
http://p-unit.svn.sourceforge.net/p-unit/?rev=252&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 21:21:48 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: make result folder configurable.
Modified Paths:
--------------
trunk/punit.extension/src/org/punit/reporter/chart/pdf/PDFRender.java
Modified: trunk/punit.extension/src/org/punit/reporter/chart/pdf/PDFRender.java
===================================================================
--- trunk/punit.extension/src/org/punit/reporter/chart/pdf/PDFRender.java 2007-11-19 04:15:55 UTC (rev 251)
+++ trunk/punit.extension/src/org/punit/reporter/chart/pdf/PDFRender.java 2007-11-19 05:21:48 UTC (rev 252)
@@ -32,34 +32,25 @@
private int _height;
private int _width;
-
- private String _fileName;
-
+
private transient Document _document;
private transient PdfWriter _writer;
public PDFRender() {
- this(null, PDFConstants.DEFAULT_HEIGHT, PDFConstants.DEFAULT_WIDTH);
+ this(PDFConstants.DEFAULT_HEIGHT, PDFConstants.DEFAULT_WIDTH);
}
- public PDFRender(String fileName) {
- this(fileName, PDFConstants.DEFAULT_HEIGHT, PDFConstants.DEFAULT_WIDTH);
- }
-
- public PDFRender(String fileName, int height, int width) {
- _fileName = fileName;
+ public PDFRender(int height, int width) {
_height = height;
_width = width;
}
public void onRunnerStart(Class<?> clazz, Runner runner) {
- if (_fileName == null) {
- _fileName = ReporterUtil.defaultFileName(clazz, runner)
+ String fileName = ReporterUtil.defaultFileName(clazz, runner)
+ PDFConstants.POSTFIX;
- }
- String fileName = ReporterUtil.generateFileName(_fileName);
+ fileName = ReporterUtil.generateFileName(fileName, runner);
initPDFDocument(fileName);
renderPreface();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 04:15:50
|
Revision: 251
http://p-unit.svn.sourceforge.net/p-unit/?rev=251&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 20:15:55 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: cleanup
Removed Paths:
-------------
trunk/punit.test/src/extension/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 04:09:50
|
Revision: 250
http://p-unit.svn.sourceforge.net/p-unit/?rev=250&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 20:09:55 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: cleanup
Removed Paths:
-------------
trunk/punit.test/src/extension/tests/api/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 04:05:10
|
Revision: 249
http://p-unit.svn.sourceforge.net/p-unit/?rev=249&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 20:05:14 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: move some tests to punit.extension.test
Modified Paths:
--------------
trunk/punit.test/.classpath
trunk/punit.test/src/tests/api/org/punit/all/AllTests.java
Added Paths:
-----------
trunk/punit.test/lib/
trunk/punit.test/lib/junit-4.3.1.jar
trunk/punit.test/lib/junit.license.html
Removed Paths:
-------------
trunk/punit.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java
Modified: trunk/punit.test/.classpath
===================================================================
--- trunk/punit.test/.classpath 2007-11-19 04:04:12 UTC (rev 248)
+++ trunk/punit.test/.classpath 2007-11-19 04:05:14 UTC (rev 249)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry path="src" kind="src"/>
- <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>
- <classpathentry path="/punit.extension" combineaccessrules="false" kind="src"/>
- <classpathentry path="bin" kind="output"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/punit"/>
+ <classpathentry kind="lib" path="lib/junit-4.3.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/punit.test/lib/junit-4.3.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/punit.test/lib/junit-4.3.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/punit.test/lib/junit.license.html
===================================================================
--- trunk/punit.test/lib/junit.license.html (rev 0)
+++ trunk/punit.test/lib/junit.license.html 2007-11-19 04:05:14 UTC (rev 249)
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+<TITLE>Common Public License - v 1.0</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</HEAD>
+
+<BODY BGCOLOR="#FFFFFF" VLINK="#800000">
+
+
+<P ALIGN="CENTER"><B>Common Public License - v 1.0</B>
+<P><B></B><FONT SIZE="3"></FONT>
+<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>1. DEFINITIONS</B></FONT>
+<P><FONT SIZE="2">"Contribution" means:</FONT>
+
+<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT">
+b) in the case of each subsequent Contributor:</FONT></UL>
+
+
+<UL><FONT SIZE="2">i) changes to the Program, and</FONT></UL>
+
+
+<UL><FONT SIZE="2">ii) additions to the Program;</FONT></UL>
+
+
+<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. </FONT><FONT SIZE="2">Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. </FONT></UL>
+
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. </FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT>
+<P><FONT SIZE="2"><B></B></FONT>
+<P><FONT SIZE="2"><B>2. GRANT OF RIGHTS</B></FONT>
+
+<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a) </FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. </FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2">c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2">d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+<P><FONT SIZE="2"><B>3. REQUIREMENTS</B></FONT>
+<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT>
+
+<UL><FONT SIZE="2">a) it complies with the terms and conditions of this Agreement; and</FONT></UL>
+
+
+<UL><FONT SIZE="2">b) its license agreement:</FONT></UL>
+
+
+<UL><FONT SIZE="2">i) effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL>
+
+
+<UL><FONT SIZE="2">ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL>
+
+
+<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2"> states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL>
+
+
+<UL><FONT SIZE="2">iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL>
+
+
+<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL>
+
+<P><FONT SIZE="2">When the Program is made available in source code form:</FONT>
+
+<UL><FONT SIZE="2">a) it must be made available under this Agreement; and </FONT></UL>
+
+
+<UL><FONT SIZE="2">b) a copy of this Agreement must be included with each copy of the Program. </FONT></UL>
+
+<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT>
+<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program. </FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. </FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>4. COMMERCIAL DISTRIBUTION</B></FONT>
+<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT>
+<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5. NO WARRANTY</B></FONT>
+<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">. </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6. DISCLAIMER OF LIABILITY</B></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>7. GENERAL</B></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version. </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2"> All rights in the Program not expressly granted under this Agreement are reserved.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+
+</BODY>
+
+</HTML>
\ No newline at end of file
Property changes on: trunk/punit.test/lib/junit.license.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/punit.test/src/tests/api/org/punit/all/AllTests.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 04:04:12 UTC (rev 248)
+++ trunk/punit.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 04:05:14 UTC (rev 249)
@@ -7,7 +7,6 @@
import tests.api.org.punit.method.builder.TestMethodBuilderTest;
import tests.api.org.punit.reporter.stream.StreamLoggerTest;
import tests.api.org.punit.runner.AbstractRunnerTest;
-import tests.api.org.punit.runner.ExecutorPoolTest;
import tests.api.org.punit.util.LoggerUtilTest;
import tests.api.org.punit.util.ReflectionUtilTest;
import tests.api.org.punit.watcher.CustomWatcherTest;
@@ -32,7 +31,6 @@
AbstractRunnerTest.class,
AssertTest.class,
ConcurrentExceptionTest.class,
- ExecutorPoolTest.class,
LoggerUtilTest.class,
MemoryWatcherTest.class,
CustomWatcherTest.class,
Deleted: trunk/punit.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java 2007-11-19 04:04:12 UTC (rev 248)
+++ trunk/punit.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java 2007-11-19 04:05:14 UTC (rev 249)
@@ -1,51 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package tests.api.org.punit.runner;
-
-import org.punit.assertion.*;
-import org.punit.runner.*;
-
-import tests.util.*;
-
-import junit.framework.*;
-
-public class ExecutorPoolTest extends TestCase {
-
- private ExecutorPoolImpl _pool = new ExecutorPoolImpl(5);
-
- public void testCtor() {
- AssertUtil.assertException(IllegalArgumentException.class,
- new CodeRunner() {
- public void run() throws Throwable {
- new ExecutorPoolImpl(0);
- }
- });
- }
-
- public void testStartJoin() {
- _pool.start();
- _pool.join();
- }
-
- public void testExecute() {
- _pool.start();
- RunnableTask task = new RunnableTask();
- _pool.execute(task);
- _pool.join();
- task.assertExecuted();
- }
-
- static class RunnableTask implements Runnable {
-
- private boolean _executed;
-
- public void run() {
- _executed = true;
- }
-
- public void assertExecuted() {
- assertTrue(_executed);
- }
-
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 04:04:07
|
Revision: 248
http://p-unit.svn.sourceforge.net/p-unit/?rev=248&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 20:04:12 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: move some tests to punit.extension.test
Modified Paths:
--------------
trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java
Added Paths:
-----------
trunk/punit.extension.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java
Modified: trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 03:54:14 UTC (rev 247)
+++ trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 04:04:12 UTC (rev 248)
@@ -9,6 +9,7 @@
import tests.api.org.punit.method.runner.AbstractTestMethodRunnerTest;
import tests.api.org.punit.reporter.chart.AbstractChartReporterTest;
import tests.api.org.punit.runner.ConcurrentRunnerTest;
+import tests.api.org.punit.runner.ExecutorPoolTest;
import tests.api.org.punit.runner.SoloRunnerExtensionTest;
import tests.api.org.punit.runner.SoloRunnerTest;
import tests.api.org.punit.suite.builder.TestSuiteBuilderTest;
@@ -32,6 +33,7 @@
AbstractTestMethodRunnerTest.class,
AnnotationFilterTest.class,
ConcurrentRunnerTest.class,
+ ExecutorPoolTest.class,
JUnitAnnotationConventionTest.class,
NameConventionFilterTest.class,
SoloRunnerExtensionTest.class,
Added: trunk/punit.extension.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java 2007-11-19 04:04:12 UTC (rev 248)
@@ -0,0 +1,51 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.runner;
+
+import org.punit.assertion.*;
+import org.punit.runner.*;
+
+import tests.util.*;
+
+import junit.framework.*;
+
+public class ExecutorPoolTest extends TestCase {
+
+ private ExecutorPoolImpl _pool = new ExecutorPoolImpl(5);
+
+ public void testCtor() {
+ AssertUtil.assertException(IllegalArgumentException.class,
+ new CodeRunner() {
+ public void run() throws Throwable {
+ new ExecutorPoolImpl(0);
+ }
+ });
+ }
+
+ public void testStartJoin() {
+ _pool.start();
+ _pool.join();
+ }
+
+ public void testExecute() {
+ _pool.start();
+ RunnableTask task = new RunnableTask();
+ _pool.execute(task);
+ _pool.join();
+ task.assertExecuted();
+ }
+
+ static class RunnableTask implements Runnable {
+
+ private boolean _executed;
+
+ public void run() {
+ _executed = true;
+ }
+
+ public void assertExecuted() {
+ assertTrue(_executed);
+ }
+
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/runner/ExecutorPoolTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:54:11
|
Revision: 247
http://p-unit.svn.sourceforge.net/p-unit/?rev=247&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:54:14 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: move some tests to punit.extension.test
Added Paths:
-----------
trunk/punit.extension.test/src/extension/
trunk/punit.extension.test/src/extension/tests/
trunk/punit.extension.test/src/extension/tests/samples/
trunk/punit.extension.test/src/extension/tests/samples/JUnitTestSample.java
trunk/punit.extension.test/src/extension/tests/samples/OverviewVMsSample.java
trunk/punit.extension.test/src/extension/tests/samples/PUnitTestSuiteSample.java
trunk/punit.extension.test/src/extension/tests/samples/TestClassVMsSample.java
trunk/punit.extension.test/src/extension/tests/samples/TestSuiteVMsSample.java
Added: trunk/punit.extension.test/src/extension/tests/samples/JUnitTestSample.java
===================================================================
--- trunk/punit.extension.test/src/extension/tests/samples/JUnitTestSample.java (rev 0)
+++ trunk/punit.extension.test/src/extension/tests/samples/JUnitTestSample.java 2007-11-19 03:54:14 UTC (rev 247)
@@ -0,0 +1,20 @@
+package extension.tests.samples;
+
+import org.punit.reporter.chart.OverviewReporter;
+import org.punit.reporter.chart.image.ImageRender;
+import org.punit.runner.SoloRunner;
+
+import tests.api.org.punit.testclasses.JUnitTestClass;
+import tests.util.TestUtil;
+
+public class JUnitTestSample {
+
+ public static void main(String[] args) {
+ TestUtil.runUnitTest = false;
+ SoloRunner runner = new SoloRunner();
+ OverviewReporter reporter = new OverviewReporter(new ImageRender());
+ runner.addEventListener(reporter);
+ runner.run(JUnitTestClass.class);
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/extension/tests/samples/JUnitTestSample.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/extension/tests/samples/OverviewVMsSample.java
===================================================================
--- trunk/punit.extension.test/src/extension/tests/samples/OverviewVMsSample.java (rev 0)
+++ trunk/punit.extension.test/src/extension/tests/samples/OverviewVMsSample.java 2007-11-19 03:54:14 UTC (rev 247)
@@ -0,0 +1,16 @@
+package extension.tests.samples;
+
+import org.punit.events.EventListener;
+import org.punit.reporter.chart.OverviewReporter;
+import org.punit.reporter.chart.image.ImageRender;
+
+import tests.api.org.punit.testclasses.TestSuiteClass;
+import tests.util.TestUtil;
+
+public class OverviewVMsSample {
+ public static void main(String[] args) {
+ TestUtil.runVMs(TestSuiteClass.class,
+ new EventListener[] { new OverviewReporter(
+ new ImageRender()) });
+ }
+}
Property changes on: trunk/punit.extension.test/src/extension/tests/samples/OverviewVMsSample.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/extension/tests/samples/PUnitTestSuiteSample.java
===================================================================
--- trunk/punit.extension.test/src/extension/tests/samples/PUnitTestSuiteSample.java (rev 0)
+++ trunk/punit.extension.test/src/extension/tests/samples/PUnitTestSuiteSample.java 2007-11-19 03:54:14 UTC (rev 247)
@@ -0,0 +1,24 @@
+package extension.tests.samples;
+
+import org.punit.reporter.chart.*;
+import org.punit.reporter.chart.image.*;
+import org.punit.runner.*;
+
+import tests.api.org.punit.testclasses.*;
+import tests.util.*;
+
+public class PUnitTestSuiteSample {
+
+ public static void main(String[] args) {
+ TestUtil.runUnitTest = false;
+ Runner[] runners = new Runner[] {
+ new SoloRunner(),
+ new ConcurrentRunner(),
+ };
+ for(int i = 0; i < runners.length; ++i) {
+ runners[i].addEventListener(new OverviewReporter(new ImageRender()));
+ runners[i].run(TestSuiteClass.class);
+ }
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/extension/tests/samples/PUnitTestSuiteSample.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/extension/tests/samples/TestClassVMsSample.java
===================================================================
--- trunk/punit.extension.test/src/extension/tests/samples/TestClassVMsSample.java (rev 0)
+++ trunk/punit.extension.test/src/extension/tests/samples/TestClassVMsSample.java 2007-11-19 03:54:14 UTC (rev 247)
@@ -0,0 +1,31 @@
+package extension.tests.samples;
+
+import org.punit.events.EventListener;
+import org.punit.reporter.chart.TestClassReporter;
+import org.punit.reporter.chart.image.ImageRender;
+
+import tests.util.TestUtil;
+
+public class TestClassVMsSample {
+ public static void main(String[] args) {
+ TestUtil.runVMs(TestClassVMsSample.class,
+ new EventListener[] { new TestClassReporter(
+ new ImageRender()) });
+ }
+
+ public void test1() {
+ TestUtil.consumeMemory(200000);
+ TestUtil.consumeTime(1000);
+ }
+
+ public void test2() {
+ TestUtil.consumeMemory(100000);
+ TestUtil.consumeTime(1000);
+ }
+
+ public void test3() {
+ TestUtil.consumeMemory(200000);
+ TestUtil.consumeTime(2000);
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/extension/tests/samples/TestClassVMsSample.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/extension/tests/samples/TestSuiteVMsSample.java
===================================================================
--- trunk/punit.extension.test/src/extension/tests/samples/TestSuiteVMsSample.java (rev 0)
+++ trunk/punit.extension.test/src/extension/tests/samples/TestSuiteVMsSample.java 2007-11-19 03:54:14 UTC (rev 247)
@@ -0,0 +1,17 @@
+package extension.tests.samples;
+
+import org.punit.events.EventListener;
+import org.punit.reporter.chart.TestSuiteReporter;
+import org.punit.reporter.chart.pdf.PDFRender;
+
+import tests.api.org.punit.testclasses.TestSuite2;
+import tests.util.TestUtil;
+
+public class TestSuiteVMsSample {
+
+ public static void main(String[] args) {
+ TestUtil.runVMs(TestSuite2.class,
+ new EventListener[] { new TestSuiteReporter(new PDFRender()) });
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/extension/tests/samples/TestSuiteVMsSample.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:50:01
|
Revision: 246
http://p-unit.svn.sourceforge.net/p-unit/?rev=246&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:50:06 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: cleanup
Removed Paths:
-------------
trunk/punit.test/src/extension/tests/api/org/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:46:53
|
Revision: 245
http://p-unit.svn.sourceforge.net/p-unit/?rev=245&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:46:56 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: move some tests to punit.extension.test
Removed Paths:
-------------
trunk/punit.test/src/extension/tests/api/org/punit/
trunk/punit.test/src/tests/api/org/punit/suite/
trunk/punit.test/src/tests/sample/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:44:32
|
Revision: 244
http://p-unit.svn.sourceforge.net/p-unit/?rev=244&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:44:32 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: move some tests to punit.extension.test
Removed Paths:
-------------
trunk/punit.test/src/extension/tests/api/org/punit/reporter/
trunk/punit.test/src/extension/tests/samples/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:40:50
|
Revision: 243
http://p-unit.svn.sourceforge.net/p-unit/?rev=243&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:40:54 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Andrew Zhang: move some tests to punit.extension.test
Modified Paths:
--------------
trunk/punit.test/src/tests/api/org/punit/all/AllTests.java
trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java
trunk/punit.test/src/tests/api/org/punit/runner/MockEventListener.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass0.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass1.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass3.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite1.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite2.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuiteClass.java
trunk/punit.test/src/tests/api/org/punit/util/ReflectionUtilTest.java
trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java
trunk/punit.test/src/tests/util/AssertUtil.java
trunk/punit.test/src/tests/util/TestUtil.java
Added Paths:
-----------
trunk/punit.test/.settings/
trunk/punit.test/.settings/org.eclipse.jdt.core.prefs
Removed Paths:
-------------
trunk/punit.test/src/extension/tests/api/org/punit/reporter/chart/
trunk/punit.test/src/extension/tests/api/org/punit/runner/
trunk/punit.test/src/extension/tests/sample/
trunk/punit.test/src/tests/api/org/punit/convention/
trunk/punit.test/src/tests/api/org/punit/method/runner/
trunk/punit.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java
trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
trunk/punit.test/src/tests/api/org/punit/suite/builder/
trunk/punit.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java
trunk/punit.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java
trunk/punit.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java
trunk/punit.test/src/tests/api/org/punit/testclasses/LoopTestClass.java
trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
trunk/punit.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java
Added: trunk/punit.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/punit.test/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/punit.test/.settings/org.eclipse.jdt.core.prefs 2007-11-19 03:40:54 UTC (rev 243)
@@ -0,0 +1,12 @@
+#Mon Nov 19 00:43:30 CST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
Property changes on: trunk/punit.test/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/punit.test/src/tests/api/org/punit/all/AllTests.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -3,50 +3,43 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import tests.api.org.punit.assertion.AssertTest;
-import tests.api.org.punit.convention.AnnotationFilterTest;
-import tests.api.org.punit.convention.JUnitAnnotationConventionTest;
-import tests.api.org.punit.convention.NameConventionFilterTest;
import tests.api.org.punit.exception.ConcurrentExceptionTest;
import tests.api.org.punit.method.builder.TestMethodBuilderTest;
-import tests.api.org.punit.method.runner.AbstractTestMethodRunnerTest;
import tests.api.org.punit.reporter.stream.StreamLoggerTest;
import tests.api.org.punit.runner.AbstractRunnerTest;
-import tests.api.org.punit.runner.ConcurrentRunnerTest;
import tests.api.org.punit.runner.ExecutorPoolTest;
-import tests.api.org.punit.runner.SoloRunnerTest;
-import tests.api.org.punit.suite.builder.TestSuiteBuilderTest;
import tests.api.org.punit.util.LoggerUtilTest;
import tests.api.org.punit.util.ReflectionUtilTest;
import tests.api.org.punit.watcher.CustomWatcherTest;
import tests.api.org.punit.watcher.MemoryWatcherTest;
import tests.api.org.punit.watcher.TimeWatcherTest;
-import extension.tests.api.org.punit.reporter.chart.AbstractChartReporterTest;
-import extension.tests.api.org.punit.runner.SoloRunnerExtensionTest;
public class AllTests {
- @SuppressWarnings("unchecked")
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for tests.api.org.punit"); //$NON-NLS-1$
- // $JUnit-BEGIN$
- for (Class testCase : testSuite()) {
- suite.addTestSuite(testCase);
- }
- // $JUnit-END$
- return suite;
- }
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for tests.api.org.punit"); //$NON-NLS-1$
+ // $JUnit-BEGIN$
+ Class[] tests = testSuite();
+ for (int i = 0; i < tests.length; ++i) {
+ suite.addTestSuite(tests[i]);
+ }
+ // $JUnit-END$
+ return suite;
+ }
- public static final Class<?>[] testSuite() {
- return new Class[] { AbstractChartReporterTest.class,
- AbstractRunnerTest.class, AbstractTestMethodRunnerTest.class,
- AssertTest.class, AnnotationFilterTest.class,
- ConcurrentExceptionTest.class, ConcurrentRunnerTest.class,
- ExecutorPoolTest.class, JUnitAnnotationConventionTest.class,
- LoggerUtilTest.class, MemoryWatcherTest.class,
- CustomWatcherTest.class, NameConventionFilterTest.class,
- ReflectionUtilTest.class, StreamLoggerTest.class,
- SoloRunnerExtensionTest.class, SoloRunnerTest.class,
- TestMethodBuilderTest.class, TestSuiteBuilderTest.class,
- TimeWatcherTest.class };
- }
+ public static final Class[] testSuite() {
+ return new Class[] {
+ AbstractRunnerTest.class,
+ AssertTest.class,
+ ConcurrentExceptionTest.class,
+ ExecutorPoolTest.class,
+ LoggerUtilTest.class,
+ MemoryWatcherTest.class,
+ CustomWatcherTest.class,
+ ReflectionUtilTest.class,
+ StreamLoggerTest.class,
+ TestMethodBuilderTest.class,
+ TimeWatcherTest.class
+ };
+ }
}
Modified: trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/all/PUnitAllTests.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -9,7 +9,7 @@
new SoloRunner().run(PUnitAllTests.class);
}
- public Class<?>[] testSuite() {
+ public Class[] testSuite() {
return AllTests.testSuite();
}
Deleted: trunk/punit.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,102 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package tests.api.org.punit.runner;
-
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.punit.convention.AnnotationConvention;
-import org.punit.runner.ConcurrentRunner;
-import org.punit.runner.SoloRunner;
-
-import tests.api.org.punit.testclasses.AnnotationTestClass;
-import tests.api.org.punit.testclasses.ConcurrentParameterizedTestClass;
-import tests.api.org.punit.testclasses.ConcurrentTestClass;
-import tests.api.org.punit.testclasses.LoopTestClass;
-import tests.api.org.punit.testclasses.TestClass0;
-import tests.api.org.punit.testclasses.TestClass3;
-import tests.api.org.punit.testclasses.TestSuiteClass;
-import tests.util.TestUtil;
-
-public class ConcurrentRunnerTest extends TestCase {
-
- private ConcurrentRunner _runner = new ConcurrentRunner();
-
- public static void main(String[] args) {
- new SoloRunner().run(ConcurrentRunnerTest.class);
- }
-
- public void testMain() {
- ConcurrentRunner.main(new String[] { TestSuiteClass.class.getName() });
- }
-
- public void testRun() {
- _runner.run(TestSuiteClass.class);
- }
-
- public void testRunLoopTest() {
- LoopTestClass.reset();
- _runner.run(LoopTestClass.class);
- LoopTestClass.assertTestClassRun();
- }
-
- public void testRunConcurrent() {
- ConcurrentTestClass.reset();
- _runner.run(ConcurrentTestClass.class);
- assertConcurrentTestClassRun();
- }
-
- public void testRunTest() {
- TestClass0.reset();
- _runner.run(TestClass0.class);
- TestClass0.assertTestClassRun();
- }
-
- public void testRunAnnotationTest() {
- AnnotationTestClass.reset();
- _runner.setConvention(new AnnotationConvention());
- _runner.run(AnnotationTestClass.class);
- AnnotationTestClass.assertTestClassRun();
- }
-
- public void testRunPUnitTest() {
- TestClass3.reset();
- _runner.run(TestClass3.class);
- TestClass3.assertTestClassRun();
- }
-
- public void testRunParameterized() throws Exception {
- ConcurrentParameterizedTestClass.reset();
- _runner.run(ConcurrentParameterizedTestClass.class);
- ConcurrentParameterizedTestClass.assertTestClassRun();
- }
-
- public void testRunTestSuite() {
- ConcurrentTestClass.reset();
- TestClass0.reset();
- TestClass3.reset();
- _runner.run(TestSuiteClass.class);
- assertConcurrentTestClassRun();
- TestClass0.assertTestClassRun();
- TestClass3.assertTestClassRun();
- }
-
- @SuppressWarnings("unchecked")
- public void testSerializable() throws Exception {
- _runner.addEventListener(new MockEventListener());
- List expectedListeners = _runner.eventListeners();
- ConcurrentRunner runner = (ConcurrentRunner) TestUtil
- .getSerialiableObject(_runner);
- List eventListeners = runner.eventListeners();
- assertEquals(expectedListeners.size(), eventListeners.size());
- }
-
- private void assertConcurrentTestClassRun() {
- ConcurrentTestClass test = new ConcurrentTestClass();
- assertEquals(test.concurrentCount(), ConcurrentTestClass.value);
- assertTrue(ConcurrentTestClass._assertCheck1);
- assertTrue(ConcurrentTestClass._assertCheck2);
- }
-
-}
Modified: trunk/punit.test/src/tests/api/org/punit/runner/MockEventListener.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/runner/MockEventListener.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/runner/MockEventListener.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -27,12 +27,10 @@
public boolean _onSuiteEnd;
public boolean _onSuiteStart;
- @SuppressWarnings("unchecked")
public void onRunnerEnd(Class clazz, Runner runner) {
_onRunnerEnd = true;
}
- @SuppressWarnings("unchecked")
public void onRunnerStart(Class clazz, Runner runner) {
_onRunnerStart = true;
}
@@ -45,7 +43,6 @@
_onClassEnd = true;
}
- @SuppressWarnings("unchecked")
public void onMethodEnd(Method method, Object testInstance, Object[] params, Throwable t, List watchers) {
_onMethodEnd = true;
}
@@ -62,12 +59,10 @@
_onWatcherStart = true;
}
- @SuppressWarnings("unchecked")
public void onWatchersEnd(List watchers) {
_onWatchersEnd = true;
}
- @SuppressWarnings("unchecked")
public void onWatchersStart(List watchers) {
_onWatchersStart = true;
}
Deleted: trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,132 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package tests.api.org.punit.runner;
-
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import org.punit.convention.AnnotationConvention;
-import org.punit.events.EventListener;
-import org.punit.listener.FieldSetter;
-import org.punit.method.runner.MethodRunner;
-import org.punit.runner.SoloRunner;
-import org.punit.watcher.CustomWatcher;
-
-import tests.api.org.punit.testclasses.AnnotationTestClass;
-import tests.api.org.punit.testclasses.ConcurrentTestClass;
-import tests.api.org.punit.testclasses.LoopTestClass;
-import tests.api.org.punit.testclasses.ParameterizedTestClass;
-import tests.api.org.punit.testclasses.SetResultTestClass;
-import tests.api.org.punit.testclasses.TestClass0;
-import tests.api.org.punit.testclasses.TestClass3;
-import tests.api.org.punit.testclasses.TestSuiteClass;
-import tests.util.TestUtil;
-
-public class SoloRunnerTest extends AbstractRunnerTest {
-
- private SoloRunner _runner;
-
- protected void setUp() throws Exception {
- _runner = new SoloRunner();
- _eventListener = new MockEventListener();
- _runner.addEventListener(_eventListener);
- }
-
- public void testMain() {
- SoloRunner.main(new String[] { TestSuiteClass.class.getName() });
- }
-
- public void testRun() {
- _runner.run(TestSuiteClass.class);
- }
-
- public void testRunTest() {
- TestClass0.reset();
- _runner.run(TestClass0.class);
- TestClass0.assertTestClassRun();
- _eventListener.assertAllEventsInvoked();
- }
-
- public void testRunLoopTest() {
- LoopTestClass.reset();
- _runner.run(LoopTestClass.class);
- LoopTestClass.assertTestClassRun();
- _eventListener.assertAllEventsInvoked();
- }
-
- public void testRunSetResultTest() {
- MethodRunner methodRunner = _runner.methodRunner();
- CustomWatcher watcher = new CustomWatcher(methodRunner,
- SetResultTestClass.SUPPORTED_THREADS,
- SetResultTestClass.THREAD_UNITS);
- _runner.run(SetResultTestClass.class);
- methodRunner.removeWatcher(watcher);
- }
-
- public void testFieldSetter() {
- Properties properties = new Properties();
- // 12 + 18 = ParameterizedTestClass.SUM
- properties.put("VALUE1", "12"); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("VALUE2", "18"); //$NON-NLS-1$ //$NON-NLS-2$
- EventListener listener = new FieldSetter(properties);
- _runner.addEventListener(listener);
- _runner.run(ParameterizedTestClass.class);
- _runner.removeEventListener(listener);
- }
-
- public void testRunAnnotationTest() {
- AnnotationTestClass.reset();
- _runner.setConvention(new AnnotationConvention());
- _runner.run(AnnotationTestClass.class);
- AnnotationTestClass.assertTestClassRun();
- }
-
- public void testRunPUnitTest() {
- TestClass3.reset();
- _runner.run(TestClass3.class);
- TestClass3.assertTestClassRun();
- _eventListener.assertAllEventsInvoked();
- }
-
- public void testRunConcurrent() {
- ConcurrentTestClass.reset();
- _runner.run(ConcurrentTestClass.class);
- assertConcurrentTestClassRun();
- _eventListener.assertAllEventsInvoked();
- }
-
- public void testRunParameterized() throws Exception {
- ParameterizedTestClass.reset();
- _runner.run(ParameterizedTestClass.class);
- ParameterizedTestClass.assertTestClassRun();
- }
-
- public void testRunTestSuite() {
- TestClass0.reset();
- TestClass3.reset();
- _runner.run(TestSuiteClass.class);
- TestClass0.assertTestClassRun();
-
- TestClass3.reset();
- _runner.run(TestClass3.class);
- TestClass3.assertTestClassRun();
-
- _eventListener.assertAllEventsInvoked();
- Assert.assertTrue(_eventListener._onSuiteEnd);
- Assert.assertTrue(_eventListener._onSuiteStart);
- }
-
- public void testSerializable() throws Exception {
- _runner.addEventListener(new MockEventListener());
- int expectedListenersSize = _runner.eventListeners().size();
- SoloRunner runner = (SoloRunner) TestUtil.getSerialiableObject(_runner);
- int eventListenersSize = runner.eventListeners().size();
- assertEquals(expectedListenersSize, eventListenersSize);
- }
-
- private void assertConcurrentTestClassRun() {
- assertEquals(1, ConcurrentTestClass.value);
- }
-
-}
Deleted: trunk/punit.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,130 +0,0 @@
-package tests.api.org.punit.testclasses;
-
-import junit.framework.*;
-
-import org.punit.annotation.*;
-import org.punit.annotation.Test;
-import org.punit.convention.*;
-import org.punit.runner.*;
-
-@Test(concurrentCount=5)
-public class AnnotationTestClass {
-
- public static void main(String[] args) {
- SoloRunner soloRunner = new SoloRunner();
- soloRunner.setConvention(new AnnotationConvention());
- soloRunner.run(AnnotationTestClass.class);
- }
-
- public static boolean _test1;
-
- public static boolean _test2;
-
- public static boolean _check1;
-
- public static boolean _check2;
-
- public static boolean _check22;
-
- public static boolean _testException;
-
- public static boolean _setUp;
-
- public static boolean _tearDown;
-
- public static boolean _beforeClass;
-
- public static boolean _afterClass;
-
- public static void reset() {
- _test1 = false;
- _test2 = false;
- _check1 = false;
- _check2 = false;
- _check22 = false;
- _testException = false;
- _setUp = false;
- _tearDown = false;
- _beforeClass = false;
- _afterClass = false;
- }
-
- @SuppressWarnings("unused")
- @BeforeClass
- private static void beforeClassMethod() {
- _beforeClass = true;
- }
-
- @SuppressWarnings("unused")
- @AfterClass
- private static void afterClassMethod() {
- _afterClass = true;
- }
-
- @SuppressWarnings("unused")
- @Before
- private void before() {
- _setUp = true;
- }
-
- @SuppressWarnings("unused")
- @After
- private void after() {
- _tearDown = true;
- }
-
- public void _test1() {
-
- }
-
- public void test1() {
- _test1 = true;
- }
-
- @Test(checkMethod="annotation_check_2", concurrentCount=6, expected=NullPointerException.class)
- public void _test2() {
- _test2 = true;
- throw new NullPointerException();
- }
-
- public void check_test1() {
- _check1 = true;
- }
-
- public void annotation_check_2() {
- _check2 = true;
- }
-
- public void check_test2() {
- _check22 = true;
- }
-
- @Test
- public void _test3() {
-
- }
-
- public void check__test3() {
-
- }
-
- @Test(expected = NullPointerException.class)
- public void _testException() {
- _testException = true;
- throw new NullPointerException();
- }
-
- public static void assertTestClassRun() {
- Assert.assertTrue(_test1);
- Assert.assertTrue(_check1);
-
- Assert.assertTrue(_test2);
- Assert.assertTrue(_check2);
- Assert.assertFalse(_check22);
-
- Assert.assertTrue(_testException);
-
- Assert.assertTrue(_setUp);
- Assert.assertTrue(_tearDown);
- }
-}
Deleted: trunk/punit.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,54 +0,0 @@
-package tests.api.org.punit.testclasses;
-
-import org.punit.annotation.Ignore;
-import org.punit.type.Parameter;
-
-import tests.util.TestUtil;
-
-@Ignore
-public class ExcludedTestClass1 {
- public void test1() {
- TestUtil.doSomething();
- }
-
- public void test1i(int i) {
- TestUtil.doSomething();
- }
-
- public void test2() {
- TestUtil.doSomething();
- }
-
- public void testa() {
- TestUtil.doSomething();
- }
-
- public void testb() {
- TestUtil.doSomething();
- }
-
- public void _testc() {
- TestUtil.doSomething();
- }
-
- void testd() {
- TestUtil.doSomething();
- }
-
- @SuppressWarnings("unused")
- private void teste() {
- TestUtil.doSomething();
- }
-
- public static void testf() {
- TestUtil.doSomething();
- }
-
- public void testParam(Parameter p) {
- TestUtil.doSomething();
- }
-
- public void testParamI(Parameter p, int i) {
- TestUtil.doSomething();
- }
-}
\ No newline at end of file
Deleted: trunk/punit.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,137 +0,0 @@
-package tests.api.org.punit.testclasses;
-
-import org.junit.*;
-import org.punit.convention.*;
-import org.punit.runner.*;
-
-public class JUnitAnnotationTestClass {
-
- public static void main(String[] args) {
- SoloRunner soloRunner = new SoloRunner();
- soloRunner.setConvention(new AnnotationConvention());
- soloRunner.run(JUnitAnnotationTestClass.class);
- }
-
- public static boolean _test1;
-
- public static boolean _test2;
-
- public static boolean _test3;
-
- public static boolean _test4;
-
- public static boolean _check1;
-
- public static boolean _check2;
-
- public static boolean _check22;
-
- public static boolean _testException;
-
- public static boolean _setUp;
-
- public static boolean _tearDown;
-
- public static boolean _beforeClass;
-
- public static boolean _afterClass;
-
- public static void reset() {
- _test1 = false;
- _test2 = false;
- _test3 = false;
- _check1 = false;
- _check2 = false;
- _check22 = false;
- _testException = false;
- _setUp = false;
- _tearDown = false;
- _beforeClass = false;
- _afterClass = false;
- }
-
- @BeforeClass
- public static void beforeClassMethod() {
- _beforeClass = true;
- }
-
- @AfterClass
- public static void afterClassMethod() {
- _afterClass = true;
- }
-
- @Before
- public void before() {
- _setUp = true;
- }
-
- @After
- public void after() {
- _tearDown = true;
- }
-
- public void _test1() {
-
- }
-
- public void test1() {
- _test1 = true;
- }
-
- @Test(expected=NullPointerException.class)
- public void _test2() {
- _test2 = true;
- throw new NullPointerException();
- }
-
- public void check_test1() {
- _check1 = true;
- }
-
- public void annotation_check_2() {
- _check2 = true;
- }
-
- public void check_test2() {
- _check22 = true;
- }
-
- @Test
- public void _test3() {
- _test3 = true;
- }
-
- public void check__test3() {
-
- }
-
- @Test
- @Ignore
- public void test4() {
- _test4 = true;
- }
-
- @Test(expected = NullPointerException.class)
- public void _testException() {
- _testException = true;
- throw new NullPointerException();
- }
-
- public static void assertTestClassRun() {
- Assert.assertTrue(_test1);
- Assert.assertTrue(_check1);
-
- Assert.assertTrue(_test2);
- Assert.assertTrue(_check2);
- Assert.assertFalse(_check22);
-
- Assert.assertTrue(_test3);
-
- Assert.assertFalse(_test4);
-
- Assert.assertTrue(_testException);
-
- Assert.assertTrue(_setUp);
- Assert.assertTrue(_tearDown);
- }
-}
Deleted: trunk/punit.test/src/tests/api/org/punit/testclasses/LoopTestClass.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/LoopTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/LoopTestClass.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,61 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package tests.api.org.punit.testclasses;
-
-import junit.framework.Assert;
-
-import org.punit.runner.SoloRunner;
-import org.punit.type.Loop;
-
-public class LoopTestClass implements Loop {
-
- public static final long TIMEOUT = 100;
-
- public static void main(String[] args) {
- new SoloRunner().run(LoopTestClass.class);
- }
-
- public static int _test1;
-
- public static int _test2;
-
- public static int _setUp;
-
- public static int _tearDown;
-
- public static void reset() {
- _test1 = 0;
- _test2 = 0;
- _setUp = 0;
- _tearDown = 0;
- }
-
- @SuppressWarnings("unused")
- private void setUp() {
- _setUp++;
- }
-
- @SuppressWarnings("unused")
- private void tearDown() {
- _tearDown++;
- }
-
- public void test1() {
- _test1++;
- }
-
- public void test2() {
- _test2++;
- }
-
- public static void assertTestClassRun() {
- Assert.assertTrue(_test1 > 2);
- Assert.assertTrue(_test2 > 2);
- Assert.assertEquals(2, _setUp);
- Assert.assertEquals(2, _tearDown);
- }
-
- public long toWork() {
- return TIMEOUT;
- }
-}
Deleted: trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,72 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package tests.api.org.punit.testclasses;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.punit.runner.SoloRunner;
-import org.punit.type.Loop;
-import org.punit.watcher.CustomWatcher;
-
-public class SetResultTestClass implements Runnable, Loop {
-
- public static final long TIMEOUT = 500;
-
- public static final String SUPPORTED_THREADS = "Supported Number of Threads"; //$NON-NLS-1$
-
- public static final String THREAD_UNITS = " threads"; //$NON-NLS-1$
-
- private boolean _stop;
-
- private List<Thread> _threads = new ArrayList<Thread>();
-
- public static void main(String[] args) {
- new SoloRunner().run(SetResultTestClass.class);
- }
-
- @SuppressWarnings("unused")
- public void setUp() {
- _stop = false;
- }
-
- @SuppressWarnings("unused")
- public void tearDown() {
- _stop = true;
-
- synchronized (this) {
- this.notifyAll();
- }
-
- for (Thread t : _threads) {
- try {
- t.join();
- } catch (InterruptedException ie) {
- }
- }
- }
-
- public void testThreads() {
- Thread t = new Thread(this);
- _threads.add(t);
- t.start();
- CustomWatcher.setResult(SUPPORTED_THREADS, _threads.size());
- }
-
- public void run() {
- waitForTearDown();
- }
-
- private synchronized void waitForTearDown() {
- while (!_stop) {
- try {
- this.wait();
- } catch (InterruptedException ie) {
- }
- }
- }
-
- public long toWork() {
- return TIMEOUT;
- }
-}
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass0.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass0.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass0.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -5,62 +5,57 @@
import org.punit.assertion.Assert;
public class TestClass0 {
- public static boolean _test1;
+ public static boolean _test1;
- public static boolean _test2;
+ public static boolean _test2;
- public static boolean _setUp;
-
- public static boolean _tearDown;
-
- private static boolean _beforeClass;
-
- private static boolean _afterClass;
-
- public static void reset() {
- _test1 = false;
- _test2 = false;
- _setUp = false;
- _tearDown = false;
- _beforeClass = false;
- _afterClass = false;
- }
+ public static boolean _setUp;
- @SuppressWarnings("unused")
- private static void beforeClass() {
- _beforeClass = true;
- }
-
- @SuppressWarnings("unused")
- private static void afterClass() {
- _afterClass = true;
- }
-
- @SuppressWarnings("unused")
- private void setUp() {
- _setUp = true;
- }
-
- @SuppressWarnings("unused")
- private void tearDown() {
- _tearDown = true;
- }
+ public static boolean _tearDown;
- @SuppressWarnings("unused")
- private void test1() {
- _test1 = true;
- }
+ private static boolean _beforeClass;
- public void test2() {
- _test2 = true;
- }
-
- public static void assertTestClassRun() {
- Assert.assertFalse(_test1);
- Assert.assertTrue(_test2);
- Assert.assertTrue(_setUp);
- Assert.assertTrue(_tearDown);
- Assert.assertTrue(_beforeClass);
- Assert.assertTrue(_afterClass);
- }
+ private static boolean _afterClass;
+
+ public static void reset() {
+ _test1 = false;
+ _test2 = false;
+ _setUp = false;
+ _tearDown = false;
+ _beforeClass = false;
+ _afterClass = false;
+ }
+
+ private static void beforeClass() {
+ _beforeClass = true;
+ }
+
+ private static void afterClass() {
+ _afterClass = true;
+ }
+
+ private void setUp() {
+ _setUp = true;
+ }
+
+ private void tearDown() {
+ _tearDown = true;
+ }
+
+ private void test1() {
+ _test1 = true;
+ }
+
+ public void test2() {
+ _test2 = true;
+ }
+
+ public static void assertTestClassRun() {
+ Assert.assertFalse(_test1);
+ Assert.assertTrue(_test2);
+ Assert.assertTrue(_setUp);
+ Assert.assertTrue(_tearDown);
+ Assert.assertTrue(_beforeClass);
+ Assert.assertTrue(_afterClass);
+ }
}
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass1.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass1.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass1.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -33,7 +33,6 @@
TestUtil.doSomething();
}
- @SuppressWarnings("unused")
private void teste() {
TestUtil.doSomething();
}
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass3.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass3.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestClass3.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -34,17 +34,14 @@
}
- @SuppressWarnings("unused")
private void setUp() {
_setUp = true;
}
- @SuppressWarnings("unused")
private void tearDown() {
_tearDown = true;
}
- @SuppressWarnings("unused")
private void test1() {
_test1 = true;
TestUtil.doSomething();
Deleted: trunk/punit.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,14 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package tests.api.org.punit.testclasses;
-
-import org.punit.annotation.*;
-
-public class TestInterfaceImpl1 implements TestInterface1 {
-
- @Test
- public void method1() {
- throw new UnsupportedOperationException();
- }
-
-}
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite1.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite1.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite1.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,8 +1,10 @@
package tests.api.org.punit.testclasses;
public class TestSuite1 implements org.punit.type.TestSuite {
- public Class<?>[] testSuite() {
- return new Class[] { TestClass1.class, TestClass2.class,
+ public Class[] testSuite() {
+ return new Class[] {
+ TestClass1.class,
+ TestClass2.class,
AlphabeticalTestClass.class
};
}
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite2.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite2.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuite2.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -1,9 +1,11 @@
package tests.api.org.punit.testclasses;
public class TestSuite2 implements org.punit.type.TestSuite {
- public Class<?>[] testSuite() {
- return new Class[] { ExcludedTestClass1.class, TestClass4.class,
- TestSuite1.class, TestClass5.class
+ public Class[] testSuite() {
+ return new Class[] {
+ TestClass4.class,
+ TestSuite1.class,
+ TestClass5.class
};
}
}
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuiteClass.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuiteClass.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/TestSuiteClass.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -4,11 +4,16 @@
public class TestSuiteClass implements TestSuite {
- public Class<?>[] testSuite() {
- return new Class[] { TestClass0.class, TestClass3.class,
+ public Class[] testSuite() {
+ return new Class[] {
+ TestClass0.class,
+ TestClass3.class,
ConcurrentTestClass.class,
- ConcurrentParameterizedTestClass.class, JUnitTestClass.class,
- ParameterizedTestClass.class, TestClass3.class,
- TestClass1.class, };
+ ConcurrentParameterizedTestClass.class,
+ JUnitTestClass.class,
+ ParameterizedTestClass.class,
+ TestClass3.class,
+ TestClass1.class,
+ };
}
}
Modified: trunk/punit.test/src/tests/api/org/punit/util/ReflectionUtilTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/util/ReflectionUtilTest.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/util/ReflectionUtilTest.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -13,7 +13,7 @@
public class ReflectionUtilTest extends TestCase {
public void testNewClass() {
- Class<?> clazz = ReflectionUtil.newClass(Test1.class.getName());
+ Class clazz = ReflectionUtil.newClass(Test1.class.getName());
assertSame(Test1.class, clazz);
AssertUtil.assertException(ReflectionException.class, new CodeRunner() {
public void run() throws Throwable {
@@ -110,7 +110,6 @@
void test2() {
}
- @SuppressWarnings("unused")
private void test3() {
}
@@ -120,7 +119,6 @@
static void test5_static() {
}
- @SuppressWarnings("unused")
private static void test6_static() {
}
}
@@ -128,12 +126,10 @@
private static class Test1 {
public int value = 0;
- @SuppressWarnings("unused")
private void test1() {
value = 10;
}
- @SuppressWarnings("unused")
private void test2(int i) {
value = i;
}
Modified: trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -44,7 +44,7 @@
void allocateAll() {
int size = Integer.MAX_VALUE;
- List<byte[]> list = new ArrayList<byte[]>(CAPACITY);
+ List list = new ArrayList(CAPACITY);
long allocated = MemoryUtil.usedMemory();
// decrease the chunk size
Modified: trunk/punit.test/src/tests/util/AssertUtil.java
===================================================================
--- trunk/punit.test/src/tests/util/AssertUtil.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/util/AssertUtil.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -41,8 +41,7 @@
Assert.assertTrue(isInArray(o, array));
}
- public static void assertException(Class<? extends Throwable> throwable,
- CodeRunner code) {
+ public static void assertException(Class throwable, CodeRunner code) {
try {
code.run();
Assert.fail(throwable + " expected!"); //$NON-NLS-1$
Modified: trunk/punit.test/src/tests/util/TestUtil.java
===================================================================
--- trunk/punit.test/src/tests/util/TestUtil.java 2007-11-19 03:38:34 UTC (rev 242)
+++ trunk/punit.test/src/tests/util/TestUtil.java 2007-11-19 03:40:54 UTC (rev 243)
@@ -99,7 +99,6 @@
return sb.toString();
}
- @SuppressWarnings("unchecked")
public static void runVMs(Class clazz, EventListener[] listeners) {
runUnitTest = false;
final String THIS_VM = getVmLaunchString();
@@ -108,8 +107,8 @@
VM vm = new VM(THIS_VM, "VM"); //$NON-NLS-1$
VM vm_noverify = new VM(THIS_VM + NO_VERIFY, "VM_NOVERIFY"); //$NON-NLS-1$
SoloRunner runner = new SoloRunner();
- for (EventListener e : listeners) {
- runner.addEventListener(e);
+ for(int i = 0; i < listeners.length; ++i) {
+ runner.addEventListener(listeners[i]);
}
runner.runVMs(clazz, new VM[] { vm, vm_noverify });
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:38:29
|
Revision: 242
http://p-unit.svn.sourceforge.net/p-unit/?rev=242&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:38:34 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Share project 'punit.extension.test' into 'https://p-unit.svn.sourceforge.net/svnroot/p-unit'
Added Paths:
-----------
trunk/punit.extension.test/.classpath
trunk/punit.extension.test/.project
trunk/punit.extension.test/.settings/
trunk/punit.extension.test/.settings/org.eclipse.jdt.core.prefs
trunk/punit.extension.test/result/
trunk/punit.extension.test/src/
trunk/punit.extension.test/src/tests/
trunk/punit.extension.test/src/tests/api/
trunk/punit.extension.test/src/tests/api/org/
trunk/punit.extension.test/src/tests/api/org/punit/
trunk/punit.extension.test/src/tests/api/org/punit/all/
trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java
trunk/punit.extension.test/src/tests/api/org/punit/all/PUnitAllTests.java
trunk/punit.extension.test/src/tests/api/org/punit/convention/
trunk/punit.extension.test/src/tests/api/org/punit/convention/AnnotationFilterTest.java
trunk/punit.extension.test/src/tests/api/org/punit/convention/JUnitAnnotationConventionTest.java
trunk/punit.extension.test/src/tests/api/org/punit/convention/NameConventionFilterTest.java
trunk/punit.extension.test/src/tests/api/org/punit/method/
trunk/punit.extension.test/src/tests/api/org/punit/method/runner/
trunk/punit.extension.test/src/tests/api/org/punit/method/runner/AbstractTestMethodRunnerTest.java
trunk/punit.extension.test/src/tests/api/org/punit/reporter/
trunk/punit.extension.test/src/tests/api/org/punit/reporter/chart/
trunk/punit.extension.test/src/tests/api/org/punit/reporter/chart/AbstractChartReporterTest.java
trunk/punit.extension.test/src/tests/api/org/punit/runner/
trunk/punit.extension.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java
trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerExtensionTest.java
trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
trunk/punit.extension.test/src/tests/api/org/punit/suite/
trunk/punit.extension.test/src/tests/api/org/punit/suite/builder/
trunk/punit.extension.test/src/tests/api/org/punit/suite/builder/TestSuiteBuilderTest.java
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/LoopTestClass.java
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
trunk/punit.extension.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java
Added: trunk/punit.extension.test/.classpath
===================================================================
--- trunk/punit.extension.test/.classpath (rev 0)
+++ trunk/punit.extension.test/.classpath 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/punit"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/punit.extension"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/punit.test"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/punit.extension.test/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/.project
===================================================================
--- trunk/punit.extension.test/.project (rev 0)
+++ trunk/punit.extension.test/.project 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>punit.extension.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/punit.extension.test/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/punit.extension.test/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/punit.extension.test/.settings/org.eclipse.jdt.core.prefs 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,12 @@
+#Mon Nov 19 00:43:45 CST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on: trunk/punit.extension.test/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,42 @@
+package tests.api.org.punit.all;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import tests.api.org.punit.convention.AnnotationFilterTest;
+import tests.api.org.punit.convention.JUnitAnnotationConventionTest;
+import tests.api.org.punit.convention.NameConventionFilterTest;
+import tests.api.org.punit.method.runner.AbstractTestMethodRunnerTest;
+import tests.api.org.punit.reporter.chart.AbstractChartReporterTest;
+import tests.api.org.punit.runner.ConcurrentRunnerTest;
+import tests.api.org.punit.runner.SoloRunnerExtensionTest;
+import tests.api.org.punit.runner.SoloRunnerTest;
+import tests.api.org.punit.suite.builder.TestSuiteBuilderTest;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for tests.api.org.punit"); //$NON-NLS-1$
+ // $JUnit-BEGIN$
+ Class<? extends TestCase>[] tests = testSuite();
+ for (int i = 0; i < tests.length; ++i) {
+ suite.addTestSuite(tests[i]);
+ }
+ // $JUnit-END$
+ return suite;
+ }
+
+ public static final Class<? extends TestCase>[] testSuite() {
+ return new Class[] {
+ AbstractChartReporterTest.class,
+ AbstractTestMethodRunnerTest.class,
+ AnnotationFilterTest.class,
+ ConcurrentRunnerTest.class,
+ JUnitAnnotationConventionTest.class,
+ NameConventionFilterTest.class,
+ SoloRunnerExtensionTest.class,
+ SoloRunnerTest.class,
+ TestSuiteBuilderTest.class,
+ };
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/all/AllTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/all/PUnitAllTests.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/all/PUnitAllTests.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/all/PUnitAllTests.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,16 @@
+package tests.api.org.punit.all;
+
+import org.punit.runner.*;
+import org.punit.type.*;
+
+public class PUnitAllTests implements TestSuite {
+
+ public static void main(String[] args) {
+ new SoloRunner().run(PUnitAllTests.class);
+ }
+
+ public Class[] testSuite() {
+ return AllTests.testSuite();
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/all/PUnitAllTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/convention/AnnotationFilterTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/convention/AnnotationFilterTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/convention/AnnotationFilterTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,120 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.convention;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.punit.annotation.Ignore;
+import org.punit.convention.AnnotationConvention;
+import org.punit.util.ReflectionUtil;
+
+import tests.api.org.punit.testclasses.AnnotationTestClass;
+import tests.api.org.punit.testclasses.ConcurrentTestClass;
+import tests.api.org.punit.testclasses.TestClass0;
+import tests.api.org.punit.testclasses.TestClass1;
+
+public class AnnotationFilterTest extends TestCase {
+ AnnotationConvention _filter = new AnnotationConvention();
+
+ public void testIsExcluded() {
+ assertTrue(_filter.isExcluded(ExcludedClass.class));
+ assertFalse(_filter.isExcluded(NonExcludedClass.class));
+ assertFalse(_filter.isExcluded(AnnotationTestClass.class));
+ }
+
+ public void testIsTestMethod() {
+ Method method;
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test1", new Class[] {}); //$NON-NLS-1$
+ assertFalse(_filter.isTestMethod(method));
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+ }
+
+ public void testGetCheckMethod() {
+ Method method, checkMethod;
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test1", new Class[] {}); //$NON-NLS-1$
+ assertFalse(_filter.isTestMethod(method));
+ checkMethod = _filter.getCheckMethod(method);
+ assertNull(checkMethod);
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+ checkMethod = _filter.getCheckMethod(method);
+ assertEquals("annotation_check_2", checkMethod.getName()); //$NON-NLS-1$
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test3", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+ checkMethod = _filter.getCheckMethod(method);
+ assertEquals("check__test3", checkMethod.getName()); //$NON-NLS-1$
+ }
+
+ public void testGetExpectedException() {
+ Method method;
+ Class exception;
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test1", new Class[] {}); //$NON-NLS-1$
+ exception = _filter.getExpectedException(method);
+ assertNull(exception);
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ exception = _filter.getExpectedException(method);
+ assertSame(NullPointerException.class, exception);
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test3", new Class[] {}); //$NON-NLS-1$
+ exception = _filter.getExpectedException(method);
+ assertNull(exception);
+ }
+
+ public void testGetConcurrentCount1() {
+ Method method = ReflectionUtil.getMethod(ConcurrentTestClass.class, "test1", new Class[] {}); //$NON-NLS-1$
+ ConcurrentTestClass test = new ConcurrentTestClass();
+ int count = _filter.getConcurrentCount(test, method);
+ assertEquals(test.concurrentCount(), count);
+
+ method = ReflectionUtil.getMethod(AnnotationTestClass.class, "test1", new Class[] {}); //$NON-NLS-1$
+ assertEquals(0, _filter.getConcurrentCount(new TestClass0(), method));
+ }
+
+ public void testGetConcurrentCountClass() {
+ Method method = ReflectionUtil.getMethod(AnnotationTestClass.class, "test1", new Class[] {}); //$NON-NLS-1$
+ AnnotationTestClass test = new AnnotationTestClass();
+ int count = _filter.getConcurrentCount(test, method);
+ assertEquals(5, count);
+ }
+
+ public void testGetConcurrentCountMethod() {
+ Method method = ReflectionUtil.getMethod(AnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ int count = _filter.getConcurrentCount(new AnnotationTestClass(), method);
+ assertEquals(6, count);
+ }
+
+ public void testGetSetUpMethod() {
+ assertNotNull(_filter.getSetUpMethod(AnnotationTestClass.class));
+ }
+
+ public void testGetTearDownMethod() {
+ assertNotNull(_filter.getTearDownMethod(AnnotationTestClass.class));
+ }
+
+ public void testGetBeforeClass() {
+ assertNotNull(_filter.getBeforeClassMethod(AnnotationTestClass.class));
+ assertNull(_filter.getBeforeClassMethod(TestClass1.class));
+ }
+
+ public void testGetAfterClass() {
+ assertNotNull(_filter.getAfterClassMethod(AnnotationTestClass.class));
+ assertNull(_filter.getAfterClassMethod(TestClass1.class));
+ }
+
+ @Ignore
+ static class ExcludedClass {
+
+ }
+
+ static class NonExcludedClass {
+
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/convention/AnnotationFilterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/convention/JUnitAnnotationConventionTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/convention/JUnitAnnotationConventionTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/convention/JUnitAnnotationConventionTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,114 @@
+package tests.api.org.punit.convention;
+
+
+import java.lang.reflect.*;
+
+import junit.framework.*;
+
+import org.punit.convention.*;
+import org.punit.util.*;
+
+import tests.api.org.punit.convention.AnnotationFilterTest.*;
+import tests.api.org.punit.testclasses.*;
+
+public class JUnitAnnotationConventionTest extends TestCase {
+ JUnitAnnotationConvention _filter = new JUnitAnnotationConvention();
+
+ public void testIsExcluded() {
+ assertFalse(_filter.isExcluded(ExcludedClass.class));
+ assertFalse(_filter.isExcluded(NonExcludedClass.class));
+ assertFalse(_filter.isExcluded(getClass()));
+ }
+
+ public void testIsTestMethod() {
+ Method method;
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test1", new Class[] {}); //$NON-NLS-1$
+ assertFalse(_filter.isTestMethod(method));
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "test1", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "test4", new Class[] {}); //$NON-NLS-1$
+ assertFalse(_filter.isTestMethod(method));
+ }
+
+ public void testGetCheckMethod() {
+ Method method, checkMethod;
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test1", new Class[] {}); //$NON-NLS-1$
+ assertFalse(_filter.isTestMethod(method));
+ checkMethod = _filter.getCheckMethod(method);
+ assertNull(checkMethod);
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+ checkMethod = _filter.getCheckMethod(method);
+ assertNull(checkMethod);
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test3", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_filter.isTestMethod(method));
+ checkMethod = _filter.getCheckMethod(method);
+ assertEquals("check__test3", checkMethod.getName()); //$NON-NLS-1$
+ }
+
+ public void testGetExpectedException() {
+ Method method;
+ Class<? extends Throwable> exception;
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test1", new Class[] {}); //$NON-NLS-1$
+ exception = _filter.getExpectedException(method);
+ assertNull(exception);
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ exception = _filter.getExpectedException(method);
+ assertSame(NullPointerException.class, exception);
+
+ method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test3", new Class[] {}); //$NON-NLS-1$
+ exception = _filter.getExpectedException(method);
+ assertNull(exception);
+ }
+
+ public void testGetConcurrentCount1() {
+ Method method = ReflectionUtil.getMethod(ConcurrentTestClass.class, "test1", new Class[] {}); //$NON-NLS-1$
+ ConcurrentTestClass test = new ConcurrentTestClass();
+ int count = _filter.getConcurrentCount(test, method);
+ assertEquals(test.concurrentCount(), count);
+
+ method = ReflectionUtil.getMethod(TestClass0.class, "test1", new Class[] {}); //$NON-NLS-1$
+ assertEquals(0, _filter.getConcurrentCount(new TestClass0(), method));
+ }
+
+ public void testGetConcurrentCountClass() {
+ Method method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "test1", new Class[] {}); //$NON-NLS-1$
+ JUnitAnnotationTestClass test = new JUnitAnnotationTestClass();
+ int count = _filter.getConcurrentCount(test, method);
+ assertEquals(0, count);
+ }
+
+ public void testGetConcurrentCountMethod() {
+ Method method = ReflectionUtil.getMethod(JUnitAnnotationTestClass.class, "_test2", new Class[] {}); //$NON-NLS-1$
+ int count = _filter.getConcurrentCount(new JUnitAnnotationTestClass(), method);
+ assertEquals(0, count);
+ }
+
+ public void testGetSetUpMethod() {
+ assertNotNull(_filter.getSetUpMethod(JUnitAnnotationTestClass.class));
+ }
+
+ public void testGetTearDownMethod() {
+ assertNotNull(_filter.getTearDownMethod(JUnitAnnotationTestClass.class));
+ }
+
+ public void testGetBeforeClass() {
+ assertNotNull(_filter.getBeforeClassMethod(JUnitAnnotationTestClass.class));
+ assertNull(_filter.getBeforeClassMethod(TestClass1.class));
+ }
+
+ public void testGetAfterClass() {
+ assertNotNull(_filter.getAfterClassMethod(JUnitAnnotationTestClass.class));
+ assertNull(_filter.getAfterClassMethod(TestClass1.class));
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/convention/JUnitAnnotationConventionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/convention/NameConventionFilterTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/convention/NameConventionFilterTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/convention/NameConventionFilterTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,103 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.convention;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.punit.convention.NameConvention;
+import org.punit.util.ReflectionUtil;
+
+import tests.api.org.punit.testclasses.ConcurrentTestClass;
+import tests.api.org.punit.testclasses.LoopTestClass;
+import tests.api.org.punit.testclasses.TestClass0;
+import tests.api.org.punit.testclasses.TestClass1;
+
+public class NameConventionFilterTest extends TestCase {
+
+ NameConvention _convention = new NameConvention();
+
+ public void testIsTestMethod() {
+ Method method;
+ method = ReflectionUtil.getMethod(getClass(), "test1", new Class[] {}); //$NON-NLS-1$
+ assertTrue(_convention.isTestMethod(method));
+
+ method = ReflectionUtil.getMethod(getClass(), "_test2", new Class[] {}); //$NON-NLS-1$
+ assertFalse(_convention.isTestMethod(method));
+ }
+
+ public void testGetCheckMethod() {
+ Method method, checkMethod;
+ method = ReflectionUtil.getMethod(getClass(), "test1", new Class[] {}); //$NON-NLS-1$
+ checkMethod = _convention.getCheckMethod(method);
+ assertNull(checkMethod);
+
+ method = ReflectionUtil.getMethod(getClass(), "_test2", new Class[] {}); //$NON-NLS-1$
+ checkMethod = _convention.getCheckMethod(method);
+ assertEquals("check__test2", checkMethod.getName()); //$NON-NLS-1$
+ }
+
+ public void testGetConcurrentCount() {
+ Method method = ReflectionUtil.getMethod(getClass(),
+ "test1", new Class[] {}); //$NON-NLS-1$
+ ConcurrentTestClass test = new ConcurrentTestClass();
+ int count = _convention.getConcurrentCount(test, method);
+ assertEquals(test.concurrentCount(), count);
+
+ method = ReflectionUtil.getMethod(getClass(), "test1", new Class[] {}); //$NON-NLS-1$
+ assertEquals(0, _convention
+ .getConcurrentCount(new TestClass0(), method));
+ }
+
+ public void testGetSetUpMethod() {
+ assertNotNull(_convention.getSetUpMethod(TestClass0.class));
+ assertNull(_convention.getSetUpMethod(TestClass1.class));
+ }
+
+ public void testGetTearDownMethod() {
+ assertNotNull(_convention.getTearDownMethod(TestClass0.class));
+ assertNull(_convention.getTearDownMethod(TestClass1.class));
+ }
+
+ public void testGetBeforeClass() {
+ assertNotNull(_convention.getBeforeClassMethod(TestClass0.class));
+ assertNull(_convention.getBeforeClassMethod(TestClass1.class));
+ }
+
+ public void testGetAfterClass() {
+ assertNotNull(_convention.getAfterClassMethod(TestClass0.class));
+ assertNull(_convention.getAfterClassMethod(TestClass1.class));
+ }
+
+ public void testIsLoop() {
+ assertTrue(_convention.isLoopTest(LoopTestClass.class));
+ assertFalse(_convention.isLoopTest(TestClass0.class));
+ }
+
+ public void testGetToWork() {
+ assertEquals(LoopTestClass.TIMEOUT, _convention
+ .toWork(new LoopTestClass()));
+ assertEquals(0, _convention.toWork(new TestClass0()));
+ }
+
+ public void test1() {
+
+ }
+
+ public void _test2() {
+
+ }
+
+ public void check__test2() {
+
+ }
+
+ public void _test3() {
+
+ }
+
+ public void check__test3() {
+
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/convention/NameConventionFilterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/method/runner/AbstractTestMethodRunnerTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/method/runner/AbstractTestMethodRunnerTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/method/runner/AbstractTestMethodRunnerTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,91 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.method.runner;
+
+import java.util.*;
+
+import junit.framework.*;
+import junit.framework.Assert;
+
+import org.punit.assertion.*;
+import org.punit.method.runner.*;
+import org.punit.util.*;
+import org.punit.watcher.*;
+
+import tests.api.org.punit.testclasses.*;
+
+public class AbstractTestMethodRunnerTest extends TestCase {
+ private MockTestMethodRunnerTest _mockRunner = new MockTestMethodRunnerTest();
+
+ public void testWatchers() {
+ List watchers = _mockRunner.watchers();
+ assertEquals(1, watchers.size()); // time, and memory watchers
+
+ _mockRunner.removeTimeWatcher();
+ watchers = _mockRunner.watchers();
+ assertEquals(0, watchers.size());
+
+ _mockRunner.addWatcher(new TimeWatcher());
+ watchers = _mockRunner.watchers();
+ assertEquals(1, watchers.size());
+ }
+
+ public void testRunMethod1() throws Throwable {
+ _mockRunner.testRunMethod1();
+ }
+
+ public void testRunMethod2() throws Throwable {
+ _mockRunner.testRunMethod2();
+ }
+
+ public void testRunMethod3() throws Throwable {
+ _mockRunner.testRunMethod3();
+ }
+
+ static class MockTestMethodRunnerTest extends AbstractMethodRunner {
+
+ private static final long serialVersionUID = 1L;
+
+ public void testRunMethod1() throws Throwable {
+ AnnotationTestClass.reset();
+ this._method = ReflectionUtil.getMethod(AnnotationTestClass.class,
+ "test1", new Class[] {}); //$NON-NLS-1$
+ this._params = new Object[] {};
+ this._testInstance = new AnnotationTestClass();
+ this._expectedException = null;
+ super.runMethod();
+ Assert.assertTrue(AnnotationTestClass._test1);
+ }
+
+ public void testRunMethod2() throws Throwable {
+ AnnotationTestClass.reset();
+ this._method = ReflectionUtil.getMethod(AnnotationTestClass.class,
+ "_testException", new Class[] {}); //$NON-NLS-1$
+ this._params = new Object[] {};
+ this._testInstance = new AnnotationTestClass();
+ this._expectedException = null;
+ org.punit.assertion.Assert.assertException(NullPointerException.class, new CodeRunner(){
+ public void run() throws Throwable {
+ runMethod();
+ }
+ });
+ Assert.assertTrue(AnnotationTestClass._testException);
+ }
+
+ public void testRunMethod3() throws Throwable {
+ AnnotationTestClass.reset();
+ this._method = ReflectionUtil.getMethod(AnnotationTestClass.class,
+ "_testException", new Class[] {}); //$NON-NLS-1$
+ this._params = new Object[] {};
+ this._testInstance = new AnnotationTestClass();
+ this._expectedException = NullPointerException.class;
+ super.runMethod();
+ Assert.assertTrue(AnnotationTestClass._testException);
+ }
+
+ protected void runImpl() throws Throwable {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/method/runner/AbstractTestMethodRunnerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/reporter/chart/AbstractChartReporterTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/reporter/chart/AbstractChartReporterTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/reporter/chart/AbstractChartReporterTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,45 @@
+package tests.api.org.punit.reporter.chart;
+
+import java.util.NoSuchElementException;
+
+import org.punit.assertion.CodeRunner;
+import org.punit.reporter.chart.AbstractChartReporter;
+import org.punit.reporter.chart.DatasetKey;
+import org.punit.type.TestSuite;
+import org.punit.watcher.Watcher;
+
+import tests.api.org.punit.testclasses.TestSuite1;
+import tests.api.org.punit.testclasses.TestSuite2;
+import tests.util.AssertUtil;
+
+public class AbstractChartReporterTest extends junit.framework.TestCase {
+ private MockChartReporter _reporter = new MockChartReporter();
+
+ public void testCurrentSuite() {
+ TestSuite suite1 = new TestSuite1();
+ TestSuite suite2 = new TestSuite2();
+ _reporter.onSuiteStart(suite1);
+ _reporter.onSuiteStart(suite2);
+ assertSame(suite2, _reporter.currentTestSuite());
+ _reporter.onSuiteEnd(suite2);
+ assertSame(suite1, _reporter.currentTestSuite());
+ _reporter.onSuiteEnd(suite1);
+ AssertUtil.assertException(NoSuchElementException.class, new CodeRunner() {
+ public void run() throws Throwable {
+ _reporter.currentTestSuite();
+ }
+ });
+ }
+
+ static class MockChartReporter extends AbstractChartReporter {
+ private static final long serialVersionUID = 1L;
+
+ MockChartReporter() {
+ super(null);
+ }
+
+ protected DatasetKey getKey(Watcher watcher) {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/reporter/chart/AbstractChartReporterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,101 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.runner;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.punit.convention.AnnotationConvention;
+import org.punit.runner.ConcurrentRunner;
+import org.punit.runner.SoloRunner;
+
+import tests.api.org.punit.testclasses.AnnotationTestClass;
+import tests.api.org.punit.testclasses.ConcurrentParameterizedTestClass;
+import tests.api.org.punit.testclasses.ConcurrentTestClass;
+import tests.api.org.punit.testclasses.LoopTestClass;
+import tests.api.org.punit.testclasses.TestClass0;
+import tests.api.org.punit.testclasses.TestClass3;
+import tests.api.org.punit.testclasses.TestSuiteClass;
+import tests.util.TestUtil;
+
+public class ConcurrentRunnerTest extends TestCase {
+
+ private ConcurrentRunner _runner = new ConcurrentRunner();
+
+ public static void main(String[] args) {
+ new SoloRunner().run(ConcurrentRunnerTest.class);
+ }
+
+ public void testMain() {
+ ConcurrentRunner.main(new String[] { TestSuiteClass.class.getName() });
+ }
+
+ public void testRun() {
+ _runner.run(TestSuiteClass.class);
+ }
+
+ public void testRunLoopTest() {
+ LoopTestClass.reset();
+ _runner.run(LoopTestClass.class);
+ LoopTestClass.assertTestClassRun();
+ }
+
+ public void testRunConcurrent() {
+ ConcurrentTestClass.reset();
+ _runner.run(ConcurrentTestClass.class);
+ assertConcurrentTestClassRun();
+ }
+
+ public void testRunTest() {
+ TestClass0.reset();
+ _runner.run(TestClass0.class);
+ TestClass0.assertTestClassRun();
+ }
+
+ public void testRunAnnotationTest() {
+ AnnotationTestClass.reset();
+ _runner.setConvention(new AnnotationConvention());
+ _runner.run(AnnotationTestClass.class);
+ AnnotationTestClass.assertTestClassRun();
+ }
+
+ public void testRunPUnitTest() {
+ TestClass3.reset();
+ _runner.run(TestClass3.class);
+ TestClass3.assertTestClassRun();
+ }
+
+ public void testRunParameterized() throws Exception {
+ ConcurrentParameterizedTestClass.reset();
+ _runner.run(ConcurrentParameterizedTestClass.class);
+ ConcurrentParameterizedTestClass.assertTestClassRun();
+ }
+
+ public void testRunTestSuite() {
+ ConcurrentTestClass.reset();
+ TestClass0.reset();
+ TestClass3.reset();
+ _runner.run(TestSuiteClass.class);
+ assertConcurrentTestClassRun();
+ TestClass0.assertTestClassRun();
+ TestClass3.assertTestClassRun();
+ }
+
+ public void testSerializable() throws Exception {
+ _runner.addEventListener(new MockEventListener());
+ List expectedListeners = _runner.eventListeners();
+ ConcurrentRunner runner = (ConcurrentRunner) TestUtil
+ .getSerialiableObject(_runner);
+ List eventListeners = runner.eventListeners();
+ assertEquals(expectedListeners.size(), eventListeners.size());
+ }
+
+ private void assertConcurrentTestClassRun() {
+ ConcurrentTestClass test = new ConcurrentTestClass();
+ assertEquals(test.concurrentCount(), ConcurrentTestClass.value);
+ assertTrue(ConcurrentTestClass._assertCheck1);
+ assertTrue(ConcurrentTestClass._assertCheck2);
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/runner/ConcurrentRunnerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerExtensionTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerExtensionTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerExtensionTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,30 @@
+package tests.api.org.punit.runner;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.punit.reporter.chart.OverviewReporter;
+import org.punit.reporter.chart.image.ImageRender;
+import org.punit.runner.SoloRunner;
+
+import tests.util.TestUtil;
+
+public class SoloRunnerExtensionTest extends TestCase {
+
+ private SoloRunner _runner;
+
+ protected void setUp() {
+ _runner = new SoloRunner();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testSerializable() throws Exception {
+ _runner.addEventListener(new OverviewReporter(new ImageRender()));
+ List expectedListeners = _runner.eventListeners();
+ SoloRunner runner = (SoloRunner) TestUtil.getSerialiableObject(_runner);
+ List eventListeners = runner.eventListeners();
+ assertEquals(expectedListeners.size(), eventListeners.size());
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerExtensionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,132 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.runner;
+
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.punit.convention.AnnotationConvention;
+import org.punit.events.EventListener;
+import org.punit.listener.FieldSetter;
+import org.punit.method.runner.MethodRunner;
+import org.punit.runner.SoloRunner;
+import org.punit.watcher.CustomWatcher;
+
+import tests.api.org.punit.testclasses.AnnotationTestClass;
+import tests.api.org.punit.testclasses.ConcurrentTestClass;
+import tests.api.org.punit.testclasses.LoopTestClass;
+import tests.api.org.punit.testclasses.ParameterizedTestClass;
+import tests.api.org.punit.testclasses.SetResultTestClass;
+import tests.api.org.punit.testclasses.TestClass0;
+import tests.api.org.punit.testclasses.TestClass3;
+import tests.api.org.punit.testclasses.TestSuiteClass;
+import tests.util.TestUtil;
+
+public class SoloRunnerTest extends AbstractRunnerTest {
+
+ private SoloRunner _runner;
+
+ protected void setUp() throws Exception {
+ _runner = new SoloRunner();
+ _eventListener = new MockEventListener();
+ _runner.addEventListener(_eventListener);
+ }
+
+ public void testMain() {
+ SoloRunner.main(new String[] { TestSuiteClass.class.getName() });
+ }
+
+ public void testRun() {
+ _runner.run(TestSuiteClass.class);
+ }
+
+ public void testRunTest() {
+ TestClass0.reset();
+ _runner.run(TestClass0.class);
+ TestClass0.assertTestClassRun();
+ _eventListener.assertAllEventsInvoked();
+ }
+
+ public void testRunLoopTest() {
+ LoopTestClass.reset();
+ _runner.run(LoopTestClass.class);
+ LoopTestClass.assertTestClassRun();
+ _eventListener.assertAllEventsInvoked();
+ }
+
+ public void testRunSetResultTest() {
+ MethodRunner methodRunner = _runner.methodRunner();
+ CustomWatcher watcher = new CustomWatcher(methodRunner,
+ SetResultTestClass.SUPPORTED_THREADS,
+ SetResultTestClass.THREAD_UNITS);
+ _runner.run(SetResultTestClass.class);
+ methodRunner.removeWatcher(watcher);
+ }
+
+ public void testFieldSetter() {
+ Properties properties = new Properties();
+ // 12 + 18 = ParameterizedTestClass.SUM
+ properties.put("VALUE1", "12"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put("VALUE2", "18"); //$NON-NLS-1$ //$NON-NLS-2$
+ EventListener listener = new FieldSetter(properties);
+ _runner.addEventListener(listener);
+ _runner.run(ParameterizedTestClass.class);
+ _runner.removeEventListener(listener);
+ }
+
+ public void testRunAnnotationTest() {
+ AnnotationTestClass.reset();
+ _runner.setConvention(new AnnotationConvention());
+ _runner.run(AnnotationTestClass.class);
+ AnnotationTestClass.assertTestClassRun();
+ }
+
+ public void testRunPUnitTest() {
+ TestClass3.reset();
+ _runner.run(TestClass3.class);
+ TestClass3.assertTestClassRun();
+ _eventListener.assertAllEventsInvoked();
+ }
+
+ public void testRunConcurrent() {
+ ConcurrentTestClass.reset();
+ _runner.run(ConcurrentTestClass.class);
+ assertConcurrentTestClassRun();
+ _eventListener.assertAllEventsInvoked();
+ }
+
+ public void testRunParameterized() throws Exception {
+ ParameterizedTestClass.reset();
+ _runner.run(ParameterizedTestClass.class);
+ ParameterizedTestClass.assertTestClassRun();
+ }
+
+ public void testRunTestSuite() {
+ TestClass0.reset();
+ TestClass3.reset();
+ _runner.run(TestSuiteClass.class);
+ TestClass0.assertTestClassRun();
+
+ TestClass3.reset();
+ _runner.run(TestClass3.class);
+ TestClass3.assertTestClassRun();
+
+ _eventListener.assertAllEventsInvoked();
+ Assert.assertTrue(_eventListener._onSuiteEnd);
+ Assert.assertTrue(_eventListener._onSuiteStart);
+ }
+
+ public void testSerializable() throws Exception {
+ _runner.addEventListener(new MockEventListener());
+ int expectedListenersSize = _runner.eventListeners().size();
+ SoloRunner runner = (SoloRunner) TestUtil.getSerialiableObject(_runner);
+ int eventListenersSize = runner.eventListeners().size();
+ assertEquals(expectedListenersSize, eventListenersSize);
+ }
+
+ private void assertConcurrentTestClassRun() {
+ assertEquals(1, ConcurrentTestClass.value);
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/suite/builder/TestSuiteBuilderTest.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/suite/builder/TestSuiteBuilderTest.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/suite/builder/TestSuiteBuilderTest.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,107 @@
+package tests.api.org.punit.suite.builder;
+
+import junit.framework.*;
+
+import org.punit.convention.*;
+import org.punit.suite.builder.*;
+
+import tests.api.org.punit.testclasses.*;
+import tests.util.*;
+
+public class TestSuiteBuilderTest extends TestCase {
+ private TestSuiteBuilderImpl _testSuiteBuidler;
+
+ protected void setUp() throws Exception {
+ _testSuiteBuidler = new TestSuiteBuilderImpl();
+ _testSuiteBuidler.setConvention(new NameConvention());
+ }
+
+ public void testBuildExcludedTestClasses1() {
+ _testSuiteBuidler.setConvention(new AnnotationConvention());
+ Object[] classes = _testSuiteBuidler.buildTestClasses(ExcludedTestClass1.class);
+ AssertUtil.assertArray(classes, new Class[] { });
+ }
+
+ public void testBuildTestClasses1() {
+ Object[] classes = _testSuiteBuidler.buildTestClasses(TestClass1.class);
+ AssertUtil.assertArray(classes, new Class[] { TestClass1.class });
+ }
+
+ public void testBuildTestSuite1() {
+ Object[] classes = _testSuiteBuidler.buildTestClasses(TestSuite1.class);
+ Class[] expectedClasses = new Class[] { TestClass1.class,
+ TestClass2.class, AlphabeticalTestClass.class };
+
+ assertEquals(expectedClasses.length + 2, classes.length); // suite labels
+
+ TestSuiteLabel label = (TestSuiteLabel) classes[0];
+ assertSame(TestSuite1.class, label.suite().getClass());
+ assertTrue(label.isStart());
+
+ label = (TestSuiteLabel) classes[classes.length - 1];
+ assertSame(TestSuite1.class, label.suite().getClass());
+ assertFalse(label.isStart());
+
+ AssertUtil.assertArrayContains(classes, expectedClasses);
+ }
+
+ public void testBuildTestSuite2() {
+ Object[] classes = _testSuiteBuidler.buildTestClasses(TestSuite2.class);
+ Class[] expectedClasses = new Class[] {
+ TestClass4.class,
+ TestClass1.class,
+ TestClass2.class,
+ AlphabeticalTestClass.class,
+ TestClass5.class
+ };
+
+ assertEquals(expectedClasses.length + 4, classes.length); // suite labels
+
+ TestSuiteLabel label = (TestSuiteLabel) classes[0];
+ assertSame(TestSuite2.class, label.suite().getClass());
+ assertTrue(label.isStart());
+
+ label = (TestSuiteLabel) classes[classes.length - 1];
+ assertSame(TestSuite2.class, label.suite().getClass());
+ assertFalse(label.isStart());
+
+ label = (TestSuiteLabel) classes[2];
+ assertSame(TestSuite1.class, label.suite().getClass());
+ assertTrue(label.isStart());
+
+ label = (TestSuiteLabel) classes[6];
+ assertSame(TestSuite1.class, label.suite().getClass());
+ assertFalse(label.isStart());
+
+ AssertUtil.assertArrayContains(classes, expectedClasses);
+ }
+
+ public void testBuildTestSuite2ByAnnotationFilter() {
+ _testSuiteBuidler.setConvention(new AnnotationConvention());
+ Object[] classes = _testSuiteBuidler.buildTestClasses(TestSuite2.class);
+ Class[] expectedClasses = new Class[] { TestClass4.class,
+ TestClass1.class, TestClass2.class, AlphabeticalTestClass.class, TestClass5.class };
+
+ assertEquals(expectedClasses.length + 4, classes.length); // suite labels
+
+ TestSuiteLabel label = (TestSuiteLabel) classes[0];
+ assertSame(TestSuite2.class, label.suite().getClass());
+ assertTrue(label.isStart());
+
+ label = (TestSuiteLabel) classes[classes.length - 1];
+ assertSame(TestSuite2.class, label.suite().getClass());
+ assertFalse(label.isStart());
+
+ label = (TestSuiteLabel) classes[2];
+ assertSame(TestSuite1.class, label.suite().getClass());
+ assertTrue(label.isStart());
+
+ label = (TestSuiteLabel) classes[6];
+ assertSame(TestSuite1.class, label.suite().getClass());
+ assertFalse(label.isStart());
+
+ AssertUtil.assertArrayContains(classes, expectedClasses);
+ }
+
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/suite/builder/TestSuiteBuilderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,130 @@
+package tests.api.org.punit.testclasses;
+
+import junit.framework.*;
+
+import org.punit.annotation.*;
+import org.punit.annotation.Test;
+import org.punit.convention.*;
+import org.punit.runner.*;
+
+@Test(concurrentCount=5)
+public class AnnotationTestClass {
+
+ public static void main(String[] args) {
+ SoloRunner soloRunner = new SoloRunner();
+ soloRunner.setConvention(new AnnotationConvention());
+ soloRunner.run(AnnotationTestClass.class);
+ }
+
+ public static boolean _test1;
+
+ public static boolean _test2;
+
+ public static boolean _check1;
+
+ public static boolean _check2;
+
+ public static boolean _check22;
+
+ public static boolean _testException;
+
+ public static boolean _setUp;
+
+ public static boolean _tearDown;
+
+ public static boolean _beforeClass;
+
+ public static boolean _afterClass;
+
+ public static void reset() {
+ _test1 = false;
+ _test2 = false;
+ _check1 = false;
+ _check2 = false;
+ _check22 = false;
+ _testException = false;
+ _setUp = false;
+ _tearDown = false;
+ _beforeClass = false;
+ _afterClass = false;
+ }
+
+ @SuppressWarnings("unused")
+ @BeforeClass
+ private static void beforeClassMethod() {
+ _beforeClass = true;
+ }
+
+ @SuppressWarnings("unused")
+ @AfterClass
+ private static void afterClassMethod() {
+ _afterClass = true;
+ }
+
+ @SuppressWarnings("unused")
+ @Before
+ private void before() {
+ _setUp = true;
+ }
+
+ @SuppressWarnings("unused")
+ @After
+ private void after() {
+ _tearDown = true;
+ }
+
+ public void _test1() {
+
+ }
+
+ public void test1() {
+ _test1 = true;
+ }
+
+ @Test(checkMethod="annotation_check_2", concurrentCount=6, expected=NullPointerException.class)
+ public void _test2() {
+ _test2 = true;
+ throw new NullPointerException();
+ }
+
+ public void check_test1() {
+ _check1 = true;
+ }
+
+ public void annotation_check_2() {
+ _check2 = true;
+ }
+
+ public void check_test2() {
+ _check22 = true;
+ }
+
+ @Test
+ public void _test3() {
+
+ }
+
+ public void check__test3() {
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void _testException() {
+ _testException = true;
+ throw new NullPointerException();
+ }
+
+ public static void assertTestClassRun() {
+ Assert.assertTrue(_test1);
+ Assert.assertTrue(_check1);
+
+ Assert.assertTrue(_test2);
+ Assert.assertTrue(_check2);
+ Assert.assertFalse(_check22);
+
+ Assert.assertTrue(_testException);
+
+ Assert.assertTrue(_setUp);
+ Assert.assertTrue(_tearDown);
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/AnnotationTestClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,54 @@
+package tests.api.org.punit.testclasses;
+
+import org.punit.annotation.Ignore;
+import org.punit.type.Parameter;
+
+import tests.util.TestUtil;
+
+@Ignore
+public class ExcludedTestClass1 {
+ public void test1() {
+ TestUtil.doSomething();
+ }
+
+ public void test1i(int i) {
+ TestUtil.doSomething();
+ }
+
+ public void test2() {
+ TestUtil.doSomething();
+ }
+
+ public void testa() {
+ TestUtil.doSomething();
+ }
+
+ public void testb() {
+ TestUtil.doSomething();
+ }
+
+ public void _testc() {
+ TestUtil.doSomething();
+ }
+
+ void testd() {
+ TestUtil.doSomething();
+ }
+
+ @SuppressWarnings("unused")
+ private void teste() {
+ TestUtil.doSomething();
+ }
+
+ public static void testf() {
+ TestUtil.doSomething();
+ }
+
+ public void testParam(Parameter p) {
+ TestUtil.doSomething();
+ }
+
+ public void testParamI(Parameter p, int i) {
+ TestUtil.doSomething();
+ }
+}
\ No newline at end of file
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/ExcludedTestClass1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,137 @@
+package tests.api.org.punit.testclasses;
+
+import org.junit.*;
+import org.punit.convention.*;
+import org.punit.runner.*;
+
+public class JUnitAnnotationTestClass {
+
+ public static void main(String[] args) {
+ SoloRunner soloRunner = new SoloRunner();
+ soloRunner.setConvention(new AnnotationConvention());
+ soloRunner.run(JUnitAnnotationTestClass.class);
+ }
+
+ public static boolean _test1;
+
+ public static boolean _test2;
+
+ public static boolean _test3;
+
+ public static boolean _test4;
+
+ public static boolean _check1;
+
+ public static boolean _check2;
+
+ public static boolean _check22;
+
+ public static boolean _testException;
+
+ public static boolean _setUp;
+
+ public static boolean _tearDown;
+
+ public static boolean _beforeClass;
+
+ public static boolean _afterClass;
+
+ public static void reset() {
+ _test1 = false;
+ _test2 = false;
+ _test3 = false;
+ _check1 = false;
+ _check2 = false;
+ _check22 = false;
+ _testException = false;
+ _setUp = false;
+ _tearDown = false;
+ _beforeClass = false;
+ _afterClass = false;
+ }
+
+ @BeforeClass
+ public static void beforeClassMethod() {
+ _beforeClass = true;
+ }
+
+ @AfterClass
+ public static void afterClassMethod() {
+ _afterClass = true;
+ }
+
+ @Before
+ public void before() {
+ _setUp = true;
+ }
+
+ @After
+ public void after() {
+ _tearDown = true;
+ }
+
+ public void _test1() {
+
+ }
+
+ public void test1() {
+ _test1 = true;
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void _test2() {
+ _test2 = true;
+ throw new NullPointerException();
+ }
+
+ public void check_test1() {
+ _check1 = true;
+ }
+
+ public void annotation_check_2() {
+ _check2 = true;
+ }
+
+ public void check_test2() {
+ _check22 = true;
+ }
+
+ @Test
+ public void _test3() {
+ _test3 = true;
+ }
+
+ public void check__test3() {
+
+ }
+
+ @Test
+ @Ignore
+ public void test4() {
+ _test4 = true;
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void _testException() {
+ _testException = true;
+ throw new NullPointerException();
+ }
+
+ public static void assertTestClassRun() {
+ Assert.assertTrue(_test1);
+ Assert.assertTrue(_check1);
+
+ Assert.assertTrue(_test2);
+ Assert.assertTrue(_check2);
+ Assert.assertFalse(_check22);
+
+ Assert.assertTrue(_test3);
+
+ Assert.assertFalse(_test4);
+
+ Assert.assertTrue(_testException);
+
+ Assert.assertTrue(_setUp);
+ Assert.assertTrue(_tearDown);
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/JUnitAnnotationTestClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/LoopTestClass.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/testclasses/LoopTestClass.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/testclasses/LoopTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,61 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.testclasses;
+
+import junit.framework.Assert;
+
+import org.punit.runner.SoloRunner;
+import org.punit.type.Loop;
+
+public class LoopTestClass implements Loop {
+
+ public static final long TIMEOUT = 100;
+
+ public static void main(String[] args) {
+ new SoloRunner().run(LoopTestClass.class);
+ }
+
+ public static int _test1;
+
+ public static int _test2;
+
+ public static int _setUp;
+
+ public static int _tearDown;
+
+ public static void reset() {
+ _test1 = 0;
+ _test2 = 0;
+ _setUp = 0;
+ _tearDown = 0;
+ }
+
+ @SuppressWarnings("unused")
+ private void setUp() {
+ _setUp++;
+ }
+
+ @SuppressWarnings("unused")
+ private void tearDown() {
+ _tearDown++;
+ }
+
+ public void test1() {
+ _test1++;
+ }
+
+ public void test2() {
+ _test2++;
+ }
+
+ public static void assertTestClassRun() {
+ Assert.assertTrue(_test1 > 2);
+ Assert.assertTrue(_test2 > 2);
+ Assert.assertEquals(2, _setUp);
+ Assert.assertEquals(2, _tearDown);
+ }
+
+ public long toWork() {
+ return TIMEOUT;
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/LoopTestClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,72 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.testclasses;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.punit.runner.SoloRunner;
+import org.punit.type.Loop;
+import org.punit.watcher.CustomWatcher;
+
+public class SetResultTestClass implements Runnable, Loop {
+
+ public static final long TIMEOUT = 500;
+
+ public static final String SUPPORTED_THREADS = "Supported Number of Threads"; //$NON-NLS-1$
+
+ public static final String THREAD_UNITS = " threads"; //$NON-NLS-1$
+
+ private boolean _stop;
+
+ private List<Thread> _threads = new ArrayList<Thread>();
+
+ public static void main(String[] args) {
+ new SoloRunner().run(SetResultTestClass.class);
+ }
+
+ @SuppressWarnings("unused")
+ public void setUp() {
+ _stop = false;
+ }
+
+ @SuppressWarnings("unused")
+ public void tearDown() {
+ _stop = true;
+
+ synchronized (this) {
+ this.notifyAll();
+ }
+
+ for (Thread t : _threads) {
+ try {
+ t.join();
+ } catch (InterruptedException ie) {
+ }
+ }
+ }
+
+ public void testThreads() {
+ Thread t = new Thread(this);
+ _threads.add(t);
+ t.start();
+ CustomWatcher.setResult(SUPPORTED_THREADS, _threads.size());
+ }
+
+ public void run() {
+ waitForTearDown();
+ }
+
+ private synchronized void waitForTearDown() {
+ while (!_stop) {
+ try {
+ this.wait();
+ } catch (InterruptedException ie) {
+ }
+ }
+ }
+
+ public long toWork() {
+ return TIMEOUT;
+ }
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java
===================================================================
--- trunk/punit.extension.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java (rev 0)
+++ trunk/punit.extension.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java 2007-11-19 03:38:34 UTC (rev 242)
@@ -0,0 +1,14 @@
+/* (C) Copyright 2007, by Andrew Zhang */
+
+package tests.api.org.punit.testclasses;
+
+import org.punit.annotation.*;
+
+public class TestInterfaceImpl1 implements TestInterface1 {
+
+ @Test
+ public void method1() {
+ throw new UnsupportedOperationException();
+ }
+
+}
Property changes on: trunk/punit.extension.test/src/tests/api/org/punit/testclasses/TestInterfaceImpl1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zha...@us...> - 2007-11-19 03:36:21
|
Revision: 241
http://p-unit.svn.sourceforge.net/p-unit/?rev=241&view=rev
Author: zhanghuangzhu
Date: 2007-11-18 19:36:26 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Share project 'punit.extension.test' into 'https://p-unit.svn.sourceforge.net/svnroot/p-unit'
Added Paths:
-----------
trunk/punit.extension.test/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|