1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

Merge pull request #136 from marcusholl/pr/useGroovyInIncreaseReadability

Pr/use groovy in increase readability
This commit is contained in:
Marcus Holl 2018-04-24 09:48:11 +02:00 committed by GitHub
commit 651a11f5d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -366,7 +366,7 @@ class NeoDeployTest extends BasePipelineTest {
void illegalDeployModeTest() {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: [mta, warParams, warPropertiesFile]")
jsr.step.call(script: [commonPipelineEnvironment: jer.env],
archivePath: warArchiveName,
@ -382,7 +382,7 @@ class NeoDeployTest extends BasePipelineTest {
void illegalVMSizeTest() {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: [lite, pro, prem, prem-plus].")
jsr.step.call(script: [commonPipelineEnvironment: jer.env],
archivePath: warArchiveName,
@ -398,7 +398,7 @@ class NeoDeployTest extends BasePipelineTest {
void illegalWARActionTest() {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: [deploy, rolling-update].")
jsr.step.call(script: [commonPipelineEnvironment: jer.env],
archivePath: warArchiveName,

View File

@ -110,14 +110,16 @@ def call(parameters = [:]) {
def runtimeVersion
def vmSize
if (deployMode != 'mta' && deployMode != 'warParams' && deployMode != 'warPropertiesFile') {
throw new Exception("[neoDeploy] Invalid deployMode = '${deployMode}'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
def deployModes = ['mta', 'warParams', 'warPropertiesFile']
if (! (deployMode in deployModes)) {
throw new Exception("[neoDeploy] Invalid deployMode = '${deployMode}'. Valid 'deployMode' values are: ${deployModes}.")
}
if (deployMode == 'warPropertiesFile' || deployMode == 'warParams') {
if (deployMode in ['warPropertiesFile', 'warParams']) {
warAction = utils.getMandatoryParameter(configuration, 'warAction')
if (warAction != 'deploy' && warAction != 'rolling-update') {
throw new Exception("[neoDeploy] Invalid warAction = '${warAction}'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
def warActions = ['deploy', 'rolling-update']
if (! (warAction in warActions)) {
throw new Exception("[neoDeploy] Invalid warAction = '${warAction}'. Valid 'warAction' values are: ${warActions}.")
}
}
@ -132,13 +134,14 @@ def call(parameters = [:]) {
applicationName = utils.getMandatoryParameter(configuration, 'applicationName')
runtime = utils.getMandatoryParameter(configuration, 'runtime')
runtimeVersion = utils.getMandatoryParameter(configuration, 'runtimeVersion')
def vmSizes = ['lite', 'pro', 'prem', 'prem-plus']
vmSize = configuration.vmSize
if (vmSize != 'lite' && vmSize !='pro' && vmSize != 'prem' && vmSize != 'prem-plus') {
throw new Exception("[neoDeploy] Invalid vmSize = '${vmSize}'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
if (! (vmSize in vmSizes)) {
throw new Exception("[neoDeploy] Invalid vmSize = '${vmSize}'. Valid 'vmSize' values are: ${vmSizes}.")
}
}
if (deployMode.equals('mta') || deployMode.equals('warParams')) {
if (deployMode in ['mta','warParams']) {
deployHost = utils.getMandatoryParameter(configuration, 'host')
deployAccount = utils.getMandatoryParameter(configuration, 'account')
}