[P-unit-devel] SF.net SVN: p-unit: [231] trunk/punit
Status: Beta
Brought to you by:
zhanghuangzhu
|
From: <zha...@us...> - 2007-08-12 14:03:49
|
Revision: 231
http://p-unit.svn.sourceforge.net/p-unit/?rev=231&view=rev
Author: zhanghuangzhu
Date: 2007-08-12 07:03:50 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Andrew Zhang: removed some warnings and unused codes.
Modified Paths:
--------------
trunk/punit/src/org/punit/util/RunnerUtil.java
trunk/punit/src/org/punit/watcher/AbstractWatcher.java
trunk/punit.extension/src/org/punit/listener/FieldSetter.java
trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java
trunk/punit.test/src/tests/util/TestUtil.java
Removed Paths:
-------------
trunk/punit/src/org/punit/exception/OutOfMemoryException.java
Deleted: trunk/punit/src/org/punit/exception/OutOfMemoryException.java
===================================================================
--- trunk/punit/src/org/punit/exception/OutOfMemoryException.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit/src/org/punit/exception/OutOfMemoryException.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -1,15 +0,0 @@
-/* (C) Copyright 2007, by Andrew Zhang */
-
-package org.punit.exception;
-
-/**
- * The root exception of all PUnit exception.
- */
-public class OutOfMemoryException extends RuntimeException {
-
- private static final long serialVersionUID = -2694385721230707311L;
-
- public OutOfMemoryException(OutOfMemoryError e) {
- super("Framework cannot reclaim its resources", e);
- }
-}
Modified: trunk/punit/src/org/punit/util/RunnerUtil.java
===================================================================
--- trunk/punit/src/org/punit/util/RunnerUtil.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit/src/org/punit/util/RunnerUtil.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -2,8 +2,6 @@
package org.punit.util;
-import java.io.File;
-
import org.punit.message.Messages;
import org.punit.runner.Runner;
import org.punit.runner.RunnerProperties;
@@ -31,46 +29,4 @@
testRunner.run(testClass, properties);
}
- private static final String BIN = File.separator + "bin"; //$NON-NLS-1$
- private static final String LIB = File.separator + "lib" + File.separator; //$NON-NLS-1$
-
- public static String getVmLaunchString() {
- return System.getProperty("java.home") + BIN + File.separator
- + "java -cp " + generateClassPath();
- }
-
- private static String generateClassPath() {
- StringBuffer sb = new StringBuffer();
- final String TEST_PATH = IOUtil.getCurrentPath();
-
- // test project
- sb.append(TEST_PATH);
- sb.append(BIN);
- sb.append(File.pathSeparator);
-
- // extension project
- final String EXTENSION_PATH = TEST_PATH.replace(
- "punit.test", "punit.extension"); //$NON-NLS-2$
- sb.append(EXTENSION_PATH);
- sb.append(BIN);
- sb.append(File.pathSeparator);
-
- // core project
- sb.append(TEST_PATH.replaceAll("punit.test", "punit")); //$NON-NLS-2$
- sb.append(BIN);
- sb.append(File.pathSeparator);
-
- // JUnit
- sb.append(EXTENSION_PATH + LIB + "junit-4.3.1.jar"); //$NON-NLS-1$
- sb.append(File.pathSeparator);
-
- // reporting tools
- sb.append(EXTENSION_PATH + LIB + "jcommon-1.0.9.jar"); //$NON-NLS-1$
- sb.append(File.pathSeparator);
- sb.append(EXTENSION_PATH + LIB + "jfreechart-1.0.5.jar"); //$NON-NLS-1$
- sb.append(File.pathSeparator);
- sb.append(EXTENSION_PATH + LIB + "itext-2.0.2.jar"); //$NON-NLS-1$
- return sb.toString();
- }
-
}
Modified: trunk/punit/src/org/punit/watcher/AbstractWatcher.java
===================================================================
--- trunk/punit/src/org/punit/watcher/AbstractWatcher.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit/src/org/punit/watcher/AbstractWatcher.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -17,14 +17,12 @@
}
public double value() {
-// System.out.println("_value = " + _value + ", _scale = " + _scale);
-// System.out.println("value() = " + (((double) _value) / _scale));
return ((double) _value) / _scale;
}
public String stringValue() {
if (_scale == 1) {
- return _value + " " + unit();
+ return _value + " " + unit(); //$NON-NLS-1$
} else {
return value() + unit();
}
Modified: trunk/punit.extension/src/org/punit/listener/FieldSetter.java
===================================================================
--- trunk/punit.extension/src/org/punit/listener/FieldSetter.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit.extension/src/org/punit/listener/FieldSetter.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -80,7 +80,7 @@
return false;
}
- private final String PACKAGE_SEPARATOR = ".";
+ private final String PACKAGE_SEPARATOR = "."; //$NON-NLS-1$
/**
* Set public class fields from java properties.
Modified: trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit.test/src/tests/api/org/punit/runner/SoloRunnerTest.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -67,8 +67,8 @@
public void testFieldSetter() {
Properties properties = new Properties();
// 12 + 18 = ParameterizedTestClass.SUM
- properties.put("VALUE1", "12");
- properties.put("VALUE2", "18");
+ 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);
Modified: trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit.test/src/tests/api/org/punit/testclasses/SetResultTestClass.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -13,9 +13,9 @@
public static final long TIMEOUT = 500;
- public static final String SUPPORTED_THREADS = "Supported Number of Threads";
+ public static final String SUPPORTED_THREADS = "Supported Number of Threads"; //$NON-NLS-1$
- public static final String THREAD_UNITS = "threads";
+ public static final String THREAD_UNITS = "threads"; //$NON-NLS-1$
private boolean _stop;
Modified: trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java
===================================================================
--- trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit.test/src/tests/api/org/punit/watcher/CustomWatcherTest.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -27,8 +27,8 @@
protected void setUp() throws Exception {
MethodRunner methodRunner = new SoloMethodRunner();
- _minWatcher = new MinimumWatcher(methodRunner, HEAP_WASTE, "%");
- _maxWatcher = new MaximumWatcher(methodRunner, HEAP_UTILIZATION, "%");
+ _minWatcher = new MinimumWatcher(methodRunner, HEAP_WASTE, "%"); //$NON-NLS-1$
+ _maxWatcher = new MaximumWatcher(methodRunner, HEAP_UTILIZATION, "%"); //$NON-NLS-1$
}
public void test() throws Exception {
@@ -78,9 +78,9 @@
private void setWatcherValue(long allocated) {
long total = MemoryUtil.totalMemory();
- CustomWatcher.setResult(HEAP_WASTE, (total - allocated) * 100, "%",
+ CustomWatcher.setResult(HEAP_WASTE, (total - allocated) * 100, "%", //$NON-NLS-1$
total);
- CustomWatcher.setResult(HEAP_UTILIZATION, allocated * 100, "%", total);
+ CustomWatcher.setResult(HEAP_UTILIZATION, allocated * 100, "%", total); //$NON-NLS-1$
}
public void testSerializable() throws Exception {
Modified: trunk/punit.test/src/tests/util/TestUtil.java
===================================================================
--- trunk/punit.test/src/tests/util/TestUtil.java 2007-07-20 13:04:13 UTC (rev 230)
+++ trunk/punit.test/src/tests/util/TestUtil.java 2007-08-12 14:03:50 UTC (rev 231)
@@ -1,17 +1,13 @@
package tests.util;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.io.*;
import java.lang.reflect.Method;
import java.util.Random;
import org.punit.events.EventListener;
import org.punit.runner.SoloRunner;
import org.punit.type.VM;
-import org.punit.util.RunnerUtil;
-import org.punit.util.ThreadUtil;
+import org.punit.util.*;
public class TestUtil {
@@ -60,10 +56,53 @@
consumeMemory(Math.abs(_random.nextInt()) % 100000);
}
+ public static String getVmLaunchString() {
+ return System.getProperty("java.home") + BIN + File.separator //$NON-NLS-1$
+ + "java -cp " + generateClassPath(); //$NON-NLS-1$
+ }
+
+ private static final String BIN = File.separator + "bin"; //$NON-NLS-1$
+ private static final String LIB = File.separator + "lib" + File.separator; //$NON-NLS-1$
+
+
+ private static String generateClassPath() {
+ StringBuffer sb = new StringBuffer();
+ final String TEST_PATH = IOUtil.getCurrentPath();
+
+ // test project
+ sb.append(TEST_PATH);
+ sb.append(BIN);
+ sb.append(File.pathSeparator);
+
+ // extension project
+ final String EXTENSION_PATH = TEST_PATH.replace(
+ "punit.test", "punit.extension"); //$NON-NLS-1$//$NON-NLS-2$
+ sb.append(EXTENSION_PATH);
+ sb.append(BIN);
+ sb.append(File.pathSeparator);
+
+ // core project
+ sb.append(TEST_PATH.replaceAll("punit.test", "punit")); //$NON-NLS-1$//$NON-NLS-2$
+ sb.append(BIN);
+ sb.append(File.pathSeparator);
+
+ // JUnit
+ sb.append(EXTENSION_PATH + LIB + "junit-4.3.1.jar"); //$NON-NLS-1$
+ sb.append(File.pathSeparator);
+
+ // reporting tools
+ sb.append(EXTENSION_PATH + LIB + "jcommon-1.0.9.jar"); //$NON-NLS-1$
+ sb.append(File.pathSeparator);
+ sb.append(EXTENSION_PATH + LIB + "jfreechart-1.0.5.jar"); //$NON-NLS-1$
+ sb.append(File.pathSeparator);
+ sb.append(EXTENSION_PATH + LIB + "itext-2.0.2.jar"); //$NON-NLS-1$
+ return sb.toString();
+ }
+
@SuppressWarnings("unchecked")
public static void runVMs(Class clazz, EventListener[] listeners) {
runUnitTest = false;
- final String THIS_VM = RunnerUtil.getVmLaunchString();
+ final String THIS_VM = getVmLaunchString();
final String NO_VERIFY = " -Xverify:none"; //$NON-NLS-1$
VM vm = new VM(THIS_VM, "VM"); //$NON-NLS-1$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|