1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-28 05:47:08 +02:00

remove closure in withPipeline(p)

This commit is contained in:
Alejandra Ferreiro Vidal 2017-11-21 14:47:17 +01:00
parent 5ca3d39b02
commit 72b185e807
4 changed files with 93 additions and 94 deletions

View File

@ -196,67 +196,66 @@ public class MTABuildTest extends PiperTestBase {
private defaultPipeline(){
{ -> '''
@Library('piper-library-os')
return '''
@Library('piper-library-os')
execute(){
mtaBuild buildTarget: 'NEO'
}
execute(){
mtaBuild buildTarget: 'NEO'
}
return this
''' }
return this
'''
}
private returnMtarFilePathFromCommonPipelineEnvironmentPipeline(){
{ -> '''
@Library('piper-library-os')
return '''
@Library('piper-library-os')
execute(){
mtaBuild buildTarget: 'NEO'
return commonPipelineEnvironment.getMtarFilePath()
}
execute(){
mtaBuild buildTarget: 'NEO'
return commonPipelineEnvironment.getMtarFilePath()
}
return this
'''}
return this
'''
}
private mtaJarLocationAsParameterPipeline(){
{ -> '''
@Library('piper-library-os')
return '''
@Library('piper-library-os')
execute(){
mtaBuild mtaJarLocation: '/etc/mta', buildTarget: 'NEO'
}
execute(){
mtaBuild mtaJarLocation: '/etc/mta', buildTarget: 'NEO'
}
return this
'''}
return this
'''
}
private withSurroundingDirPipeline(){
{ -> '''
@Library('piper-library-os')
return '''
@Library('piper-library-os')
execute(dirPath){
dir("${dirPath}"){
mtaBuild buildTarget: 'NEO'
execute(dirPath){
dir("${dirPath}"){
mtaBuild buildTarget: 'NEO'
}
}
}
return this
'''}
return this
'''
}
private noBuildTargetPipeline(){
{ -> '''
@Library('piper-library-os')
return '''
@Library('piper-library-os')
execute(){
mtaBuild()
}
execute(){
mtaBuild()
}
return this
'''}
return this
'''
}

View File

@ -159,95 +159,95 @@ class NeoDeploymentTest extends PiperTestBase {
private defaultPipeline(){
{ -> """
@Library('piper-library-os')
return """
@Library('piper-library-os')
execute(archivePath, neoCredentialsId) {
execute(archivePath, neoCredentialsId) {
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
node() {
neoDeploy script: this, archivePath: archivePath, neoCredentialsId: neoCredentialsId
}
node() {
neoDeploy script: this, archivePath: archivePath, neoCredentialsId: neoCredentialsId
}
}
}
return this
"""}
return this
"""
}
private noCredentialsIdPipeline(){
{ -> """
@Library('piper-library-os')
return """
@Library('piper-library-os')
execute(archivePath) {
execute(archivePath) {
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
node() {
neoDeploy script: this, archivePath: archivePath
}
node() {
neoDeploy script: this, archivePath: archivePath
}
}
return this
""" }
return this
"""
}
private neoHomeParameterPipeline(){
{ -> """
@Library('piper-library-os')
return """
@Library('piper-library-os')
execute(archivePath, neoCredentialsId) {
execute(archivePath, neoCredentialsId) {
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
node() {
neoDeploy script: this, archivePath: archivePath, neoCredentialsId: neoCredentialsId, neoHome: '/etc/neo'
}
node() {
neoDeploy script: this, archivePath: archivePath, neoCredentialsId: neoCredentialsId, neoHome: '/etc/neo'
}
}
return this
""" }
return this
"""
}
private noArchivePathPipeline(){
{ -> """
@Library('piper-library-os')
return """
@Library('piper-library-os')
execute() {
execute() {
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
node() {
neoDeploy script: this
}
node() {
neoDeploy script: this
}
}
return this
""" }
return this
"""
}
private noScriptPipeline(){
{ -> """
@Library('piper-library-os')
return """
@Library('piper-library-os')
execute(archivePath) {
execute(archivePath) {
node() {
neoDeploy archivePath: archivePath
}
node() {
neoDeploy archivePath: archivePath
}
}
}
return this
""" }
return this
"""
}
}

View File

@ -33,7 +33,7 @@ public class PiperTestBase extends BasePipelineTest {
}
protected withPipeline(p) {
pipeline << p()
pipeline << p
loadScript(pipeline.toURI().getPath())
}

View File

@ -249,7 +249,7 @@ class ToolValidateTest extends PiperTestBase {
private defaultPipeline(){
{ -> """
return """
@Library('piper-library-os')
execute() {
@ -261,7 +261,7 @@ class ToolValidateTest extends PiperTestBase {
}
return this
"""}
"""
}
private getNoVersion(Map m) {