From 994e1f16925ee9495f934d004a870d5c26cbf020 Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Tue, 22 Jan 2019 09:19:28 +0100 Subject: [PATCH] Better readable rule names: shellRule --- test/groovy/ArtifactSetVersionTest.groovy | 18 +++--- test/groovy/BatsExecuteTestsTest.groovy | 14 ++--- test/groovy/CloudFoundryDeployTest.groovy | 56 +++++++++---------- .../DockerExecuteOnKubernetesTest.groovy | 4 +- .../FioriOnCloudPlatformPipelineTest.groovy | 18 +++--- test/groovy/GaugeExecuteTestsTest.groovy | 8 +-- test/groovy/KarmaExecuteTestsTest.groovy | 6 +- test/groovy/MailSendNotificationTest.groovy | 16 +++--- test/groovy/MavenExecuteTest.groovy | 18 +++--- test/groovy/MtaBuildTest.groovy | 38 ++++++------- test/groovy/NeoDeployTest.groovy | 34 +++++------ test/groovy/NewmanExecuteTest.groovy | 18 +++--- .../PipelineStashFilesBeforeBuildTest.groovy | 10 ++-- test/groovy/SeleniumExecuteTestsTest.groovy | 2 +- test/groovy/SnykExecuteTest.groovy | 16 +++--- test/groovy/com/sap/piper/GitUtilsTest.groovy | 36 ++++++------ .../com/sap/piper/JenkinsUtilsTest.groovy | 6 +- test/groovy/com/sap/piper/UtilsTest.groovy | 14 ++--- .../MavenArtifactVersioningTest.groovy | 8 +-- .../MtaArtifactVersioningTest.groovy | 6 +- 20 files changed, 173 insertions(+), 173 deletions(-) diff --git a/test/groovy/ArtifactSetVersionTest.groovy b/test/groovy/ArtifactSetVersionTest.groovy index 433fef294..e69e4b145 100644 --- a/test/groovy/ArtifactSetVersionTest.groovy +++ b/test/groovy/ArtifactSetVersionTest.groovy @@ -48,7 +48,7 @@ class ArtifactSetVersionTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this) @@ -59,7 +59,7 @@ class ArtifactSetVersionTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) .around(thrown) .around(jlr) - .around(jscr) + .around(shellRule) .around(new JenkinsReadMavenPomRule(this, 'test/resources/versioning/MavenArtifactVersioning')) .around(jwfr) .around(jder) @@ -78,8 +78,8 @@ class ArtifactSetVersionTest extends BasePiperTest { return closure() }) - jscr.setReturnValue("date --universal +'%Y%m%d%H%M%S'", '20180101010203') - jscr.setReturnValue('git diff --quiet HEAD', 0) + shellRule.setReturnValue("date --universal +'%Y%m%d%H%M%S'", '20180101010203') + shellRule.setReturnValue('git diff --quiet HEAD', 0) helper.registerAllowedMethod('fileExists', [String.class], {true}) } @@ -91,8 +91,8 @@ class ArtifactSetVersionTest extends BasePiperTest { assertEquals('1.2.3-20180101010203_testCommitId', jer.env.getArtifactVersion()) assertEquals('testCommitId', jer.env.getGitCommitId()) - assertThat(jscr.shell, hasItem("mvn --file 'pom.xml' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101010203_testCommitId -DgenerateBackupPoms=false")) - assertThat(jscr.shell.join(), stringContainsInOrder([ + assertThat(shellRule.shell, hasItem("mvn --file 'pom.xml' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101010203_testCommitId -DgenerateBackupPoms=false")) + assertThat(shellRule.shell.join(), stringContainsInOrder([ "git add .", "git commit -m 'update version 1.2.3-20180101010203_testCommitId'", 'git tag build_1.2.3-20180101010203_testCommitId', @@ -106,15 +106,15 @@ class ArtifactSetVersionTest extends BasePiperTest { jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', commitVersion: false) assertEquals('1.2.3-20180101010203_testCommitId', jer.env.getArtifactVersion()) - assertThat(jscr.shell, hasItem("mvn --file 'pom.xml' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101010203_testCommitId -DgenerateBackupPoms=false")) - assertThat(jscr.shell, not(hasItem(containsString('commit')))) + assertThat(shellRule.shell, hasItem("mvn --file 'pom.xml' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101010203_testCommitId -DgenerateBackupPoms=false")) + assertThat(shellRule.shell, not(hasItem(containsString('commit')))) } @Test void testVersioningCustomGitUserAndEMail() { jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', gitSshUrl: 'myGitSshUrl', gitUserEMail: 'test@test.com', gitUserName: 'test') - assertThat(jscr.shell, hasItem(containsString("git -c user.email=\"test@test.com\" -c user.name=\"test\" commit -m 'update version 1.2.3-20180101010203_testCommitId'"))) + assertThat(shellRule.shell, hasItem(containsString("git -c user.email=\"test@test.com\" -c user.name=\"test\" commit -m 'update version 1.2.3-20180101010203_testCommitId'"))) } @Test diff --git a/test/groovy/BatsExecuteTestsTest.groovy b/test/groovy/BatsExecuteTestsTest.groovy index 0e8bd3350..b25a6f430 100644 --- a/test/groovy/BatsExecuteTestsTest.groovy +++ b/test/groovy/BatsExecuteTestsTest.groovy @@ -15,7 +15,7 @@ class BatsExecuteTestsTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this) @Rule @@ -24,7 +24,7 @@ class BatsExecuteTestsTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) .around(thrown) .around(jder) - .around(jscr) + .around(shellRule) .around(jlr) .around(jsr) @@ -57,15 +57,15 @@ class BatsExecuteTestsTest extends BasePiperTest { // asserts assertThat(withEnvArgs, hasItem('IMAGE_NAME=test/image')) assertThat(withEnvArgs, hasItem('CONTAINER_NAME=test-container')) - assertThat(jscr.shell, hasItem('git clone https://github.com/bats-core/bats-core.git')) - assertThat(jscr.shell, hasItem('bats-core/bin/bats --recursive --tap src/test > \'TEST-testPackage.tap\'')) - assertThat(jscr.shell, hasItem('cat \'TEST-testPackage.tap\'')) + assertThat(shellRule.shell, hasItem('git clone https://github.com/bats-core/bats-core.git')) + assertThat(shellRule.shell, hasItem('bats-core/bin/bats --recursive --tap src/test > \'TEST-testPackage.tap\'')) + assertThat(shellRule.shell, hasItem('cat \'TEST-testPackage.tap\'')) assertThat(jder.dockerParams.dockerImage, is('node:8-stretch')) assertThat(jder.dockerParams.dockerWorkspace, is('/home/node')) - assertThat(jscr.shell, hasItem('npm install tap-xunit -g')) - assertThat(jscr.shell, hasItem('cat \'TEST-testPackage.tap\' | tap-xunit --package=\'testPackage\' > TEST-testPackage.xml')) + assertThat(shellRule.shell, hasItem('npm install tap-xunit -g')) + assertThat(shellRule.shell, hasItem('cat \'TEST-testPackage.tap\' | tap-xunit --package=\'testPackage\' > TEST-testPackage.xml')) assertJobStatusSuccess() } diff --git a/test/groovy/CloudFoundryDeployTest.groovy b/test/groovy/CloudFoundryDeployTest.groovy index 418c1cd3b..cb629befb 100644 --- a/test/groovy/CloudFoundryDeployTest.groovy +++ b/test/groovy/CloudFoundryDeployTest.groovy @@ -29,7 +29,7 @@ class CloudFoundryDeployTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this) private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) @@ -50,7 +50,7 @@ class CloudFoundryDeployTest extends BasePiperTest { .around(jryr) .around(thrown) .around(jlr) - .around(jscr) + .around(shellRule) .around(jwfr) .around(jedr) .around(jer) @@ -145,9 +145,9 @@ class CloudFoundryDeployTest extends BasePiperTest { assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli')) assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper')) assertThat(jedr.dockerParams.dockerEnvVars, hasEntry('STATUS_CODE', "${200}")) - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString("cf push testAppName -f 'test.yml'"))) - assertThat(jscr.shell, hasItem(containsString("cf logout"))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString("cf push testAppName -f 'test.yml'"))) + assertThat(shellRule.shell, hasItem(containsString("cf logout"))) } @Test @@ -170,7 +170,7 @@ class CloudFoundryDeployTest extends BasePiperTest { cfManifest: 'test.yml' ]) // asserts - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://customApi -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://customApi -o "testOrg" -s "testSpace"'))) } @Test @@ -197,9 +197,9 @@ class CloudFoundryDeployTest extends BasePiperTest { assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli')) assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper')) assertThat(jedr.dockerParams.dockerEnvVars, hasEntry('STATUS_CODE', "${200}")) - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString("cf push testAppName -f 'test.yml'"))) - assertThat(jscr.shell, hasItem(containsString("cf logout"))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString("cf push testAppName -f 'test.yml'"))) + assertThat(shellRule.shell, hasItem(containsString("cf logout"))) } @Test @@ -222,9 +222,9 @@ class CloudFoundryDeployTest extends BasePiperTest { cfManifest: 'test.yml' ]) // asserts - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString("cf push -f 'test.yml'"))) - assertThat(jscr.shell, hasItem(containsString("cf logout"))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString("cf push -f 'test.yml'"))) + assertThat(shellRule.shell, hasItem(containsString("cf logout"))) } @Test @@ -271,9 +271,9 @@ class CloudFoundryDeployTest extends BasePiperTest { assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli')) assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper')) - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString("cf blue-green-deploy testAppName --delete-old-apps -f 'test.yml'"))) - assertThat(jscr.shell, hasItem(containsString("cf logout"))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString("cf blue-green-deploy testAppName --delete-old-apps -f 'test.yml'"))) + assertThat(shellRule.shell, hasItem(containsString("cf logout"))) } @@ -299,10 +299,10 @@ class CloudFoundryDeployTest extends BasePiperTest { assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli')) assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper')) - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString("cf blue-green-deploy testAppName --delete-old-apps -f 'test.yml'"))) - assertThat(jscr.shell, not(hasItem(containsString("cf stop testAppName-old")))) - assertThat(jscr.shell, hasItem(containsString("cf logout"))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString("cf blue-green-deploy testAppName --delete-old-apps -f 'test.yml'"))) + assertThat(shellRule.shell, not(hasItem(containsString("cf stop testAppName-old")))) + assertThat(shellRule.shell, hasItem(containsString("cf logout"))) } @@ -328,10 +328,10 @@ class CloudFoundryDeployTest extends BasePiperTest { assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli')) assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper')) - assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString("cf blue-green-deploy testAppName -f 'test.yml'"))) - assertThat(jscr.shell, hasItem(containsString("cf stop testAppName-old"))) - assertThat(jscr.shell, hasItem(containsString("cf logout"))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString("cf blue-green-deploy testAppName -f 'test.yml'"))) + assertThat(shellRule.shell, hasItem(containsString("cf stop testAppName-old"))) + assertThat(shellRule.shell, hasItem(containsString("cf logout"))) } @Test @@ -353,7 +353,7 @@ class CloudFoundryDeployTest extends BasePiperTest { cfManifest: 'test.yml' ]) - assertThat(jscr.shell, not(hasItem(containsString("cf stop testAppName-old")))) + assertThat(shellRule.shell, not(hasItem(containsString("cf stop testAppName-old")))) } @Test @@ -394,9 +394,9 @@ class CloudFoundryDeployTest extends BasePiperTest { // asserts assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli')) assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper')) - assertThat(jscr.shell, hasItem(containsString('cf login -u test_cf -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) - assertThat(jscr.shell, hasItem(containsString('cf deploy target/test.mtar -f'))) - assertThat(jscr.shell, hasItem(containsString('cf logout'))) + assertThat(shellRule.shell, hasItem(containsString('cf login -u test_cf -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"'))) + assertThat(shellRule.shell, hasItem(containsString('cf deploy target/test.mtar -f'))) + assertThat(shellRule.shell, hasItem(containsString('cf logout'))) } @Test @@ -414,7 +414,7 @@ class CloudFoundryDeployTest extends BasePiperTest { mtaPath: 'target/test.mtar' ]) - assertThat(jscr.shell, hasItem(stringContainsInOrder(["cf login -u test_cf", 'cf bg-deploy', '-f', '--no-confirm']))) + assertThat(shellRule.shell, hasItem(stringContainsInOrder(["cf login -u test_cf", 'cf bg-deploy', '-f', '--no-confirm']))) } @Test diff --git a/test/groovy/DockerExecuteOnKubernetesTest.groovy b/test/groovy/DockerExecuteOnKubernetesTest.groovy index 4c7f885ac..ff4106d2e 100644 --- a/test/groovy/DockerExecuteOnKubernetesTest.groovy +++ b/test/groovy/DockerExecuteOnKubernetesTest.groovy @@ -25,7 +25,7 @@ import static org.junit.Assert.assertFalse class DockerExecuteOnKubernetesTest extends BasePiperTest { private ExpectedException exception = ExpectedException.none() private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) @@ -35,7 +35,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) .around(exception) .around(jder) - .around(jscr) + .around(shellRule) .around(jlr) .around(jsr) int whichDockerReturnValue = 0 diff --git a/test/groovy/FioriOnCloudPlatformPipelineTest.groovy b/test/groovy/FioriOnCloudPlatformPipelineTest.groovy index ac324c9c9..7a955673e 100644 --- a/test/groovy/FioriOnCloudPlatformPipelineTest.groovy +++ b/test/groovy/FioriOnCloudPlatformPipelineTest.groovy @@ -48,14 +48,14 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest { JenkinsStepRule jsr = new JenkinsStepRule(this) JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this) - JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) @Rule public RuleChain ruleChain = Rules .getCommonRules(this) .around(jryr) .around(jsr) - .around(jscr) + .around(shellRule) .around(new JenkinsCredentialsRule(this) .withCredentials('CI_CREDENTIALS_ID', 'foo', 'terceSpot')) @@ -67,11 +67,11 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest { // // Things we validate: - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*echo \\$JAVA_HOME.*', '/opt/sap/java') - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*echo \\$MTA_JAR_LOCATION.*', '/opt/sap') - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*echo \\$NEO_HOME.*', '/opt/sap/neo') - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, ".*bin/java -version.*", '1.8.0') // the java version - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, ".*bin/java -jar .*mta.jar", '1.36.0') // the mta version + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*echo \\$JAVA_HOME.*', '/opt/sap/java') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*echo \\$MTA_JAR_LOCATION.*', '/opt/sap') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*echo \\$NEO_HOME.*', '/opt/sap/neo') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, ".*bin/java -version.*", '1.8.0') // the java version + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, ".*bin/java -jar .*mta.jar", '1.36.0') // the mta version // // there is a check for the mta.yaml file and for the deployable test.mtar file @@ -117,7 +117,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest { // // the mta build call: - assertThat(jscr.shell, hasItem( + assertThat(shellRule.shell, hasItem( allOf( containsString('java -jar /opt/sap/mta.jar'), containsString('--mtar test.mtar'), containsString('--build-target=NEO'), @@ -129,7 +129,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest { // // the neo deploy call: - assertThat(jscr.shell, hasItem('#!/bin/bash "/opt/sap/neo/tools/neo.sh" deploy-mta --source "test.mtar" ' + + assertThat(shellRule.shell, hasItem('#!/bin/bash "/opt/sap/neo/tools/neo.sh" deploy-mta --source "test.mtar" ' + '--host \'hana.example.com\' --account \'myTestAccount\' --synchronous ' + '--user \'foo\' --password \'terceSpot\'')) } diff --git a/test/groovy/GaugeExecuteTestsTest.groovy b/test/groovy/GaugeExecuteTestsTest.groovy index 7d181301e..fb7db3d4c 100644 --- a/test/groovy/GaugeExecuteTestsTest.groovy +++ b/test/groovy/GaugeExecuteTestsTest.groovy @@ -12,7 +12,7 @@ import static org.junit.Assert.assertThat class GaugeExecuteTestsTest extends BasePiperTest { private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this) private ExpectedException thrown = ExpectedException.none() @@ -20,7 +20,7 @@ class GaugeExecuteTestsTest extends BasePiperTest { public RuleChain rules = Rules .getCommonRules(this) .around(new JenkinsReadYamlRule(this)) - .around(jscr) + .around(shellRule) .around(jlr) .around(jer) .around(jsr) @@ -47,7 +47,7 @@ class GaugeExecuteTestsTest extends BasePiperTest { juStabUtils: utils, testServerUrl: 'http://test.url' ) - assertThat(jscr.shell, hasItem(stringContainsInOrder([ + assertThat(shellRule.shell, hasItem(stringContainsInOrder([ 'export HOME=${HOME:-$(pwd)}', 'if [ "$HOME" = "/" ]; then export HOME=$(pwd); fi', 'export PATH=$HOME/bin/gauge:$PATH', @@ -77,7 +77,7 @@ class GaugeExecuteTestsTest extends BasePiperTest { juStabUtils: utils, testOptions: 'testSpec' ) - assertThat(jscr.shell, hasItem(stringContainsInOrder([ + assertThat(shellRule.shell, hasItem(stringContainsInOrder([ 'gauge install js', 'gauge run testSpec' ]))) diff --git a/test/groovy/KarmaExecuteTestsTest.groovy b/test/groovy/KarmaExecuteTestsTest.groovy index d912c380f..95463d350 100644 --- a/test/groovy/KarmaExecuteTestsTest.groovy +++ b/test/groovy/KarmaExecuteTestsTest.groovy @@ -12,7 +12,7 @@ import static org.junit.Assert.assertThat class KarmaExecuteTestsTest extends BasePiperTest { private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this) private ExpectedException thrown = ExpectedException.none() @@ -20,7 +20,7 @@ class KarmaExecuteTestsTest extends BasePiperTest { public RuleChain rules = Rules .getCommonRules(this) .around(new JenkinsReadYamlRule(this)) - .around(jscr) + .around(shellRule) .around(jlr) .around(jer) .around(jsr) @@ -44,7 +44,7 @@ class KarmaExecuteTestsTest extends BasePiperTest { script: nullScript, juStabUtils: utils ) - assertThat(jscr.shell, hasItems( + assertThat(shellRule.shell, hasItems( containsString("cd '.' && npm install --quiet"), containsString("cd '.' && npm run karma") )) diff --git a/test/groovy/MailSendNotificationTest.groovy b/test/groovy/MailSendNotificationTest.groovy index 44cb7a8b8..57415e564 100644 --- a/test/groovy/MailSendNotificationTest.groovy +++ b/test/groovy/MailSendNotificationTest.groovy @@ -11,14 +11,14 @@ import static org.junit.Assert.assertThat class MailSendNotificationTest extends BasePiperTest { private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) @Rule public RuleChain ruleChain = Rules .getCommonRules(this) .around(new JenkinsReadYamlRule(this)) .around(jlr) - .around(jscr) + .around(shellRule) .around(jsr) @Before @@ -62,7 +62,7 @@ user3@domain.com noreply+github@domain.com''' def gitCommand = "git log -2 --pretty=format:'%ae %ce'" def expected = "user2@domain.com user3@domain.com" - jscr.setReturnValue("git log -2 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com') + shellRule.setReturnValue("git log -2 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com') def result = jsr.step.getCulprits( [ @@ -82,7 +82,7 @@ user3@domain.com noreply+github@domain.com''' @Test void testCulpritsWithEmptyGitCommit() throws Exception { - jscr.setReturnValue('git log > /dev/null 2>&1',1) + shellRule.setReturnValue('git log > /dev/null 2>&1',1) jsr.step.getCulprits( [ @@ -99,7 +99,7 @@ user3@domain.com noreply+github@domain.com''' @Test void testCulpritsWithoutGitCommit() throws Exception { - jscr.setReturnValue('git log > /dev/null 2>&1',1) + shellRule.setReturnValue('git log > /dev/null 2>&1',1) jsr.step.getCulprits( [ @@ -116,7 +116,7 @@ user3@domain.com noreply+github@domain.com''' @Test void testCulpritsWithoutBranch() throws Exception { - jscr.setReturnValue('git log > /dev/null 2>&1',1) + shellRule.setReturnValue('git log > /dev/null 2>&1',1) jsr.step.getCulprits( [ @@ -196,7 +196,7 @@ user3@domain.com noreply+github@domain.com''' return null }) - jscr.setReturnValue("git log -0 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com') + shellRule.setReturnValue("git log -0 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com') jsr.step.mailSendNotification( script: nullScript, @@ -226,7 +226,7 @@ user3@domain.com noreply+github@domain.com''' return null }) - jscr.setReturnValue("git log -0 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com') + shellRule.setReturnValue("git log -0 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com') jsr.step.mailSendNotification( script: nullScript, diff --git a/test/groovy/MavenExecuteTest.groovy b/test/groovy/MavenExecuteTest.groovy index f00865fcc..4db44d3d1 100644 --- a/test/groovy/MavenExecuteTest.groovy +++ b/test/groovy/MavenExecuteTest.groovy @@ -21,7 +21,7 @@ class MavenExecuteTest extends BasePiperTest { Map dockerParameters - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) @@ -30,7 +30,7 @@ class MavenExecuteTest extends BasePiperTest { .getCommonRules(this) .around(new JenkinsReadYamlRule(this)) .around(jder) - .around(jscr) + .around(shellRule) .around(jsr) @Test @@ -39,7 +39,7 @@ class MavenExecuteTest extends BasePiperTest { jsr.step.mavenExecute(script: nullScript, goals: 'clean install') assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage) - assert jscr.shell[0] == 'mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install' + assert shellRule.shell[0] == 'mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install' } @Test @@ -48,7 +48,7 @@ class MavenExecuteTest extends BasePiperTest { jsr.step.mavenExecute(script: nullScript, goals: 'clean install', logSuccessfulMavenTransfers: true) assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage) - assert jscr.shell[0] == 'mvn --batch-mode clean install' + assert shellRule.shell[0] == 'mvn --batch-mode clean install' } @Test @@ -66,7 +66,7 @@ class MavenExecuteTest extends BasePiperTest { defines: '-Dmaven.tests.skip=true') assertEquals('maven:3.5-jdk-8-alpine', jder.dockerParams.dockerImage) String mvnCommand = "mvn --global-settings 'globalSettingsFile.xml' -Dmaven.repo.local='m2Path' --settings 'projectSettingsFile.xml' --file 'pom.xml' -o --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install -Dmaven.tests.skip=true" - assertTrue(jscr.shell.contains(mvnCommand)) + assertTrue(shellRule.shell.contains(mvnCommand)) } @Test @@ -74,7 +74,7 @@ class MavenExecuteTest extends BasePiperTest { jsr.step.mavenExecute(script: nullScript, goals: 'clean install') assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage) - assertEquals('mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install', jscr.shell[0]) + assertEquals('mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install', shellRule.shell[0]) } @Test @@ -82,7 +82,7 @@ class MavenExecuteTest extends BasePiperTest { jsr.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-B') assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage) - assertEquals('mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install', jscr.shell[0]) + assertEquals('mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install', shellRule.shell[0]) } @Test @@ -90,7 +90,7 @@ class MavenExecuteTest extends BasePiperTest { jsr.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-Blah') assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage) - assertThat(jscr.shell[0], + assertThat(shellRule.shell[0], allOf(containsString('-Blah'), containsString('--batch-mode'))) } @@ -99,6 +99,6 @@ class MavenExecuteTest extends BasePiperTest { void testMavenCommandWithBatchModeMultiline() throws Exception { jsr.step.mavenExecute(script: nullScript, goals: 'clean install', flags: ('''-B\\ |--show-version''' as CharSequence).stripMargin()) - assertThat(jscr.shell[0], not(containsString('--batch-mode'))) + assertThat(shellRule.shell[0], not(containsString('--batch-mode'))) } } diff --git a/test/groovy/MtaBuildTest.groovy b/test/groovy/MtaBuildTest.groovy index a40a52b35..fe0c307e3 100644 --- a/test/groovy/MtaBuildTest.groovy +++ b/test/groovy/MtaBuildTest.groovy @@ -22,7 +22,7 @@ public class MtaBuildTest extends BasePiperTest { private ExpectedException thrown = new ExpectedException() private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this).registerYaml('mta.yaml', defaultMtaYaml() ) @@ -33,7 +33,7 @@ public class MtaBuildTest extends BasePiperTest { .around(jryr) .around(thrown) .around(jlr) - .around(jscr) + .around(shellRule) .around(jder) .around(jsr) @@ -42,13 +42,13 @@ public class MtaBuildTest extends BasePiperTest { helper.registerAllowedMethod('fileExists', [String], { s -> s == 'mta.yaml' }) - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$MTA_JAR_LOCATION.*', '') - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$JAVA_HOME.*', '') - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*which java.*', 0) - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*java -version.*', '''openjdk version \"1.8.0_121\" + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$MTA_JAR_LOCATION.*', '') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$JAVA_HOME.*', '') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*which java.*', 0) + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*java -version.*', '''openjdk version \"1.8.0_121\" OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-1~bpo8+1-b13) OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)''') - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*mta\\.jar -v.*', '1.0.6') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*mta\\.jar -v.*', '1.0.6') binding.setVariable('PATH', '/usr/bin') } @@ -59,7 +59,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO') - assert jscr.shell.find { c -> c.contains('PATH=./node_modules/.bin:/usr/bin')} + assert shellRule.shell.find { c -> c.contains('PATH=./node_modules/.bin:/usr/bin')} } @@ -68,7 +68,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO') - assert jscr.shell.find { c -> c =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" "mta.yaml"$/} + assert shellRule.shell.find { c -> c =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" "mta.yaml"$/} } @@ -88,7 +88,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, mtaJarLocation: '/mylocation/mta/mta.jar', buildTarget: 'NEO') - assert jscr.shell.find { c -> c.contains('-jar /mylocation/mta/mta.jar --mtar')} + assert shellRule.shell.find { c -> c.contains('-jar /mylocation/mta/mta.jar --mtar')} assert jlr.log.contains("SAP Multitarget Application Archive Builder file '/mylocation/mta/mta.jar' retrieved from configuration.") assert jlr.log.contains("Using SAP Multitarget Application Archive Builder '/mylocation/mta/mta.jar'.") @@ -133,11 +133,11 @@ public class MtaBuildTest extends BasePiperTest { @Test void mtaJarLocationFromEnvironmentTest() { - jscr.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$MTA_JAR_LOCATION.*', '/env/mta/mta.jar') + shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$MTA_JAR_LOCATION.*', '/env/mta/mta.jar') jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO') - assert jscr.shell.find { c -> c.contains("-jar /env/mta/mta.jar --mtar")} + assert shellRule.shell.find { c -> c.contains("-jar /env/mta/mta.jar --mtar")} assert jlr.log.contains("SAP Multitarget Application Archive Builder file '/env/mta/mta.jar' retrieved from environment.") assert jlr.log.contains("Using SAP Multitarget Application Archive Builder '/env/mta/mta.jar'.") } @@ -151,7 +151,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO') - assert jscr.shell.find(){ c -> c.contains("-jar /config/mta/mta.jar --mtar")} + assert shellRule.shell.find(){ c -> c.contains("-jar /config/mta/mta.jar --mtar")} assert jlr.log.contains("SAP Multitarget Application Archive Builder file '/config/mta/mta.jar' retrieved from configuration.") assert jlr.log.contains("Using SAP Multitarget Application Archive Builder '/config/mta/mta.jar'.") } @@ -163,7 +163,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO') - assert jscr.shell.find(){ c -> c.contains("-jar mta.jar --mtar")} + assert shellRule.shell.find(){ c -> c.contains("-jar mta.jar --mtar")} assert jlr.log.contains("SAP Multitarget Application Archive Builder file 'mta.jar' retrieved from configuration.") assert jlr.log.contains("Using SAP Multitarget Application Archive Builder 'mta.jar'.") } @@ -174,7 +174,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO') - assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')} + assert shellRule.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')} } @@ -185,7 +185,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript) - assert jscr.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')} + assert shellRule.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')} } @Test @@ -211,7 +211,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript) - assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')} + assert shellRule.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')} } @@ -220,7 +220,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO', extension: 'param_extension') - assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=param_extension build')} + assert shellRule.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=param_extension build')} } @@ -231,7 +231,7 @@ public class MtaBuildTest extends BasePiperTest { jsr.step.mtaBuild(script: nullScript) - assert jscr.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=config_extension build')} + assert shellRule.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=config_extension build')} } diff --git a/test/groovy/NeoDeployTest.groovy b/test/groovy/NeoDeployTest.groovy index 3041998d0..970ba4c29 100644 --- a/test/groovy/NeoDeployTest.groovy +++ b/test/groovy/NeoDeployTest.groovy @@ -36,7 +36,7 @@ class NeoDeployTest extends BasePiperTest { private ExpectedException thrown = new ExpectedException().none() private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) @Rule @@ -45,7 +45,7 @@ class NeoDeployTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) .around(thrown) .around(jlr) - .around(jscr) + .around(shellRule) .around(new JenkinsCredentialsRule(this) .withCredentials('myCredentialsId', 'anonymous', '********') .withCredentials('CI_CREDENTIALS_ID', 'defaultUser', '********')) @@ -105,7 +105,7 @@ class NeoDeployTest extends BasePiperTest { utils: utils ) - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'trialuser123') @@ -162,7 +162,7 @@ class NeoDeployTest extends BasePiperTest { utils: utils, ) - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'trialuser123') @@ -188,7 +188,7 @@ class NeoDeployTest extends BasePiperTest { neoCredentialsId: 'myCredentialsId' ) - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasSingleQuotedOption('host', 'configuration-frwk\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'configurationFrwkUser123') @@ -203,7 +203,7 @@ class NeoDeployTest extends BasePiperTest { nullScript.commonPipelineEnvironment.setMtarFilePath('archive.mtar') jsr.step.neoDeploy(script: nullScript) - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasDoubleQuotedOption('source', 'archive.mtar')) } @@ -214,7 +214,7 @@ class NeoDeployTest extends BasePiperTest { jsr.step.neoDeploy(script: nullScript, archivePath: "archive.mtar") - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasDoubleQuotedOption('source', 'archive.mtar')) } @@ -239,7 +239,7 @@ class NeoDeployTest extends BasePiperTest { archivePath: archiveName ) - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'trialuser123') @@ -259,7 +259,7 @@ class NeoDeployTest extends BasePiperTest { archivePath: archiveName ) - assert jscr.shell.find { c -> c.contains('"neo.sh" deploy-mta') } + assert shellRule.shell.find { c -> c.contains('"neo.sh" deploy-mta') } assert jlr.log.contains('SAP Cloud Platform Console Client is on PATH.') assert jlr.log.contains("Using SAP Cloud Platform Console Client 'neo.sh'.") } @@ -276,7 +276,7 @@ class NeoDeployTest extends BasePiperTest { neoHome: '/param/neo' ) - assert jscr.shell.find{ c -> c = "\"/param/neo/tools/neo.sh\" deploy-mta" } + assert shellRule.shell.find{ c -> c = "\"/param/neo/tools/neo.sh\" deploy-mta" } assert jlr.log.contains("SAP Cloud Platform Console Client home '/param/neo' retrieved from configuration.") assert jlr.log.contains("Using SAP Cloud Platform Console Client '/param/neo/tools/neo.sh'.") } @@ -289,7 +289,7 @@ class NeoDeployTest extends BasePiperTest { archivePath: archiveName ) - assert jscr.shell.find { c -> c.contains("\"/opt/neo/tools/neo.sh\" deploy-mta")} + assert shellRule.shell.find { c -> c.contains("\"/opt/neo/tools/neo.sh\" deploy-mta")} assert jlr.log.contains("SAP Cloud Platform Console Client home '/opt/neo' retrieved from environment.") assert jlr.log.contains("Using SAP Cloud Platform Console Client '/opt/neo/tools/neo.sh'.") } @@ -306,7 +306,7 @@ class NeoDeployTest extends BasePiperTest { archivePath: archiveName ) - assert jscr.shell.find { c -> c = "\"/config/neo/tools/neo.sh\" deploy-mta"} + assert shellRule.shell.find { c -> c = "\"/config/neo/tools/neo.sh\" deploy-mta"} assert jlr.log.contains("SAP Cloud Platform Console Client home '/config/neo' retrieved from configuration.") assert jlr.log.contains("Using SAP Cloud Platform Console Client '/config/neo/tools/neo.sh'.") } @@ -349,7 +349,7 @@ class NeoDeployTest extends BasePiperTest { jsr.step.neoDeploy(script: nullScript, archivePath: archiveName, deployMode: 'mta') - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta") .hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'trialuser123') @@ -372,7 +372,7 @@ class NeoDeployTest extends BasePiperTest { warAction: 'deploy', archivePath: warArchiveName) - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy") .hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'trialuser123') @@ -398,7 +398,7 @@ class NeoDeployTest extends BasePiperTest { warAction: 'rolling-update', vmSize: 'lite') - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" rolling-update") .hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com') .hasSingleQuotedOption('account', 'trialuser123') @@ -424,7 +424,7 @@ class NeoDeployTest extends BasePiperTest { warAction: 'deploy', vmSize: 'lite') - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy") .hasArgument("config.properties") .hasSingleQuotedOption('user', 'defaultUser') @@ -445,7 +445,7 @@ class NeoDeployTest extends BasePiperTest { warAction: 'rolling-update', vmSize: 'lite') - Assert.assertThat(jscr.shell, + Assert.assertThat(shellRule.shell, new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" rolling-update") .hasArgument('config.properties') .hasSingleQuotedOption('user', 'defaultUser') diff --git a/test/groovy/NewmanExecuteTest.groovy b/test/groovy/NewmanExecuteTest.groovy index 2a4f9c0d4..8ad8adaff 100644 --- a/test/groovy/NewmanExecuteTest.groovy +++ b/test/groovy/NewmanExecuteTest.groovy @@ -24,7 +24,7 @@ class NewmanExecuteTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this) @Rule @@ -33,7 +33,7 @@ class NewmanExecuteTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) .around(thrown) .around(jedr) - .around(jscr) + .around(shellRule) .around(jlr) .around(jsr) // needs to be activated after jedr, otherwise executeDocker is not mocked @@ -70,8 +70,8 @@ class NewmanExecuteTest extends BasePiperTest { newmanGlobals: 'testGlobals' ) // asserts - assertThat(jscr.shell, hasItem(endsWith('npm install newman newman-reporter-html --global --quiet'))) - assertThat(jscr.shell, hasItem(endsWith('newman run \'testCollection\' --environment \'testEnvironment\' --globals \'testGlobals\' --reporters junit,html --reporter-junit-export \'target/newman/TEST-testCollection.xml\' --reporter-html-export \'target/newman/TEST-testCollection.html\''))) + assertThat(shellRule.shell, hasItem(endsWith('npm install newman newman-reporter-html --global --quiet'))) + assertThat(shellRule.shell, hasItem(endsWith('newman run \'testCollection\' --environment \'testEnvironment\' --globals \'testGlobals\' --reporters junit,html --reporter-junit-export \'target/newman/TEST-testCollection.xml\' --reporter-html-export \'target/newman/TEST-testCollection.html\''))) assertThat(jedr.dockerParams.dockerImage, is('node:8-stretch')) assertThat(jlr.log, containsString('[newmanExecute] Found files [testCollection]')) assertJobStatusSuccess() @@ -87,8 +87,8 @@ class NewmanExecuteTest extends BasePiperTest { newmanGlobals: 'testGlobals' ) // asserts - assertThat(jscr.shell, hasItem(startsWith('NPM_CONFIG_PREFIX=~/.npm-global '))) - assertThat(jscr.shell, hasItem(startsWith('PATH=$PATH:~/.npm-global/bin'))) + assertThat(shellRule.shell, hasItem(startsWith('NPM_CONFIG_PREFIX=~/.npm-global '))) + assertThat(shellRule.shell, hasItem(startsWith('PATH=$PATH:~/.npm-global/bin'))) assertJobStatusSuccess() } @@ -120,7 +120,7 @@ class NewmanExecuteTest extends BasePiperTest { // asserts assertThat(jedr.dockerParams.dockerImage, is('testImage')) assertThat(gitMap.url, is('testRepo')) - assertThat(jscr.shell, hasItem(endsWith('newman run \'testCollection\' --environment \'testEnvironment\' --globals \'testGlobals\' --reporters junit,html --reporter-junit-export \'target/newman/TEST-testCollection.xml\' --reporter-html-export \'target/newman/TEST-testCollection.html\' --suppress-exit-code'))) + assertThat(shellRule.shell, hasItem(endsWith('newman run \'testCollection\' --environment \'testEnvironment\' --globals \'testGlobals\' --reporters junit,html --reporter-junit-export \'target/newman/TEST-testCollection.xml\' --reporter-html-export \'target/newman/TEST-testCollection.html\' --suppress-exit-code'))) assertJobStatusSuccess() } @@ -132,8 +132,8 @@ class NewmanExecuteTest extends BasePiperTest { newmanRunCommand: 'run ${config.newmanCollection} --iteration-data testDataFile --reporters junit,html --reporter-junit-export target/newman/TEST-${config.newmanCollection.toString().replace(File.separatorChar,(char)\'_\').tokenize(\'.\').first()}.xml --reporter-html-export target/newman/TEST-${config.newmanCollection.toString().replace(File.separatorChar,(char)\'_\').tokenize(\'.\').first()}.html' ) // asserts - assertThat(jscr.shell, hasItem(endsWith('newman run testCollectionsFolder'+File.separatorChar+'A.postman_collection.json --iteration-data testDataFile --reporters junit,html --reporter-junit-export target/newman/TEST-testCollectionsFolder_A.xml --reporter-html-export target/newman/TEST-testCollectionsFolder_A.html'))) - assertThat(jscr.shell, hasItem(endsWith('newman run testCollectionsFolder'+File.separatorChar+'B.postman_collection.json --iteration-data testDataFile --reporters junit,html --reporter-junit-export target/newman/TEST-testCollectionsFolder_B.xml --reporter-html-export target/newman/TEST-testCollectionsFolder_B.html'))) + assertThat(shellRule.shell, hasItem(endsWith('newman run testCollectionsFolder'+File.separatorChar+'A.postman_collection.json --iteration-data testDataFile --reporters junit,html --reporter-junit-export target/newman/TEST-testCollectionsFolder_A.xml --reporter-html-export target/newman/TEST-testCollectionsFolder_A.html'))) + assertThat(shellRule.shell, hasItem(endsWith('newman run testCollectionsFolder'+File.separatorChar+'B.postman_collection.json --iteration-data testDataFile --reporters junit,html --reporter-junit-export target/newman/TEST-testCollectionsFolder_B.xml --reporter-html-export target/newman/TEST-testCollectionsFolder_B.html'))) assertJobStatusSuccess() } } diff --git a/test/groovy/PipelineStashFilesBeforeBuildTest.groovy b/test/groovy/PipelineStashFilesBeforeBuildTest.groovy index 6b81bc4d7..b88695057 100644 --- a/test/groovy/PipelineStashFilesBeforeBuildTest.groovy +++ b/test/groovy/PipelineStashFilesBeforeBuildTest.groovy @@ -9,7 +9,7 @@ import static org.junit.Assert.* class PipelineStashFilesBeforeBuildTest extends BasePiperTest { JenkinsStepRule jsr = new JenkinsStepRule(this) JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) //JenkinsReadJsonRule jrj = new JenkinsReadJsonRule(this) @Rule @@ -18,7 +18,7 @@ class PipelineStashFilesBeforeBuildTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) //.around(jrj) .around(jlr) - .around(jscr) + .around(shellRule) .around(jsr) @Test @@ -27,9 +27,9 @@ class PipelineStashFilesBeforeBuildTest extends BasePiperTest { jsr.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils) // asserts - assertEquals('mkdir -p gitmetadata', jscr.shell[0]) - assertEquals('cp -rf .git/* gitmetadata', jscr.shell[1]) - assertEquals('chmod -R u+w gitmetadata', jscr.shell[2]) + assertEquals('mkdir -p gitmetadata', shellRule.shell[0]) + assertEquals('cp -rf .git/* gitmetadata', shellRule.shell[1]) + assertEquals('chmod -R u+w gitmetadata', shellRule.shell[2]) assertThat(jlr.log, containsString('Stash content: buildDescriptor')) assertThat(jlr.log, containsString('Stash content: deployDescriptor')) diff --git a/test/groovy/SeleniumExecuteTestsTest.groovy b/test/groovy/SeleniumExecuteTestsTest.groovy index 88dfb151a..978837487 100644 --- a/test/groovy/SeleniumExecuteTestsTest.groovy +++ b/test/groovy/SeleniumExecuteTestsTest.groovy @@ -13,7 +13,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsStepRule jsr = new JenkinsStepRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this) @Rule diff --git a/test/groovy/SnykExecuteTest.groovy b/test/groovy/SnykExecuteTest.groovy index 8355eabac..571b74248 100644 --- a/test/groovy/SnykExecuteTest.groovy +++ b/test/groovy/SnykExecuteTest.groovy @@ -20,7 +20,7 @@ import util.Rules class SnykExecuteTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) private JenkinsStepRule jsr = new JenkinsStepRule(this) @@ -30,7 +30,7 @@ class SnykExecuteTest extends BasePiperTest { .around(new JenkinsReadYamlRule(this)) .around(thrown) .around(jder) - .around(jscr) + .around(shellRule) .around(jlr) .around(jsr) @@ -101,9 +101,9 @@ class SnykExecuteTest extends BasePiperTest { juStabUtils: utils ) // asserts - assertThat(jscr.shell, hasItem('npm install snyk --global --quiet')) - assertThat(jscr.shell, hasItem('cd \'./\' && npm install --quiet')) - assertThat(jscr.shell, hasItem('cd \'./\' && snyk monitor && snyk test')) + assertThat(shellRule.shell, hasItem('npm install snyk --global --quiet')) + assertThat(shellRule.shell, hasItem('cd \'./\' && npm install --quiet')) + assertThat(shellRule.shell, hasItem('cd \'./\' && snyk monitor && snyk test')) } @Test @@ -115,7 +115,7 @@ class SnykExecuteTest extends BasePiperTest { toJson: true ) // asserts - assertThat(jscr.shell, hasItem("cd './' && snyk monitor --org=myOrg && snyk test --json > snyk.json".toString())) + assertThat(shellRule.shell, hasItem("cd './' && snyk monitor --org=myOrg && snyk test --json > snyk.json".toString())) assertThat(archiveStepPatterns, hasItem('snyk.json')) } @@ -127,7 +127,7 @@ class SnykExecuteTest extends BasePiperTest { scanType: 'mta' ) // asserts - assertThat(jscr.shell, hasItem("cd 'some-ui${File.separator}' && snyk monitor && snyk test".toString())) - assertThat(jscr.shell, hasItem("cd 'some-service-broker${File.separator}' && snyk monitor && snyk test".toString())) + assertThat(shellRule.shell, hasItem("cd 'some-ui${File.separator}' && snyk monitor && snyk test".toString())) + assertThat(shellRule.shell, hasItem("cd 'some-service-broker${File.separator}' && snyk monitor && snyk test".toString())) } } diff --git a/test/groovy/com/sap/piper/GitUtilsTest.groovy b/test/groovy/com/sap/piper/GitUtilsTest.groovy index 97ce0b201..53b83a1ce 100644 --- a/test/groovy/com/sap/piper/GitUtilsTest.groovy +++ b/test/groovy/com/sap/piper/GitUtilsTest.groovy @@ -33,36 +33,36 @@ class GitUtilsTest extends BasePiperTest { GitUtils gitUtils private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) private ExpectedException thrown = ExpectedException.none() @Rule public RuleChain ruleChain = Rules.getCommonRules(this) .around(jlr) - .around(jscr) + .around(shellRule) .around(thrown) @Before void init() throws Exception { - jscr.setReturnValue('git rev-parse HEAD', 'testCommitId') + shellRule.setReturnValue('git rev-parse HEAD', 'testCommitId') } @Test void TestIsInsideWorkTree() { - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) assertTrue(gitUtils.insideWorkTree()) } @Test void TestIsNotInsideWorkTree() { - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 1) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 1) assertFalse(gitUtils.insideWorkTree()) } @Test void testWorkTreeDirty() { - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) - jscr.setReturnValue('git diff --quiet HEAD', 0) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) + shellRule.setReturnValue('git diff --quiet HEAD', 0) assertFalse(gitUtils.isWorkTreeDirty()) } @@ -70,14 +70,14 @@ class GitUtilsTest extends BasePiperTest { void testWorkTreeDirtyOutsideWorktree() { thrown.expect(AbortException) thrown.expectMessage('Method \'isWorkTreeClean\' called outside a git work tree.') - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 1) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 1) gitUtils.isWorkTreeDirty() } @Test void testWorkTreeNotDirty() { - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) - jscr.setReturnValue('git diff --quiet HEAD', 1) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) + shellRule.setReturnValue('git diff --quiet HEAD', 1) assertTrue(gitUtils.isWorkTreeDirty()) } @@ -85,27 +85,27 @@ class GitUtilsTest extends BasePiperTest { void testWorkTreeDirtyGeneralGitTrouble() { thrown.expect(AbortException) thrown.expectMessage('git command \'git diff --quiet HEAD\' return with code \'129\'. This indicates general trouble with git.') - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) - jscr.setReturnValue('git diff --quiet HEAD', 129) // e.g. when called outside work tree + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) + shellRule.setReturnValue('git diff --quiet HEAD', 129) // e.g. when called outside work tree gitUtils.isWorkTreeDirty() } @Test void testGetGitCommitId() { - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0) assertEquals('testCommitId', gitUtils.getGitCommitIdOrNull()) } @Test void testGetGitCommitIdNotAGitRepo() { - jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 128) + shellRule.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 128) assertNull(gitUtils.getGitCommitIdOrNull()) } @Test void testExtractLogLinesWithDefaults() { gitUtils.extractLogLines() - assertTrue(jscr.shell + assertTrue(shellRule.shell .stream() .anyMatch( { it -> it.contains('git log --pretty=format:%b origin/master..HEAD')})) @@ -114,7 +114,7 @@ class GitUtilsTest extends BasePiperTest { @Test void testExtractLogLinesWithCustomValues() { gitUtils.extractLogLines('myFilter', 'HEAD~5', 'HEAD~1', '%B') - assertTrue( jscr.shell + assertTrue( shellRule.shell .stream() .anyMatch( { it -> it.contains('git log --pretty=format:%B HEAD~5..HEAD~1')})) @@ -122,7 +122,7 @@ class GitUtilsTest extends BasePiperTest { @Test void testExtractLogLinesFilter() { - jscr.setReturnValue('#!/bin/bash git log --pretty=format:%b origin/master..HEAD', 'abc\n123') + shellRule.setReturnValue('#!/bin/bash git log --pretty=format:%b origin/master..HEAD', 'abc\n123') String[] log = gitUtils.extractLogLines('12.*') assertThat(log, is(notNullValue())) assertThat(log.size(),is(equalTo(1))) @@ -131,7 +131,7 @@ class GitUtilsTest extends BasePiperTest { @Test void testExtractLogLinesFilterNoMatch() { - jscr.setReturnValue('#!/bin/bash git log --pretty=format:%b origin/master..HEAD', 'abc\n123') + shellRule.setReturnValue('#!/bin/bash git log --pretty=format:%b origin/master..HEAD', 'abc\n123') String[] log = gitUtils.extractLogLines('xyz') assertNotNull(log) assertThat(log.size(),is(equalTo(0))) diff --git a/test/groovy/com/sap/piper/JenkinsUtilsTest.groovy b/test/groovy/com/sap/piper/JenkinsUtilsTest.groovy index 7559fe0c3..ee122c986 100644 --- a/test/groovy/com/sap/piper/JenkinsUtilsTest.groovy +++ b/test/groovy/com/sap/piper/JenkinsUtilsTest.groovy @@ -16,18 +16,18 @@ import static org.junit.Assert.assertThat class JenkinsUtilsTest extends BasePiperTest { private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) @Rule public RuleChain rules = Rules .getCommonRules(this) - .around(jscr) + .around(shellRule) .around(jlr) @Test void testNodeAvailable() { def result = jenkinsUtils.nodeAvailable() - assertThat(jscr.shell, contains("echo 'Node is available!'")) + assertThat(shellRule.shell, contains("echo 'Node is available!'")) assertThat(result, is(true)) } diff --git a/test/groovy/com/sap/piper/UtilsTest.groovy b/test/groovy/com/sap/piper/UtilsTest.groovy index 928d45c6e..da17fb7cb 100644 --- a/test/groovy/com/sap/piper/UtilsTest.groovy +++ b/test/groovy/com/sap/piper/UtilsTest.groovy @@ -22,13 +22,13 @@ import com.sap.piper.Utils class UtilsTest extends BasePiperTest { private ExpectedException thrown = ExpectedException.none() private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) - private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) @Rule public RuleChain rules = Rules .getCommonRules(this) .around(thrown) - .around(jscr) + .around(shellRule) .around(jlr) private parameters @@ -67,10 +67,10 @@ class UtilsTest extends BasePiperTest { utils.env = [BUILD_URL: 'something', JOB_URL: 'nothing'] utils.pushToSWA([step: 'anything'], [collectTelemetryData: true]) // asserts - assertThat(jscr.shell, hasItem(containsString('curl -G -v "https://webanalytics.cfapps.eu10.hana.ondemand.com/tracker/log"'))) - assertThat(jscr.shell, hasItem(containsString('action_name=Piper Library OS'))) - assertThat(jscr.shell, hasItem(containsString('custom3=anything'))) - assertThat(jscr.shell, hasItem(containsString('custom5=`echo -n \'something\' | sha1sum | sed \'s/ -//\'`'))) + assertThat(shellRule.shell, hasItem(containsString('curl -G -v "https://webanalytics.cfapps.eu10.hana.ondemand.com/tracker/log"'))) + assertThat(shellRule.shell, hasItem(containsString('action_name=Piper Library OS'))) + assertThat(shellRule.shell, hasItem(containsString('custom3=anything'))) + assertThat(shellRule.shell, hasItem(containsString('custom5=`echo -n \'something\' | sha1sum | sed \'s/ -//\'`'))) } @Test @@ -79,7 +79,7 @@ class UtilsTest extends BasePiperTest { utils.pushToSWA([step: 'anything'], [collectTelemetryData: false]) // asserts assertThat(jlr.log, containsString('[anything] Telemetry Report to SWA disabled!')) - assertThat(jscr.shell, not(hasItem(containsString('https://webanalytics.cfapps.eu10.hana.ondemand.com')))) + assertThat(shellRule.shell, not(hasItem(containsString('https://webanalytics.cfapps.eu10.hana.ondemand.com')))) } @Test diff --git a/test/groovy/com/sap/piper/versioning/MavenArtifactVersioningTest.groovy b/test/groovy/com/sap/piper/versioning/MavenArtifactVersioningTest.groovy index 851b0e7d9..b54b45770 100644 --- a/test/groovy/com/sap/piper/versioning/MavenArtifactVersioningTest.groovy +++ b/test/groovy/com/sap/piper/versioning/MavenArtifactVersioningTest.groovy @@ -20,13 +20,13 @@ class MavenArtifactVersioningTest extends BasePiperTest{ MavenArtifactVersioning av - JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) @Rule public RuleChain ruleChain = Rules .getCommonRules(this) .around(new JenkinsReadYamlRule(this)) - .around(jscr) + .around(shellRule) .around(new JenkinsReadMavenPomRule(this, 'test/resources/versioning/MavenArtifactVersioning')) @Before @@ -45,7 +45,7 @@ class MavenArtifactVersioningTest extends BasePiperTest{ av = new MavenArtifactVersioning(nullScript, [filePath: 'pom.xml']) assertEquals('1.2.3', av.getVersion()) av.setVersion('1.2.3-20180101') - assertEquals('mvn --file \'pom.xml\' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101 -DgenerateBackupPoms=false', jscr.shell[0]) + assertEquals('mvn --file \'pom.xml\' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101 -DgenerateBackupPoms=false', shellRule.shell[0]) } @Test @@ -53,6 +53,6 @@ class MavenArtifactVersioningTest extends BasePiperTest{ av = new MavenArtifactVersioning(nullScript, [filePath: 'snapshot/pom.xml']) assertEquals('1.2.3', av.getVersion()) av.setVersion('1.2.3-20180101') - assertEquals('mvn --file \'snapshot/pom.xml\' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101 -DgenerateBackupPoms=false', jscr.shell[0]) + assertEquals('mvn --file \'snapshot/pom.xml\' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101 -DgenerateBackupPoms=false', shellRule.shell[0]) } } diff --git a/test/groovy/com/sap/piper/versioning/MtaArtifactVersioningTest.groovy b/test/groovy/com/sap/piper/versioning/MtaArtifactVersioningTest.groovy index f6a98ed3e..ab009cdd7 100644 --- a/test/groovy/com/sap/piper/versioning/MtaArtifactVersioningTest.groovy +++ b/test/groovy/com/sap/piper/versioning/MtaArtifactVersioningTest.groovy @@ -12,19 +12,19 @@ import static org.junit.Assert.assertEquals class MtaArtifactVersioningTest extends BasePiperTest{ - JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this) @Rule public RuleChain ruleChain = Rules .getCommonRules(this) .around(new JenkinsReadYamlRule(this).registerYaml('mta.yaml', "version: '1.2.3'")) - .around(jscr) + .around(shellRule) @Test void testVersioning() { MtaArtifactVersioning av = new MtaArtifactVersioning(nullScript, [filePath: 'mta.yaml']) assertEquals('1.2.3', av.getVersion()) av.setVersion('1.2.3-20180101') - assertEquals("sed -i 's/version: 1.2.3/version: 1.2.3-20180101/g' mta.yaml", jscr.shell[0]) + assertEquals("sed -i 's/version: 1.2.3/version: 1.2.3-20180101/g' mta.yaml", shellRule.shell[0]) } }