Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZunitConfig.groovy updates #299

Merged
merged 3 commits into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions languages/ZunitConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import groovy.xml.*
@Field BuildProperties props = BuildProperties.getInstance()
@Field def buildUtils= loadScript(new File("${props.zAppBuildDir}/utilities/BuildUtilities.groovy"))
@Field def impactUtils= loadScript(new File("${props.zAppBuildDir}/utilities/ImpactUtilities.groovy"))
@Field def bindUtils= loadScript(new File("${props.zAppBuildDir}/utilities/BindUtilities.groovy"))

println("** Building files mapped to ${this.class.getName()}.groovy script")

Expand All @@ -33,15 +32,18 @@ buildUtils.createLanguageDatasets(langQualifier)


String dependencySearch = props.getFileProperty('zunit_dependencySearch', buildFile)
SearchPathDependency dependencyResolver = new SearchPathDependencyResolver(dependencySearch)
SearchPathDependencyResolver dependencyResolver = new SearchPathDependencyResolver(dependencySearch)

// copy build file and dependency files to data sets
buildUtils.copySourceFiles(buildUtils.getAbsolutePath(buildFile), props.zunit_bzucfgPDS, 'zunit_dependenciesDatasetMapping', null, dependencyResolver)

// Parse the playback from the bzucfg file
Boolean hasPlayback = false
String playback
(hasPlayback, playback) = getPlaybackFile(buildFile);
buildUtils.copySourceFiles(buildFile, props.zunit_bzucfgPDS, 'zunit_dependenciesDatasetMapping', null, dependencyResolver)

// get logical file
LogicalFile logicalFile = buildUtils.createLogicalFile(dependencyResolver, buildFile)

// get playback dependency for bzucfg file from logicalFile
boolean hasPlayback = false
LogicalDependency playbackFile
(hasPlayback, playbackFile) = getPlaybackFile(logicalFile);

// Create JCLExec String
String jobcard = props.jobCard.replace("\\n", "\n")
Expand All @@ -67,7 +69,7 @@ jcl += """\
if (hasPlayback) { // bzucfg contains reference to a playback file
jcl +=
"//REPLAY.BZUPLAY DD DISP=SHR, \n" +
"// DSN=${props.zunit_bzuplayPDS}(${playback}) \n"
"// DSN=${props.zunit_bzuplayPDS}(${playbackFile.getLname()}) \n"
} else { // no playbackfile referenced
jcl +=
"//REPLAY.BZUPLAY DD DUMMY \n"
Expand Down Expand Up @@ -216,17 +218,17 @@ zunitDebugParm = props.getFileProperty('zunit_userDebugSessionTestParm', buildFi
*/

/*
* returns containsPlayback,
* returns the LogicalDependency of the playbackfile
*/
def getPlaybackFile(String xmlFile) {
String xml = new File(buildUtils.getAbsolutePath(xmlFile)).getText("IBM-1047")
def parser = new XmlParser().parseText(xml)
if (parser.'runner:playback'.playbackFile.size()==0) return [false, null]
else {
String playbackFileName = parser.'runner:playback'.@moduleName[0]
return [true, playbackFileName]
}
}
def getPlaybackFile(LogicalFile logicalFile) {
// find playback file dependency
LogicalDependency playbackDependency = logicalFile.getLogicalDependencies().find {
it.getLibrary() == "SYSPLAY"
}
if (playbackDependency) {
return [true, playbackDependency]
}
}

/**
* Parsing the result file and prints summary of the result
Expand Down