Helper classes

The helper classes primarily serve as wrapper classes for the use of the different methods used by the plugins. Other serve purposes like provided configuration data PipelineConfig or preparing JCL for one specific execution of a pipeline JclSkeleton.

FileHelper

The FileHelper class is used to read external files and provides the methods.

GitHelper

The GitHelper class serves as a wrapper around the Git SCM plugin and provides the methods GitHelper(steps).

IspwHelper

The IspwHelper class serves as a wrapper around the Compuware ISPW plugin and provides the methods IspwHelper(steps, pConfig).

  • The constructor receives the steps from the pipeline to allow use of pipeline step within the class code and a PipelineConfig to make use of pipeline execution specific parameters.
  • downloadSources() downloads all sources (COBOL programs and copybooks) contained in ISPW set triggering the pipeline.
  • downloadCopyBooks(String workspace) does the following items:
    • receives the path to the workspace of the pipeline job
    • uses the referencedCopyBooks method to determine all copybooks used by the download COBOL programs
    • uses a JclSkeleton object's createIebcopyCopyBooksJcl method to create an IEBCOPY job JCL that copies all required copybooks in the list from the ISPW libraries into a temporary PDS
    • submits this JCL using the Topaz Utilities plugin
    • downloads the content of the temporary PDS, using the ISPW PDS downloader
    • uses the JclSkeleton method jclSkeleton.createDeleteTempDsn to create a DELETE job JCL
    • and submits that JCL
  • referencedCopyBooks(String workspace) does the following items:
    • receives the path to the workspace of the pipeline job
    • searches all *.cbl program sources in the folder containing all downloaded sources and builds a list of COBOL programs
    • for each program in the list it
      • reads the source file
      • scans the content for valid COPY statements (e.g. not comments)
      • determines the referenced copybook
      • add each copybook to the list of copybooks
    • returns the resulting list of copybooks
  • regressAssignmentList(assignmentList, cesToken) receives a list of assignment IDs in assignmentList, the CES Token in cesToken and calls method regressAssignment for each element of assignmentList
  • def regressAssignment(assignment, cesToken) receives an Assignment ID in assignment, the CES Token in cesToken and uses the ISPW REST API to regress the assignment.

JclSkeleton

The JclSkeleton class allows the pipelines to customize pieces of JCL in certain, predefined ways. This allows changing e.g. job cards, STEPLIB concatenations and others during runtime. The JCL skeletons are read from folder './config/skels' in the pipeline workspace.

PipelineConfig

The PipelineConfig class stores and allows retrieval of any pipeline configuration and runtime specific parameters.

  • The constructor PipelineConfig(steps, workspace, params, mailListLines) receives the steps from the pipeline to allow use of pipeline step within the class code, the path of the pipeline workspace the Map params containing the key:value parameter pairs from the pipeline call, and a the list of records from the mailList.config file and initializes all parameters that can be initialized immediately.
  • initialize() is used for additional initialization which cannot be executed in the constructor and it:
    • deletes any old content from the pipeline workspace
    • Uses the checkoutPathmethod of the GitHelper class to download the path containing the configuration files from the GitHub repository containing the configuration. (In future configuration files will be move to Managed Files, thus avoiding to have to download configuration from GitHub and exposure of configuration on GitHub.)
    • execute the following internal methods to set the remaining configuration values
  • setServerConfig() does the following items:
    • reads the pipeline configuration file pipeline.config, containing server URLs (e.g. Sonar, XL Release) etc.
    • extracts the values for the corresponding parameters
    • sets the parameters
  • setTttGitConfig() does the following items:
    • reads the pipeline configuration file tttgit.config, containing information about the GitHub repository storing the Topaz for Total Test projects
    • extracts the values for the corresponding parameters
    • sets the parameters
  • setMailConfig() does the following items:
    • loops though the list of mailListLines containing the TSO user:email pairs
    • turns the records into a Map
    • determines the email address for the owner of the ISPW set and sets the parameter mailRecipient accordingly
  • readConfigFile(String fileName) uses an instance of the FileHelper class to read the configuration files

SonarHelper

The SonarHelper class serves as a wrapper to execute the SonarQube scanner.

TttHelper

The TttHelper class serves as a wrapper around Topaz for Total Test related activities like, executing the unit tests for the downloaded programs in a loop, and gathering the results from Code Coverage.

  • The constructor TttHelper(script, steps, pConfig) receives the scriptobject and the steps from the pipeline and a PipelineConfig to make use of pipeline execution specific parameters.

  • initialize() is used for additional initialization which cannot be executed in the constructor and does the following:

    • Instantiates a JclSkeleton for later use by loopThruScenarios().
    • Builds a list of downloaded COBOL sources and a list of downloaded .testscenarios.
  • loopThruScenarios() loops through the .testscenarios and for each scenario:

    • determines if the scenario matches one of the COBOL programs
    • in that case
      • the job card of the corresponding runner jcl gets replaced by the configuration job card
      • the scenario gets executed
  • passResultsToJunit() uses the JUnit plugin to display the unit test results on the pipeline dashboard.

  • collectCodeCoverageResults() uses the Xpediter Code Coverage plugin to retrieve code coverage results from the Xpediter Code Coverage repository.