Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-2474

TestRunner should not expose a VariableRegistry construct

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.0.0, 1.0.0-Beta
    • Tools and Build
    • None

    Description

      Currently, the TestRunners class provides a mechanism for creating a TestRunner that takes in a Variable Registry. The concept of providing variables to the Test Runner is very valuable. However, the notion of the VariableRegistry is an internal implementation detail that is getting exposed, creating a leaky abstraction.

      We should remove the override of the createTestRunner() method that takes the Variable Registry and instead expose a set of methods of TestRunner:

      void setVariable(String name, String value)
      String getVariable(String name)
      void setVariables(Map<String, String> variables)
      Map<String, String> getVariables()

      Additionally, as-is, if no VariableRegistry is provided, the default is to use a Variable Registry that provides System and Environment variables. This should be avoided, as it encourages unit tests to depend on environment-specific settings.

      Attachments

        Issue Links

          Activity

            People

              markap14 Mark Payne
              markap14 Mark Payne
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: