Skip to content

Commit a0f17cb

Browse files
authored
Merge pull request #82 from useocl/shell_integrationtests_inprocess
Shell integrationtests inprocess
2 parents 3067dd1 + 52abd81 commit a0f17cb

File tree

9 files changed

+495
-554
lines changed

9 files changed

+495
-554
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</modules>
1616

1717
<properties>
18-
<maven.compiler.source>14</maven.compiler.source>
19-
<maven.compiler.target>14</maven.compiler.target>
18+
<maven.compiler.source>21</maven.compiler.source>
19+
<maven.compiler.target>21</maven.compiler.target>
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
</properties>
2222
</project>

use-core/src/main/java/org/tzi/use/config/Options.java

+47-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.tzi.use.util.Log;
2323
import org.tzi.use.util.StringUtil;
2424
import org.tzi.use.util.TypedProperties;
25+
import org.tzi.use.util.USEWriter;
2526

2627
import java.awt.*;
2728
import java.io.*;
@@ -290,6 +291,46 @@ private static void printHelp() {
290291
*/
291292
public static boolean testMode;
292293

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+
293334
/**
294335
* <p>Parses command line arguments and sets options accordingly.</p>
295336
* <p>Calls System.exit(1) in case of errors.</p>
@@ -329,6 +370,9 @@ public static void processArgs(String[] args) {
329370
Options.doGUI = false;
330371
} else if (arg.equals("t")) {
331372
Options.testMode = true;
373+
} else if (arg.equals("it")) {
374+
Options.testMode = true;
375+
Options.integrationTestMode = true;
332376
} else if (arg.equals("v")) {
333377
Log.setVerbose(true);
334378
} else if (arg.equals("vt")) {
@@ -376,7 +420,9 @@ public static void processArgs(String[] args) {
376420
System.exit(1);
377421
}
378422
}
379-
423+
424+
USEWriter.getInstance().setQuietMode(Options.quiet);
425+
380426
if (homeDir == null) {
381427
// Try to get the home from Java
382428
URL path = Options.class.getProtectionDomain().getCodeSource().getLocation();

0 commit comments

Comments
 (0)