From 20d23d6004ab268f8878f8f38c15141e2d30ec44 Mon Sep 17 00:00:00 2001 From: Dave Nicolette Date: Fri, 1 Jan 2021 10:48:24 -0800 Subject: [PATCH] item #10 progress toward preparing batch files for Generator --- ALLTESTS | 1 + config.properties | 2 +- src/main/java/com/neopragma/cobolcheck/Driver.java | 5 ++--- src/main/java/com/neopragma/cobolcheck/GetOpt.java | 4 ---- .../cobolcheck/TestSuiteConcatenator.java | 14 ++++++++------ testfiles/SECOND-TESTSUITE | 11 +++++++++++ 6 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 testfiles/SECOND-TESTSUITE diff --git a/ALLTESTS b/ALLTESTS index e69de29b..2eda5061 100644 --- a/ALLTESTS +++ b/ALLTESTS @@ -0,0 +1 @@ + TESTSUITE 'GREETING AND FAREWELL (FAREWELL WILL FAIL)' TESTCASE 'IT RETURNS HELLO, WORLD! AS GREETING' MOVE 'GREETING' TO WS-MESSAGE-TYPE PERFORM 2000-SPEAK EXPECT WS-MESSAGE TO BE 'HELLO, WORLD!' TESTCASE 'IT RETURNS GOODBYE, CRUEL WORLD! AS FAREWELL' MOVE 'FAREWELL' TO WS-MESSAGE-TYPE PERFORM 2000-SPEAK EXPECT WS-MESSAGE TO BE 'GOODBYE, CRUEL WORLD!' TESTSUITE 'GREETING AND FAREWELL (FAREWELL WILL FAIL)' TESTCASE 'IT RETURNS HELLO, WORLD! AS GREETING' MOVE 'GREETING' TO WS-MESSAGE-TYPE PERFORM 2000-SPEAK EXPECT WS-MESSAGE TO BE 'HELLO, WORLD!' TESTCASE 'IT RETURNS GOODBYE, CRUEL WORLD! AS FAREWELL' MOVE 'FAREWELL' TO WS-MESSAGE-TYPE PERFORM 2000-SPEAK EXPECT WS-MESSAGE TO BE 'GOODBYE, CRUEL WORLD!' \ No newline at end of file diff --git a/config.properties b/config.properties index d1f434a2..3878475a 100644 --- a/config.properties +++ b/config.properties @@ -32,7 +32,7 @@ application.copybook.directory = copybooks application.copybook.filename.suffix = none # optional override of system default Locale -locale.language = ja +#locale.language = ja #locale.country = #locale.variant = diff --git a/src/main/java/com/neopragma/cobolcheck/Driver.java b/src/main/java/com/neopragma/cobolcheck/Driver.java index b83087d7..18990b90 100644 --- a/src/main/java/com/neopragma/cobolcheck/Driver.java +++ b/src/main/java/com/neopragma/cobolcheck/Driver.java @@ -48,7 +48,8 @@ public class Driver implements Constants, StringHelper { " Default: INFO", " -t|--test-suite-path absolute-or-relative-path[:absolute-or-relative-path[...]]", " Location(s) of test suite input file(s) for this run. Values specified here are prefixed", - " to those specified in the config file as test.suite.path (if any)." + " to those specified in the config file as test.suite.path (if any). Globs are supported here", + " but not in the config file." }; public Driver( @@ -73,8 +74,6 @@ void run() { } void prepareInputAndOutputFiles() { - - //TODO: concatenate test suite files TestSuiteConcatenator concatenator = new TestSuiteConcatenator(config, options); testSuite = concatenator.concatenateTestSuites(); diff --git a/src/main/java/com/neopragma/cobolcheck/GetOpt.java b/src/main/java/com/neopragma/cobolcheck/GetOpt.java index 1aa8640f..af44ec07 100644 --- a/src/main/java/com/neopragma/cobolcheck/GetOpt.java +++ b/src/main/java/com/neopragma/cobolcheck/GetOpt.java @@ -108,10 +108,6 @@ private void processCommandLineArgumentArray(String[] args) { OptionValue optionValue = new OptionValue(); String lastOption = EMPTY_STRING; for (String argValue : args) { - - System.out.println("argValue: " + argValue); - - if (isKey(argValue)) { if (expectValueNext) throw new CommandLineArgumentException( messages.get("ERR004", lastOption, argValue) diff --git a/src/main/java/com/neopragma/cobolcheck/TestSuiteConcatenator.java b/src/main/java/com/neopragma/cobolcheck/TestSuiteConcatenator.java index 5d093708..667666d2 100644 --- a/src/main/java/com/neopragma/cobolcheck/TestSuiteConcatenator.java +++ b/src/main/java/com/neopragma/cobolcheck/TestSuiteConcatenator.java @@ -37,7 +37,7 @@ public class TestSuiteConcatenator implements Constants, StringHelper { private Config config; private Messages messages; private GetOpt options; - private Reader testSuite; + private BufferedReader testSuite; public TestSuiteConcatenator(Config config, GetOpt options) { this.config = config; @@ -88,17 +88,19 @@ Reader concatenateTestSuites() { } String[] testSuitePathList = testSuitePaths.toString().split(COLON); - String line = EMPTY_STRING; + String line; for (String pathname : testSuitePathList) { try { Log.info(messages.get("INF007", pathname, concatenatedTestSuiteFileName)); - testSuite = new FileReader(pathname); - } catch (FileNotFoundException testSuiteException) { + testSuite = new BufferedReader(new FileReader(pathname)); + while ((line = testSuite.readLine()) != null) { + concatenatedTestSuitesWriter.write(line); + } + } catch (IOException testSuiteNotFound) { throw new TestSuiteInputFileNotFoundException( messages.get("ERR011", pathname), - testSuiteException); + testSuiteNotFound); } - } FileReader testSuite; try { diff --git a/testfiles/SECOND-TESTSUITE b/testfiles/SECOND-TESTSUITE new file mode 100644 index 00000000..8d5b2970 --- /dev/null +++ b/testfiles/SECOND-TESTSUITE @@ -0,0 +1,11 @@ + TESTSUITE 'GREETING AND FAREWELL (FAREWELL WILL FAIL)' + + TESTCASE 'IT RETURNS HELLO, WORLD! AS GREETING' + MOVE 'GREETING' TO WS-MESSAGE-TYPE + PERFORM 2000-SPEAK + EXPECT WS-MESSAGE TO BE 'HELLO, WORLD!' + + TESTCASE 'IT RETURNS GOODBYE, CRUEL WORLD! AS FAREWELL' + MOVE 'FAREWELL' TO WS-MESSAGE-TYPE + PERFORM 2000-SPEAK + EXPECT WS-MESSAGE TO BE 'GOODBYE, CRUEL WORLD!'