diff options
Diffstat (limited to 'src/org/gnunet/testing/TestingSetup.java')
-rw-r--r-- | src/org/gnunet/testing/TestingSetup.java | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/src/org/gnunet/testing/TestingSetup.java b/src/org/gnunet/testing/TestingSetup.java index ebb3dbc..6f8d578 100644 --- a/src/org/gnunet/testing/TestingSetup.java +++ b/src/org/gnunet/testing/TestingSetup.java | |||
@@ -29,44 +29,23 @@ import org.gnunet.util.RelativeTime; | |||
29 | * | 29 | * |
30 | * @author Florian Dold | 30 | * @author Florian Dold |
31 | */ | 31 | */ |
32 | public class TestingSetup { | 32 | public final class TestingSetup { |
33 | |||
34 | private TestingSetup() { | ||
35 | |||
36 | } | ||
33 | 37 | ||
34 | public static class SetupException extends RuntimeException { | 38 | public static class SetupException extends RuntimeException { |
35 | public SetupException(String msg, Throwable cause) { | 39 | public SetupException(Exception e) { |
36 | super(msg, cause); | 40 | super(e); |
37 | } | 41 | } |
38 | |||
39 | public SetupException(String msg) { | 42 | public SetupException(String msg) { |
40 | super(msg); | 43 | super(msg); |
41 | } | 44 | } |
42 | 45 | ||
43 | public SetupException(Throwable cause) { | ||
44 | super(cause); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * Start a subsystem for testing. Note that subsystems started with this function | ||
50 | * are independent of each other. | ||
51 | * | ||
52 | * After the JVM exits, the subsystem will be shut down. | ||
53 | * | ||
54 | * @param name name of the Subsystem | ||
55 | * @return | ||
56 | */ | ||
57 | public TestingSubsystem startSubsystem(String name) { | ||
58 | return new TestingSubsystem(name); | ||
59 | } | ||
60 | |||
61 | public TestingServer createServer() { | ||
62 | return new TestingServer(); | ||
63 | } | ||
64 | |||
65 | public TestingServer createServer(RelativeTime idleTimeout, boolean requireFound) { | ||
66 | return new TestingServer(idleTimeout, requireFound); | ||
67 | } | 46 | } |
68 | 47 | ||
69 | public TestingSetup() { | 48 | public static void setup() { |
70 | String log = System.getenv("GNJ_LOGLEVEL"); | 49 | String log = System.getenv("GNJ_LOGLEVEL"); |
71 | if (log != null) { | 50 | if (log != null) { |
72 | Program.configureLogging(log, null); | 51 | Program.configureLogging(log, null); |