|
22 | 22 | import org.tzi.use.util.Log;
|
23 | 23 | import org.tzi.use.util.StringUtil;
|
24 | 24 | import org.tzi.use.util.TypedProperties;
|
| 25 | +import org.tzi.use.util.USEWriter; |
25 | 26 |
|
26 | 27 | import java.awt.*;
|
27 | 28 | import java.io.*;
|
@@ -290,6 +291,46 @@ private static void printHelp() {
|
290 | 291 | */
|
291 | 292 | public static boolean testMode;
|
292 | 293 |
|
| 294 | + public static boolean integrationTestMode; |
| 295 | + |
| 296 | + /** |
| 297 | + * Resets all options to the default setting. |
| 298 | + * Used to "restart" the application during integration tests. |
| 299 | + * The usage of the singleton pattern would be a better choice, |
| 300 | + * however it would require a huge refactoring. Therefore, |
| 301 | + * this reset function was introduced. |
| 302 | + */ |
| 303 | + public static void resetOptions() { |
| 304 | + USE_HISTORY_PATH = ".use_history"; |
| 305 | + LINE_SEPARATOR = System.getProperty("line.separator"); |
| 306 | + FILE_SEPARATOR = System.getProperty("file.separator"); |
| 307 | + MONITOR_ASPECT_TEMPLATE = null; |
| 308 | + homeDir = null; |
| 309 | + compileOnly = false; |
| 310 | + compileAndPrint = false; |
| 311 | + doGUI = true; |
| 312 | + suppressWarningsAboutMissingReadlineLibrary = false; |
| 313 | + quiet = false; |
| 314 | + debug = false; |
| 315 | + quietAndVerboseConstraintCheck = false; |
| 316 | + disableCollectShorthand = false; |
| 317 | + disableExtensions = false; |
| 318 | + explicitVariableDeclarations = true; |
| 319 | + checkTransitions = true; |
| 320 | + checkStateInvariants = false; |
| 321 | + WarningType checkWarningsOclAnyInCollections = WarningType.WARN; |
| 322 | + WarningType checkWarningsUnrelatedTypes = WarningType.WARN; |
| 323 | + doPLUGIN = true; |
| 324 | + pluginDir = null; |
| 325 | + fDiagramDimension = new Dimension( 600, 600 ); |
| 326 | + TypedProperties props = null; |
| 327 | + specFilename = null; |
| 328 | + cmdFilename = null; |
| 329 | + lastDirectory = Paths.get(System.getProperty("user.dir")); |
| 330 | + testMode = false; |
| 331 | + integrationTestMode = false; |
| 332 | + } |
| 333 | + |
293 | 334 | /**
|
294 | 335 | * <p>Parses command line arguments and sets options accordingly.</p>
|
295 | 336 | * <p>Calls System.exit(1) in case of errors.</p>
|
@@ -329,6 +370,9 @@ public static void processArgs(String[] args) {
|
329 | 370 | Options.doGUI = false;
|
330 | 371 | } else if (arg.equals("t")) {
|
331 | 372 | Options.testMode = true;
|
| 373 | + } else if (arg.equals("it")) { |
| 374 | + Options.testMode = true; |
| 375 | + Options.integrationTestMode = true; |
332 | 376 | } else if (arg.equals("v")) {
|
333 | 377 | Log.setVerbose(true);
|
334 | 378 | } else if (arg.equals("vt")) {
|
@@ -376,7 +420,9 @@ public static void processArgs(String[] args) {
|
376 | 420 | System.exit(1);
|
377 | 421 | }
|
378 | 422 | }
|
379 |
| - |
| 423 | + |
| 424 | + USEWriter.getInstance().setQuietMode(Options.quiet); |
| 425 | + |
380 | 426 | if (homeDir == null) {
|
381 | 427 | // Try to get the home from Java
|
382 | 428 | URL path = Options.class.getProtectionDomain().getCodeSource().getLocation();
|
|
0 commit comments