Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2381

Refactor test util to eliminate redundant windows baggage from CLI Tests

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.5.0
    • Clean Ups, CLI, QA

    Description

      The CLI tests have lots of verbose things explicit in test after test that should be pushed into libraries so that all the tests don't have to express them over and over.

       val DAFFODIL_JAVA_OPTS = Map("DAFFODIL_JAVA_OPTS" -> "-Xms256m -Xmx2048m -Djline.terminal=jline.UnsupportedTerminal -Dfile.encoding=UTF-8")
        //  Dubugging tests were not executing under Windows and especially under Eclipse
        //  due to the use of a non-interactive console.
        //  Set the DAFFODIL_JAVA_OPTS environment variable for Debugger tests to specify
        //  the use of an unsupported terminal: -Djline.terminal=jline.UnsupportedTerminal
        //  Also added a Java option to specify the character encoding: -Dfile.encoding=UTF-8
      
        @Test def test_3385_CLI_Debugger_invalidExpressions(): Unit = {
          val schemaFile = Util.daffodilPath("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
          val inputFile = Util.daffodilPath("daffodil-cli/src/it/resources/org/apache/daffodil/CLI/input/input1.txt")
          val (testSchemaFile, testInputFile) = if (Util.isWindows) (Util.cmdConvert(schemaFile), Util.cmdConvert(inputFile)) else (schemaFile, inputFile)
      
          val shell = if (Util.isWindows) Util.start("", envp = DAFFODIL_JAVA_OPTS) else Util.start("")
      

      All this Util.isWindows conditionalization should be pushed down into the Util libraries so that tests don't have to contain this kind of conditionalization.

      Every test in the file where the above code is taken has this same start:

          val schemaFile = Util.daffodilPath("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
          val inputFile = Util.daffodilPath("daffodil-cli/src/it/resources/org/apache/daffodil/CLI/input/input2.txt")
          val (testSchemaFile, testInputFile) = if (Util.isWindows) (Util.cmdConvert(schemaFile), Util.cmdConvert(inputFile)) else (schemaFile, inputFile)
      

      This conditional call to Util.cmdConvert should be pushed down into Util.daffodilPath, which should probably be shortened to just Util.path.

      Attachments

        Issue Links

          Activity

            People

              slawrence Steve Lawrence
              mbeckerle Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: