|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.hd.d.pg2k.test.dev.Main
public final class Main
This is the main entry point for development-time tests. This is also a valid top-level JUnit test class.
They can be run from the command-line or IDE to test most self-contained features, or from a WAR to allow self-test in an HTTP environment.
(In a WAR environment the out/err values and exitWhenDone/inWAR flags should be set appropriately.)
| Nested Class Summary | |
|---|---|
static class |
Main.TestThreadFactory
A factory for creating daemon pool threads. |
| Field Summary | |
|---|---|
private static boolean |
_accessToFilesystem
If true, this indicates that we have access to the filesystem for tests that need it. |
private static java.util.concurrent.locks.Lock |
_rtLock
Lock to prevent re-entering the runTests() method; never null. |
private static int |
AVAILABLE_PROCESSORS
Number of available CPUs. |
(package private) static java.util.concurrent.ExecutorService |
computeIntensiveTestThreadPool
Shared thread pool for compute-bound tests. |
private static java.io.PrintStream |
err
The PrintStream to direct standard output to. |
private static java.net.URL |
loopbackURL
URL for our mount-point if running as a WAR; null if none. |
private static java.io.PrintStream |
out
The PrintStream to direct standard output to. |
private static java.lang.Object |
servletContext
Current ServletContext if running in a WAR; null if none. |
private static java.lang.Class<?>[] |
testClasses
List of classes containing test suites to be run. |
| Constructor Summary | |
|---|---|
Main()
|
|
| Method Summary | |
|---|---|
private static void |
flattenSuite(junit.framework.TestSuite dest,
junit.framework.TestSuite src)
Flattens test case structure from src to dest. |
static java.io.PrintStream |
getErr()
Get stream to use in lieu of System.err for jUnit tests; never null. |
static java.net.URL |
getLoopbackURL()
Get URL for our mount-point if running as a WAR; or null if none. |
static java.io.PrintStream |
getOut()
Get stream to use in lieu of System.out for jUnit tests; never null. |
static java.lang.Object |
getServletContext()
Get current ServletContext if running in a WAR; null if none. |
static boolean |
isAccessToFilesystem()
If true, this indicates that we have access to the filesystem for tests that need it. |
static void |
main(java.lang.String[] args)
Main entry point from command-line. |
static boolean |
runTests(boolean forever,
java.io.PrintStream o,
java.io.PrintStream e,
java.net.URL loopbackURL,
java.lang.Object servletContext)
Actually runs the unit tests. |
static void |
runTestsFromServlet(java.io.Writer writer,
java.net.URL loopbackURL,
java.lang.Object servletContext)
Run the unit tests from a servlet. |
private static void |
setErr(java.io.PrintStream e)
Set the err stream; never null. |
static void |
setLoopbackURL(java.net.URL loopbackURL)
Set URL for our mount-point if running as a WAR; or null if none. |
private static void |
setOut(java.io.PrintStream o)
Set the out stream; never null. |
static void |
setServletContext(java.lang.Object servletContext)
Set current ServletContext if running in a WAR; null if none. |
static junit.framework.TestSuite |
suite()
This returns a suite of all the top-level tests that we want to perform. |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final boolean _accessToFilesystem
private static volatile java.net.URL loopbackURL
Marked volatile for thread-safe lock-free access.
private static volatile java.lang.Object servletContext
Marked volatile for thread-safe lock-free access.
private static volatile java.io.PrintStream out
PrintStream to direct standard output to.
Defaults to System.out.
Could be over-ridden by a servlet etc to send output back to the client.
This is package-visible only for safety.
Marked volatile for thread-safe lock-free access.
private static volatile java.io.PrintStream err
PrintStream to direct standard output to.
Defaults to System.out.
Could be over-ridden by a servlet etc to send output back to the client.
This is package-visible only for safety.
Marked volatile for thread-safe lock-free access.
private static final java.util.concurrent.locks.Lock _rtLock
private static final int AVAILABLE_PROCESSORS
static final java.util.concurrent.ExecutorService computeIntensiveTestThreadPool
Some work can be queued for this pool to maximise throughput and excess work (with no free pool threads or queue space available) will be run directly in the caller's thread. In simple uses this will allow for a little parallel slackness.
This puts an upper bound on Thread resources (eg memory for stack) consumed by threads in this pool.
The threads in the pool are daemon threads, so should not prevent the JVM from exiting.
Only available to test routines in this package.
private static final java.lang.Class<?>[] testClasses
| Constructor Detail |
|---|
public Main()
| Method Detail |
|---|
public static boolean isAccessToFilesystem()
Tests which expect access to configuration files, test data, etc, should avoid running when this does not return true.
public static java.net.URL getLoopbackURL()
Usually a top-level URL such as "http://localhost:8080/".
public static void setLoopbackURL(java.net.URL loopbackURL)
public static java.lang.Object getServletContext()
public static void setServletContext(java.lang.Object servletContext)
public static java.io.PrintStream getOut()
private static void setOut(java.io.PrintStream o)
public static java.io.PrintStream getErr()
private static void setErr(java.io.PrintStream e)
public static final void main(java.lang.String[] args)
If the first arg is -forever then the tests are run continuously until the process is killed.
If one or more test classes are given on the command-line then those tests alone are run, else all tests are run.
Only one top-level test routine may run at any one time.
public static void runTestsFromServlet(java.io.Writer writer,
java.net.URL loopbackURL,
java.lang.Object servletContext)
private static void flattenSuite(junit.framework.TestSuite dest,
junit.framework.TestSuite src)
public static boolean runTests(boolean forever,
java.io.PrintStream o,
java.io.PrintStream e,
java.net.URL loopbackURL,
java.lang.Object servletContext)
Output and error streams supplied replace the normal ones for the duration of the run; they must not be null. The previous values are restored upon completion.
forever - if true, tests are run repeatedly until an error is found
public static junit.framework.TestSuite suite()
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||