1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-21 19:48:53 +02:00

Better readable rule names: stepRule

This commit is contained in:
Marcus Holl 2019-01-22 09:25:42 +01:00
parent 9b1397e998
commit b486f32dc1
34 changed files with 309 additions and 309 deletions

View File

@ -50,7 +50,7 @@ class ArtifactSetVersionTest extends BasePiperTest {
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this)
@Rule
@ -63,7 +63,7 @@ class ArtifactSetVersionTest extends BasePiperTest {
.around(new JenkinsReadMavenPomRule(this, 'test/resources/versioning/MavenArtifactVersioning'))
.around(jwfr)
.around(jder)
.around(jsr)
.around(stepRule)
.around(jer)
@Before
@ -86,7 +86,7 @@ class ArtifactSetVersionTest extends BasePiperTest {
@Test
void testVersioning() {
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', gitSshUrl: 'myGitSshUrl')
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'maven', gitSshUrl: 'myGitSshUrl')
assertEquals('1.2.3-20180101010203_testCommitId', jer.env.getArtifactVersion())
assertEquals('testCommitId', jer.env.getGitCommitId())
@ -103,7 +103,7 @@ class ArtifactSetVersionTest extends BasePiperTest {
@Test
void testVersioningWithoutCommit() {
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', commitVersion: false)
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'maven', commitVersion: false)
assertEquals('1.2.3-20180101010203_testCommitId', jer.env.getArtifactVersion())
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"))
@ -112,14 +112,14 @@ class ArtifactSetVersionTest extends BasePiperTest {
@Test
void testVersioningCustomGitUserAndEMail() {
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', gitSshUrl: 'myGitSshUrl', gitUserEMail: 'test@test.com', gitUserName: 'test')
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'maven', gitSshUrl: 'myGitSshUrl', gitUserEMail: 'test@test.com', gitUserName: 'test')
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
void testVersioningWithTimestamp() {
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', timestamp: '2018')
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'maven', timestamp: '2018')
assertEquals('1.2.3-2018_testCommitId', jer.env.getArtifactVersion())
}
@ -127,12 +127,12 @@ class ArtifactSetVersionTest extends BasePiperTest {
void testVersioningNoBuildTool() {
thrown.expect(Exception)
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR buildTool')
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils)
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils)
}
@Test
void testVersioningWithCustomTemplate() {
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'maven', versioningTemplate: '${version}-xyz')
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'maven', versioningTemplate: '${version}-xyz')
assertEquals('1.2.3-xyz', jer.env.getArtifactVersion())
}
@ -140,14 +140,14 @@ class ArtifactSetVersionTest extends BasePiperTest {
void testVersioningWithTypeAppContainer() {
nullScript.commonPipelineEnvironment.setAppContainerProperty('gitSshUrl', 'git@test.url')
jer.env.setArtifactVersion('1.2.3-xyz')
jsr.step.artifactSetVersion(script: jsr.step, juStabGitUtils: gitUtils, buildTool: 'docker', artifactType: 'appContainer', dockerVersionSource: 'appVersion')
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'docker', artifactType: 'appContainer', dockerVersionSource: 'appVersion')
assertEquals('1.2.3-xyz', jer.env.getArtifactVersion())
assertEquals('1.2.3-xyz', jwfr.files['VERSION'])
}
@Test
void testCredentialCompatibility() {
jsr.step.artifactSetVersion (
stepRule.step.artifactSetVersion (
script: nullScript,
buildTool: 'maven',
gitCredentialsId: 'testCredentials',

View File

@ -13,7 +13,7 @@ import static org.junit.Assert.assertThat
class BatsExecuteTestsTest extends BasePiperTest {
private ExpectedException thrown = ExpectedException.none()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
@ -26,7 +26,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
.around(jder)
.around(shellRule)
.around(loggingRule)
.around(jsr)
.around(stepRule)
List withEnvArgs = []
@ -43,7 +43,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
@Test
void testDefault() {
nullScript.commonPipelineEnvironment.configuration = [general: [container: 'test-container']]
jsr.step.batsExecuteTests(
stepRule.step.batsExecuteTests(
script: nullScript,
juStabUtils: utils,
dockerContainerName: 'test-container',
@ -72,7 +72,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
@Test
void testTap() {
jsr.step.batsExecuteTests(
stepRule.step.batsExecuteTests(
script: nullScript,
juStabUtils: utils,
outputFormat: 'tap'
@ -90,7 +90,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
}
})
thrown.expectMessage('Shell call failed')
jsr.step.batsExecuteTests(
stepRule.step.batsExecuteTests(
script: nullScript,
juStabUtils: utils,
failOnError: true,
@ -108,7 +108,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
assertThat(s, startsWith('testContent-'))
})
jsr.step.batsExecuteTests(
stepRule.step.batsExecuteTests(
script: nullScript,
juStabUtils: utils,
testRepository: 'testRepo',
@ -129,7 +129,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
assertThat(s, startsWith('testContent-'))
})
jsr.step.batsExecuteTests(
stepRule.step.batsExecuteTests(
script: nullScript,
juStabUtils: utils,
gitBranch: 'test',

View File

@ -19,7 +19,7 @@ import util.Rules
class CheckChangeInDevelopmentTest extends BasePiperTest {
private ExpectedException thrown = ExpectedException.none()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
@Rule
@ -27,7 +27,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(jsr)
.around(stepRule)
.around(loggingRule)
.around(new JenkinsCredentialsRule(this)
.withCredentials('CM', 'anonymous', '********'))
@ -43,7 +43,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
public void changeIsInStatusDevelopmentTest() {
ChangeManagement cm = getChangeManagementUtils(true)
jsr.step.checkChangeInDevelopment(
stepRule.step.checkChangeInDevelopment(
script: nullScript,
cmUtils: cm,
changeManagement: [
@ -68,7 +68,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
thrown.expectMessage("Change '001' is not in status 'in development'")
ChangeManagement cm = getChangeManagementUtils(false)
jsr.step.checkChangeInDevelopment(
stepRule.step.checkChangeInDevelopment(
script: nullScript,
cmUtils: cm,
changeManagement: [type: 'SOLMAN',
@ -79,7 +79,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
public void changeIsNotInStatusDevelopmentButWeWouldLikeToSkipFailureTest() {
ChangeManagement cm = getChangeManagementUtils(false)
boolean inDevelopment = jsr.step.checkChangeInDevelopment(
boolean inDevelopment = stepRule.step.checkChangeInDevelopment(
script: nullScript,
cmUtils: cm,
changeManagement: [endpoint: 'https://example.org/cm'],
@ -105,7 +105,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
}
}
jsr.step.checkChangeInDevelopment(
stepRule.step.checkChangeInDevelopment(
script: nullScript,
cmUtils: cm,
changeManagement: [type: 'SOLMAN',
@ -121,7 +121,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
"[from: origin/master, to: HEAD].")
ChangeManagement cm = getChangeManagementUtils(false, null)
jsr.step.checkChangeInDevelopment(
stepRule.step.checkChangeInDevelopment(
script: nullScript,
cmUtils: cm,
changeManagement: [endpoint: 'https://example.org/cm',
@ -137,7 +137,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
"[from: origin/master, to: HEAD].")
ChangeManagement cm = getChangeManagementUtils(false, '')
jsr.step.checkChangeInDevelopment(
stepRule.step.checkChangeInDevelopment(
script: nullScript,
cmUtils: cm,
changeManagement: [type: 'SOLMAN',
@ -149,7 +149,7 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
loggingRule.expect('[INFO] Change management integration intentionally switched off.')
jsr.step.checkChangeInDevelopment(
stepRule.step.checkChangeInDevelopment(
script: nullScript,
changeManagement: [type: 'NONE'])

View File

@ -20,13 +20,13 @@ class ChecksPublishResultsTest extends BasePiperTest {
Map publisherStepOptions
List archiveStepPatterns
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(jsr)
.around(stepRule)
@Before
void init() {
@ -43,7 +43,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithDefaultSettings() throws Exception {
jsr.step.checksPublishResults(script: nullScript)
stepRule.step.checksPublishResults(script: nullScript)
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
// ensure nothing else is published
@ -56,7 +56,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishForJavaWithDefaultSettings() throws Exception {
jsr.step.checksPublishResults(script: nullScript, pmd: true, cpd: true, findbugs: true, checkstyle: true)
stepRule.step.checksPublishResults(script: nullScript, pmd: true, cpd: true, findbugs: true, checkstyle: true)
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
@ -74,7 +74,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishForJavaScriptWithDefaultSettings() throws Exception {
jsr.step.checksPublishResults(script: nullScript, eslint: true)
stepRule.step.checksPublishResults(script: nullScript, eslint: true)
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
assertTrue("WarningsPublisher options not set", publisherStepOptions['WarningsPublisher'] != null)
@ -92,7 +92,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishForPythonWithDefaultSettings() throws Exception {
jsr.step.checksPublishResults(script: nullScript, pylint: true)
stepRule.step.checksPublishResults(script: nullScript, pylint: true)
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
assertTrue("WarningsPublisher options not set", publisherStepOptions['WarningsPublisher'] != null)
@ -111,7 +111,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishNothing() throws Exception {
jsr.step.checksPublishResults(script: nullScript, aggregation: false)
stepRule.step.checksPublishResults(script: nullScript, aggregation: false)
// ensure nothing is published
assertTrue("AnalysisPublisher options not empty", publisherStepOptions['AnalysisPublisher'] == null)
@ -124,7 +124,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishNothingExplicitFalse() throws Exception {
jsr.step.checksPublishResults(script: nullScript, pmd: false)
stepRule.step.checksPublishResults(script: nullScript, pmd: false)
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
// ensure nothing else is published
@ -137,7 +137,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishNothingImplicitTrue() throws Exception {
jsr.step.checksPublishResults(script: nullScript, pmd: [:])
stepRule.step.checksPublishResults(script: nullScript, pmd: [:])
// ensure pmd is not published
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
@ -145,7 +145,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishNothingExplicitActiveFalse() throws Exception {
jsr.step.checksPublishResults(script: nullScript, pmd: [active: false])
stepRule.step.checksPublishResults(script: nullScript, pmd: [active: false])
// ensure pmd is not published
assertTrue("PmdPublisher options not empty", publisherStepOptions['PmdPublisher'] == null)
@ -154,7 +154,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithChangedStepDefaultSettings() throws Exception {
// pmd has been set to active: true in step configuration
jsr.step.checksPublishResults(script: [commonPipelineEnvironment: [
stepRule.step.checksPublishResults(script: [commonPipelineEnvironment: [
configuration: [steps: [checksPublishResults: [pmd: [active: true]]]]
]])
@ -169,7 +169,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithCustomPattern() throws Exception {
jsr.step.checksPublishResults(script: nullScript, eslint: [pattern: 'my-fancy-file.ext'], pmd: [pattern: 'this-is-not-a-patter.xml'])
stepRule.step.checksPublishResults(script: nullScript, eslint: [pattern: 'my-fancy-file.ext'], pmd: [pattern: 'this-is-not-a-patter.xml'])
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
@ -186,7 +186,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithArchive() throws Exception {
jsr.step.checksPublishResults(script: nullScript, archive: true, eslint: true, pmd: true, cpd: true, findbugs: true, checkstyle: true)
stepRule.step.checksPublishResults(script: nullScript, archive: true, eslint: true, pmd: true, cpd: true, findbugs: true, checkstyle: true)
assertTrue("ArchivePatterns number not correct", archiveStepPatterns.size() == 5)
assertTrue("ArchivePatterns contains no PMD pattern", archiveStepPatterns.contains('**/target/pmd.xml'))
@ -198,7 +198,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithPartialArchive() throws Exception {
jsr.step.checksPublishResults(script: nullScript, archive: true, eslint: [archive: false], pmd: true, cpd: true, findbugs: true, checkstyle: true)
stepRule.step.checksPublishResults(script: nullScript, archive: true, eslint: [archive: false], pmd: true, cpd: true, findbugs: true, checkstyle: true)
assertTrue("ArchivePatterns number not correct", archiveStepPatterns.size() == 4)
assertTrue("ArchivePatterns contains no PMD pattern", archiveStepPatterns.contains('**/target/pmd.xml'))
@ -211,7 +211,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithDefaultThresholds() throws Exception {
jsr.step.checksPublishResults(script: nullScript, pmd: true)
stepRule.step.checksPublishResults(script: nullScript, pmd: true)
assertTrue("AnalysisPublisher options not set",
publisherStepOptions['AnalysisPublisher'] != null)
@ -245,7 +245,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
@Test
void testPublishWithThresholds() throws Exception {
jsr.step.checksPublishResults(script: nullScript, aggregation: [thresholds: [fail: [high: '10']]], pmd: true)
stepRule.step.checksPublishResults(script: nullScript, aggregation: [thresholds: [fail: [high: '10']]], pmd: true)
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)

View File

@ -32,7 +32,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this)
private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this)
private JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this)
@ -55,7 +55,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
.around(jedr)
.around(jer)
.around(new JenkinsCredentialsRule(this).withCredentials('test_cfCredentialsId', 'test_cf', '********'))
.around(jsr) // needs to be activated after jedr, otherwise executeDocker is not mocked
.around(stepRule) // needs to be activated after jedr, otherwise executeDocker is not mocked
@Before
void init() {
@ -83,7 +83,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
]
]
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -112,7 +112,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
]
]
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -130,7 +130,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
generatedFile = parameters.file
data = parameters.data
})
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -157,7 +157,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
generatedFile = parameters.file
data = parameters.data
})
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -180,7 +180,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
generatedFile = parameters.file
data = parameters.data
})
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -211,7 +211,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
data = parameters.data
})
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -238,7 +238,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
thrown.expect(hudson.AbortException)
thrown.expectMessage('[cloudFoundryDeploy] ERROR: No appName available in manifest test.yml.')
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -255,7 +255,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
jryr.registerYaml('test.yml', "applications: [[]]")
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -282,7 +282,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
jryr.registerYaml('test.yml', "applications: [[]]")
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -311,7 +311,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
jryr.registerYaml('test.yml', "applications: [[]]")
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -339,7 +339,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
jryr.registerYaml('test.yml', "applications: [[]]")
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -365,7 +365,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
thrown.expect(hudson.AbortException)
thrown.expectMessage('[cloudFoundryDeploy] ERROR: Blue-green plugin requires app name to be passed (see https://github.com/bluemixgaragelondon/cf-blue-green-deploy/issues/27)')
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -381,7 +381,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testMta() {
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -402,7 +402,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testMtaBlueGreen() {
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),
@ -425,7 +425,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
data = parameters.data
})
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
jsr.step.cloudFoundryDeploy([
stepRule.step.cloudFoundryDeploy([
script: nullScript,
juStabUtils: utils,
jenkinsUtilsStub: new JenkinsUtilsMock(),

View File

@ -27,7 +27,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
@ -37,7 +37,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
.around(jder)
.around(shellRule)
.around(loggingRule)
.around(jsr)
.around(stepRule)
int whichDockerReturnValue = 0
def bodyExecuted
def dockerImage
@ -88,7 +88,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testRunOnPodNoContainerMapOnlyDockerImage() throws Exception {
jsr.step.dockerExecuteOnKubernetes(
stepRule.step.dockerExecuteOnKubernetes(
script: nullScript,
juStabUtils: utils,
dockerImage: 'maven:3.5-jdk-8-alpine',
@ -109,7 +109,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomContainerMap() throws Exception {
jsr.step.dockerExecuteOnKubernetes(script: nullScript,
stepRule.step.dockerExecuteOnKubernetes(script: nullScript,
containerMap: ['maven:3.5-jdk-8-alpine': 'mavenexecute']) {
container(name: 'mavenexecute') {
bodyExecuted = true
@ -125,7 +125,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomJnlpWithContainerMap() throws Exception {
nullScript.commonPipelineEnvironment.configuration = ['general': ['jenkinsKubernetes': ['jnlpAgent': 'myJnalpAgent']]]
jsr.step.dockerExecuteOnKubernetes(script: nullScript,
stepRule.step.dockerExecuteOnKubernetes(script: nullScript,
containerMap: ['maven:3.5-jdk-8-alpine': 'mavenexecute']) {
container(name: 'mavenexecute') {
bodyExecuted = true
@ -142,7 +142,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomJnlpWithDockerImage() throws Exception {
nullScript.commonPipelineEnvironment.configuration = ['general': ['jenkinsKubernetes': ['jnlpAgent': 'myJnalpAgent']]]
jsr.step.dockerExecuteOnKubernetes(
stepRule.step.dockerExecuteOnKubernetes(
script: nullScript,
juStabUtils: utils,
dockerImage: 'maven:3.5-jdk-8-alpine') {
@ -158,7 +158,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomWorkspace() throws Exception {
jsr.step.dockerExecuteOnKubernetes(script: nullScript,
stepRule.step.dockerExecuteOnKubernetes(script: nullScript,
containerMap: ['maven:3.5-jdk-8-alpine': 'mavenexecute'],
dockerWorkspace: '/home/piper') {
container(name: 'mavenexecute') {
@ -171,7 +171,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomEnv() throws Exception {
jsr.step.dockerExecuteOnKubernetes(script: nullScript,
stepRule.step.dockerExecuteOnKubernetes(script: nullScript,
containerMap: ['maven:3.5-jdk-8-alpine': 'mavenexecute'],
dockerEnvVars: ['customEnvKey': 'customEnvValue']) {
container(name: 'mavenexecute') {
@ -184,7 +184,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesUpperCaseContainerName() throws Exception {
jsr.step.dockerExecuteOnKubernetes(script: nullScript,
stepRule.step.dockerExecuteOnKubernetes(script: nullScript,
containerMap: ['maven:3.5-jdk-8-alpine': 'MAVENEXECUTE'],
dockerEnvVars: ['customEnvKey': 'customEnvValue']) {
container(name: 'mavenexecute') {
@ -200,7 +200,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesEmptyContainerMapNoDockerImage() throws Exception {
exception.expect(IllegalArgumentException.class);
jsr.step.dockerExecuteOnKubernetes(
stepRule.step.dockerExecuteOnKubernetes(
script: nullScript,
juStabUtils: utils,
containerMap: [:],
@ -219,7 +219,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
portMapping.add(m)
return m
})
jsr.step.dockerExecuteOnKubernetes(
stepRule.step.dockerExecuteOnKubernetes(
script: nullScript,
juStabUtils: utils,
containerCommands: ['selenium/standalone-chrome': ''],
@ -263,7 +263,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomShell() {
jsr.step.dockerExecuteOnKubernetes(
stepRule.step.dockerExecuteOnKubernetes(
script: nullScript,
juStabUtils: utils,
dockerImage: 'maven:3.5-jdk-8-alpine',
@ -276,7 +276,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
@Test
void testDockerExecuteOnKubernetesWithCustomContainerCommand() {
jsr.step.dockerExecuteOnKubernetes(
stepRule.step.dockerExecuteOnKubernetes(
script: nullScript,
juStabUtils: utils,
dockerImage: 'maven:3.5-jdk-8-alpine',

View File

@ -22,14 +22,14 @@ import static org.junit.Assert.assertFalse
class DockerExecuteTest extends BasePiperTest {
private DockerMock docker
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(loggingRule)
.around(jsr)
.around(stepRule)
int dockerPsReturnValue = 0
def bodyExecuted
@ -52,7 +52,7 @@ class DockerExecuteTest extends BasePiperTest {
})
binding.setVariable('env', [POD_NAME: 'testpod', ON_K8S: 'true'])
ContainerMap.instance.setMap(['testpod': ['maven:3.5-jdk-8-alpine': 'mavenexec']])
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
bodyExecuted = true
@ -67,7 +67,7 @@ class DockerExecuteTest extends BasePiperTest {
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { Map config, Closure body -> body() })
binding.setVariable('env', [ON_K8S: 'true'])
ContainerMap.instance.setMap(['testpod': ['maven:3.5-jdk-8-alpine': 'mavenexec']])
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
bodyExecuted = true
@ -81,7 +81,7 @@ class DockerExecuteTest extends BasePiperTest {
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { Map config, Closure body -> body() })
binding.setVariable('env', [POD_NAME: 'testpod', ON_K8S: 'true'])
ContainerMap.instance.setMap([:])
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
bodyExecuted = true
@ -95,7 +95,7 @@ class DockerExecuteTest extends BasePiperTest {
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { Map config, Closure body -> body() })
binding.setVariable('env', [POD_NAME: 'testpod', ON_K8S: 'true'])
ContainerMap.instance.setMap(['testpod':[:]])
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
bodyExecuted = true
@ -112,7 +112,7 @@ class DockerExecuteTest extends BasePiperTest {
return body()
})
binding.setVariable('env', [ON_K8S: 'true'])
jsr.step.dockerExecute(
stepRule.step.dockerExecute(
script: nullScript,
containerCommand: '/busybox/tail -f /dev/null',
containerShell: '/busybox/sh',
@ -128,7 +128,7 @@ class DockerExecuteTest extends BasePiperTest {
@Test
void testExecuteInsideDockerContainer() throws Exception {
jsr.step.dockerExecute(script: nullScript, dockerImage: 'maven:3.5-jdk-8-alpine') {
stepRule.step.dockerExecute(script: nullScript, dockerImage: 'maven:3.5-jdk-8-alpine') {
bodyExecuted = true
}
assertEquals('maven:3.5-jdk-8-alpine', docker.getImageName())
@ -139,7 +139,7 @@ class DockerExecuteTest extends BasePiperTest {
@Test
void testExecuteInsideDockerContainerWithParameters() throws Exception {
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
dockerOptions: '-it',
dockerVolumeBind: ['my_vol': '/my_vol'],
@ -155,7 +155,7 @@ class DockerExecuteTest extends BasePiperTest {
@Test
void testExecuteInsideDockerContainerWithDockerOptionsList() throws Exception {
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
dockerOptions: ['-it', '--network=my-network'],
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
@ -169,7 +169,7 @@ class DockerExecuteTest extends BasePiperTest {
@Test
void testDockerNotInstalledResultsInLocalExecution() throws Exception {
dockerPsReturnValue = 1
jsr.step.dockerExecute(script: nullScript,
stepRule.step.dockerExecute(script: nullScript,
dockerOptions: '-it') {
bodyExecuted = true
}
@ -181,7 +181,7 @@ class DockerExecuteTest extends BasePiperTest {
@Test
void testSidecarDefault(){
jsr.step.dockerExecute(
stepRule.step.dockerExecute(
script: nullScript,
dockerName: 'maven',
dockerImage: 'maven:3.5-jdk-8-alpine',
@ -223,7 +223,7 @@ class DockerExecuteTest extends BasePiperTest {
assertThat(params.containerWorkspaces['selenium/standalone-chrome'], is(''))
body()
})
jsr.step.dockerExecute(
stepRule.step.dockerExecute(
script: nullScript,
containerPortMappings: [
'selenium/standalone-chrome': [[name: 'selPort', containerPort: 4444, hostPort: 4444]]

View File

@ -13,18 +13,18 @@ import util.JenkinsStepRule
class DurationMeasureTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain rules = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(jsr)
.around(stepRule)
@Test
void testDurationMeasurement() throws Exception {
def bodyExecuted = false
jsr.step.durationMeasure(script: nullScript, measurementName: 'test') {
stepRule.step.durationMeasure(script: nullScript, measurementName: 'test') {
bodyExecuted = true
}
assertTrue(nullScript.commonPipelineEnvironment.getPipelineMeasurement('test') != null)

View File

@ -46,7 +46,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
* mta.yaml
*/
JenkinsStepRule jsr = new JenkinsStepRule(this)
JenkinsStepRule stepRule = new JenkinsStepRule(this)
JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this)
JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
@ -54,7 +54,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(jryr)
.around(jsr)
.around(stepRule)
.around(shellRule)
.around(new JenkinsCredentialsRule(this)
.withCredentials('CI_CREDENTIALS_ID', 'foo', 'terceSpot'))
@ -113,7 +113,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
]
]
jsr.step.fioriOnCloudPlatformPipeline(script: nullScript)
stepRule.step.fioriOnCloudPlatformPipeline(script: nullScript)
//
// the mta build call:

View File

@ -10,7 +10,7 @@ import static org.hamcrest.Matchers.*
import static org.junit.Assert.assertThat
class GaugeExecuteTestsTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this)
@ -23,7 +23,7 @@ class GaugeExecuteTestsTest extends BasePiperTest {
.around(shellRule)
.around(loggingRule)
.around(jer)
.around(jsr)
.around(stepRule)
.around(thrown)
def gitParams = [:]
@ -42,7 +42,7 @@ class GaugeExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteGaugeDefaultSuccess() throws Exception {
jsr.step.gaugeExecuteTests(
stepRule.step.gaugeExecuteTests(
script: nullScript,
juStabUtils: utils,
testServerUrl: 'http://test.url'
@ -70,7 +70,7 @@ class GaugeExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteGaugeNode() throws Exception {
jsr.step.gaugeExecuteTests(
stepRule.step.gaugeExecuteTests(
script: nullScript,
buildTool: 'npm',
dockerEnvVars: ['TARGET_SERVER_URL':'http://custom.url'],
@ -96,7 +96,7 @@ class GaugeExecuteTestsTest extends BasePiperTest {
thrown.expect(RuntimeException)
thrown.expectMessage('Test Error')
try {
jsr.step.gaugeExecuteTests(
stepRule.step.gaugeExecuteTests(
script: nullScript,
juStabUtils: utils,
dockerImage: 'testImage',
@ -123,7 +123,7 @@ class GaugeExecuteTestsTest extends BasePiperTest {
helper.registerAllowedMethod('git', [String.class], null)
helper.registerAllowedMethod('stash', [String.class], null)
jsr.step.gaugeExecuteTests(
stepRule.step.gaugeExecuteTests(
script: nullScript,
juStabUtils: utils,
testRepository: 'myTestRepo',

View File

@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.*
import static org.junit.Assert.assertThat
class GithubPublishReleaseTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsReadJsonRule jrjr = new JenkinsReadJsonRule(this)
private ExpectedException thrown = ExpectedException.none()
@ -28,7 +28,7 @@ class GithubPublishReleaseTest extends BasePiperTest {
.around(new JenkinsReadYamlRule(this))
.around(loggingRule)
.around(jrjr)
.around(jsr)
.around(stepRule)
.around(thrown)
def data
@ -82,7 +82,7 @@ class GithubPublishReleaseTest extends BasePiperTest {
@Test
void testPublishGithubReleaseWithDefaults() throws Exception {
jsr.step.githubPublishRelease(
stepRule.step.githubPublishRelease(
script: nullScript,
githubOrg: 'TestOrg',
githubRepo: 'TestRepo',
@ -112,7 +112,7 @@ class GithubPublishReleaseTest extends BasePiperTest {
@Test
void testPublishGithubRelease() throws Exception {
jsr.step.githubPublishRelease(
stepRule.step.githubPublishRelease(
script: nullScript,
githubOrg: 'TestOrg',
githubRepo: 'TestRepo',
@ -149,7 +149,7 @@ class GithubPublishReleaseTest extends BasePiperTest {
@Test
void testExcludeLabels() throws Exception {
jsr.step.githubPublishRelease(
stepRule.step.githubPublishRelease(
script: nullScript,
githubOrg: 'TestOrg',
githubRepo: 'TestRepo',
@ -189,8 +189,8 @@ class GithubPublishReleaseTest extends BasePiperTest {
"body": ""
}''')
// asserts
assertThat(jsr.step.isExcluded(item, ['enhancement', 'won\'t fix']), is(true))
assertThat(jsr.step.isExcluded(item, ['won\'t fix']), is(false))
assertThat(stepRule.step.isExcluded(item, ['enhancement', 'won\'t fix']), is(true))
assertThat(stepRule.step.isExcluded(item, ['won\'t fix']), is(false))
assertJobStatusSuccess()
}
}

View File

@ -15,7 +15,7 @@ import util.JenkinsStepRule
import util.Rules
class HandlePipelineStepErrorsTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private ExpectedException thrown = ExpectedException.none()
@ -23,13 +23,13 @@ class HandlePipelineStepErrorsTest extends BasePiperTest {
public RuleChain rules = Rules
.getCommonRules(this)
.around(loggingRule)
.around(jsr)
.around(stepRule)
.around(thrown)
@Test
void testBeginAndEndMessage() {
def isExecuted
jsr.step.handlePipelineStepErrors([
stepRule.step.handlePipelineStepErrors([
stepName: 'testStep',
stepParameters: ['something': 'anything']
]) {
@ -44,7 +44,7 @@ class HandlePipelineStepErrorsTest extends BasePiperTest {
@Test
void testNonVerbose() {
try {
jsr.step.handlePipelineStepErrors([
stepRule.step.handlePipelineStepErrors([
stepName: 'testStep',
stepParameters: ['something': 'anything'],
echoDetails: false
@ -64,7 +64,7 @@ class HandlePipelineStepErrorsTest extends BasePiperTest {
void testErrorsMessage() {
def isReported
try {
jsr.step.handlePipelineStepErrors([
stepRule.step.handlePipelineStepErrors([
stepName: 'testStep',
stepParameters: ['something': 'anything']
]) {

View File

@ -14,7 +14,7 @@ import static org.hamcrest.Matchers.*
import static org.junit.Assert.assertThat
class HealthExecuteCheckTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private ExpectedException thrown = ExpectedException.none()
@ -23,7 +23,7 @@ class HealthExecuteCheckTest extends BasePiperTest {
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(loggingRule)
.around(jsr)
.around(stepRule)
.around(thrown)
@ -41,7 +41,7 @@ class HealthExecuteCheckTest extends BasePiperTest {
void testHealthCheckOk() throws Exception {
def testUrl = 'http://testserver/endpoint'
jsr.step.healthExecuteCheck(
stepRule.step.healthExecuteCheck(
script: nullScript,
testServerUrl: testUrl
)
@ -56,7 +56,7 @@ class HealthExecuteCheckTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage('Health check failed: 404')
jsr.step.healthExecuteCheck(
stepRule.step.healthExecuteCheck(
script: nullScript,
testServerUrl: testUrl
)
@ -65,7 +65,7 @@ class HealthExecuteCheckTest extends BasePiperTest {
@Test
void testHealthCheckWithEndPoint() throws Exception {
jsr.step.healthExecuteCheck(
stepRule.step.healthExecuteCheck(
script: nullScript,
testServerUrl: 'http://testserver',
healthEndpoint: 'endpoint'
@ -76,7 +76,7 @@ class HealthExecuteCheckTest extends BasePiperTest {
@Test
void testHealthCheckWithEndPointTrailingSlash() throws Exception {
jsr.step.healthExecuteCheck(
stepRule.step.healthExecuteCheck(
script: nullScript,
testServerUrl: 'http://testserver/',
healthEndpoint: 'endpoint'

View File

@ -22,14 +22,14 @@ import static org.junit.Assert.assertEquals
class InfluxWriteDataTest extends BasePiperTest {
public JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(loggingRule)
.around(jsr)
.around(stepRule)
Map fileMap = [:]
Map stepMap = [:]
@ -62,7 +62,7 @@ class InfluxWriteDataTest extends BasePiperTest {
void testInfluxWriteDataWithDefault() throws Exception {
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
jsr.step.influxWriteData(script: nullScript)
stepRule.step.influxWriteData(script: nullScript)
assertThat(loggingRule.log, containsString('Artifact version: 1.2.3'))
@ -84,7 +84,7 @@ class InfluxWriteDataTest extends BasePiperTest {
void testInfluxWriteDataNoInflux() throws Exception {
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
jsr.step.influxWriteData(script: nullScript, influxServer: '')
stepRule.step.influxWriteData(script: nullScript, influxServer: '')
assertEquals(0, stepMap.size())
@ -97,7 +97,7 @@ class InfluxWriteDataTest extends BasePiperTest {
@Test
void testInfluxWriteDataNoArtifactVersion() throws Exception {
jsr.step.influxWriteData(script: nullScript)
stepRule.step.influxWriteData(script: nullScript)
assertEquals(0, stepMap.size())
assertEquals(0, fileMap.size())
@ -119,7 +119,7 @@ class InfluxWriteDataTest extends BasePiperTest {
helper.registerAllowedMethod("deleteDir", [], null)
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
jsr.step.influxWriteData(script: nullScript, wrapInNode: true)
stepRule.step.influxWriteData(script: nullScript, wrapInNode: true)
assertThat(nodeCalled, is(true))
@ -128,7 +128,7 @@ class InfluxWriteDataTest extends BasePiperTest {
@Test
void testInfluxCustomData() {
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
jsr.step.influxWriteData(
stepRule.step.influxWriteData(
//juStabUtils: utils,
script: nullScript,
influxServer: 'myInstance',
@ -150,7 +150,7 @@ class InfluxWriteDataTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.setInfluxCustomDataTagsEntry('tag1', 'testTag1')
nullScript.commonPipelineEnvironment.setInfluxCustomDataMapEntry('test_data', 'key1', 'keyValue1')
nullScript.commonPipelineEnvironment.setInfluxCustomDataMapTagsEntry('test_data', 'tag1', 'tagValue1')
jsr.step.influxWriteData(
stepRule.step.influxWriteData(
//juStabUtils: utils,
script: nullScript,
influxServer: 'myInstance'

View File

@ -10,7 +10,7 @@ import static org.hamcrest.Matchers.*
import static org.junit.Assert.assertThat
class KarmaExecuteTestsTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this)
@ -23,7 +23,7 @@ class KarmaExecuteTestsTest extends BasePiperTest {
.around(shellRule)
.around(loggingRule)
.around(jer)
.around(jsr)
.around(stepRule)
.around(thrown)
def seleniumParams = [:]
@ -40,7 +40,7 @@ class KarmaExecuteTestsTest extends BasePiperTest {
@Test
void testDefaults() throws Exception {
jsr.step.karmaExecuteTests(
stepRule.step.karmaExecuteTests(
script: nullScript,
juStabUtils: utils
)

View File

@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat
class MailSendNotificationTest extends BasePiperTest {
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
@Rule
@ -19,7 +19,7 @@ class MailSendNotificationTest extends BasePiperTest {
.around(new JenkinsReadYamlRule(this))
.around(loggingRule)
.around(shellRule)
.around(jsr)
.around(stepRule)
@Before
void init() throws Exception {
@ -49,7 +49,7 @@ user3@domain.com noreply+github@domain.com
user3@domain.com noreply+github@domain.com
user3@domain.com noreply+github@domain.com'''
def result = jsr.step.getDistinctRecipients(input)
def result = stepRule.step.getDistinctRecipients(input)
// asserts
assertThat(result.split(' '), arrayWithSize(3))
assertThat(result, containsString('user1@domain.com'))
@ -64,7 +64,7 @@ user3@domain.com noreply+github@domain.com'''
shellRule.setReturnValue("git log -2 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com')
def result = jsr.step.getCulprits(
def result = stepRule.step.getCulprits(
[
gitSSHCredentialsId: '',
gitUrl: 'git@github.wdf.domain.com:IndustryCloudFoundation/pipeline-test-node.git',
@ -84,7 +84,7 @@ user3@domain.com noreply+github@domain.com'''
shellRule.setReturnValue('git log > /dev/null 2>&1',1)
jsr.step.getCulprits(
stepRule.step.getCulprits(
[
gitSSHCredentialsId: '',
gitUrl: 'git@github.wdf.domain.com:IndustryCloudFoundation/pipeline-test-node.git',
@ -101,7 +101,7 @@ user3@domain.com noreply+github@domain.com'''
shellRule.setReturnValue('git log > /dev/null 2>&1',1)
jsr.step.getCulprits(
stepRule.step.getCulprits(
[
gitSSHCredentialsId: '',
gitUrl: 'git@github.wdf.domain.com:IndustryCloudFoundation/pipeline-test-node.git',
@ -118,7 +118,7 @@ user3@domain.com noreply+github@domain.com'''
shellRule.setReturnValue('git log > /dev/null 2>&1',1)
jsr.step.getCulprits(
stepRule.step.getCulprits(
[
gitSSHCredentialsId: '',
gitUrl: 'git@github.wdf.domain.com:IndustryCloudFoundation/pipeline-test-node.git',
@ -165,7 +165,7 @@ user3@domain.com noreply+github@domain.com'''
return ''
})
jsr.step.mailSendNotification(
stepRule.step.mailSendNotification(
script: nullScript,
notifyCulprits: false,
gitUrl: 'git@github.wdf.domain.com:IndustryCloudFoundation/pipeline-test-node.git'
@ -198,7 +198,7 @@ user3@domain.com noreply+github@domain.com'''
shellRule.setReturnValue("git log -0 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com')
jsr.step.mailSendNotification(
stepRule.step.mailSendNotification(
script: nullScript,
gitCommitId: 'abcd1234',
//notifyCulprits: true,
@ -228,7 +228,7 @@ user3@domain.com noreply+github@domain.com'''
shellRule.setReturnValue("git log -0 --pretty=format:'%ae %ce'", 'user2@domain.com user3@domain.com')
jsr.step.mailSendNotification(
stepRule.step.mailSendNotification(
script: nullScript,
gitCommitId: 'abcd1234',
gitUrl: 'git@github.wdf.domain.com:IndustryCloudFoundation/pipeline-test-node.git'

View File

@ -23,7 +23,7 @@ class MavenExecuteTest extends BasePiperTest {
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
@ -31,12 +31,12 @@ class MavenExecuteTest extends BasePiperTest {
.around(new JenkinsReadYamlRule(this))
.around(jder)
.around(shellRule)
.around(jsr)
.around(stepRule)
@Test
void testExecuteBasicMavenCommand() throws Exception {
jsr.step.mavenExecute(script: nullScript, goals: 'clean install')
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install')
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
assert shellRule.shell[0] == 'mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install'
@ -45,7 +45,7 @@ class MavenExecuteTest extends BasePiperTest {
@Test
void testExecuteBasicMavenCommandWithDownloadLogsEnabled() throws Exception {
jsr.step.mavenExecute(script: nullScript, goals: 'clean install', logSuccessfulMavenTransfers: true)
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install', logSuccessfulMavenTransfers: true)
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
assert shellRule.shell[0] == 'mvn --batch-mode clean install'
@ -54,7 +54,7 @@ class MavenExecuteTest extends BasePiperTest {
@Test
void testExecuteMavenCommandWithParameter() throws Exception {
jsr.step.mavenExecute(
stepRule.step.mavenExecute(
script: nullScript,
dockerImage: 'maven:3.5-jdk-8-alpine',
goals: 'clean install',
@ -71,7 +71,7 @@ class MavenExecuteTest extends BasePiperTest {
@Test
void testMavenCommandForwardsDockerOptions() throws Exception {
jsr.step.mavenExecute(script: nullScript, goals: 'clean install')
stepRule.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', shellRule.shell[0])
@ -79,7 +79,7 @@ class MavenExecuteTest extends BasePiperTest {
@Test
void testMavenCommandWithShortBatchModeFlag() throws Exception {
jsr.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-B')
stepRule.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', shellRule.shell[0])
@ -87,7 +87,7 @@ class MavenExecuteTest extends BasePiperTest {
@Test
void testMavenCommandWithFalsePositiveMinusBFlag() throws Exception {
jsr.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-Blah')
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-Blah')
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
assertThat(shellRule.shell[0],
@ -97,7 +97,7 @@ class MavenExecuteTest extends BasePiperTest {
@Test
void testMavenCommandWithBatchModeMultiline() throws Exception {
jsr.step.mavenExecute(script: nullScript, goals: 'clean install', flags: ('''-B\\
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install', flags: ('''-B\\
|--show-version''' as CharSequence).stripMargin())
assertThat(shellRule.shell[0], not(containsString('--batch-mode')))
}

View File

@ -24,7 +24,7 @@ public class MtaBuildTest extends BasePiperTest {
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this).registerYaml('mta.yaml', defaultMtaYaml() )
@Rule
@ -35,7 +35,7 @@ public class MtaBuildTest extends BasePiperTest {
.around(loggingRule)
.around(shellRule)
.around(jder)
.around(jsr)
.around(stepRule)
@Before
void init() {
@ -57,7 +57,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void environmentPathTest() {
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
assert shellRule.shell.find { c -> c.contains('PATH=./node_modules/.bin:/usr/bin')}
}
@ -66,7 +66,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void sedTest() {
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
assert shellRule.shell.find { c -> c =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" "mta.yaml"$/}
}
@ -75,7 +75,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void mtarFilePathFromCommonPipelineEnviromentTest() {
jsr.step.mtaBuild(script: nullScript,
stepRule.step.mtaBuild(script: nullScript,
buildTarget: 'NEO')
def mtarFilePath = nullScript.commonPipelineEnvironment.getMtarFilePath()
@ -86,7 +86,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void mtaJarLocationAsParameterTest() {
jsr.step.mtaBuild(script: nullScript, mtaJarLocation: '/mylocation/mta/mta.jar', buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, mtaJarLocation: '/mylocation/mta/mta.jar', buildTarget: 'NEO')
assert shellRule.shell.find { c -> c.contains('-jar /mylocation/mta/mta.jar --mtar')}
@ -102,7 +102,7 @@ public class MtaBuildTest extends BasePiperTest {
thrown.expectMessage('\'mta.yaml\' not found in project sources and \'applicationName\' not provided as parameter ' +
'- cannot generate \'mta.yaml\' file.')
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
}
@ -114,7 +114,7 @@ public class MtaBuildTest extends BasePiperTest {
jryr.registerYaml('mta.yaml', badMtaYaml())
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
}
@ -126,7 +126,7 @@ public class MtaBuildTest extends BasePiperTest {
jryr.registerYaml('mta.yaml', noIdMtaYaml() )
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
}
@ -135,7 +135,7 @@ public class MtaBuildTest extends BasePiperTest {
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.*\\$MTA_JAR_LOCATION.*', '/env/mta/mta.jar')
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
assert shellRule.shell.find { c -> c.contains("-jar /env/mta/mta.jar --mtar")}
assert loggingRule.log.contains("SAP Multitarget Application Archive Builder file '/env/mta/mta.jar' retrieved from environment.")
@ -148,7 +148,7 @@ public class MtaBuildTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[mtaJarLocation: '/config/mta/mta.jar']]]
jsr.step.mtaBuild(script: nullScript,
stepRule.step.mtaBuild(script: nullScript,
buildTarget: 'NEO')
assert shellRule.shell.find(){ c -> c.contains("-jar /config/mta/mta.jar --mtar")}
@ -160,7 +160,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void mtaJarLocationFromDefaultStepConfigurationTest() {
jsr.step.mtaBuild(script: nullScript,
stepRule.step.mtaBuild(script: nullScript,
buildTarget: 'NEO')
assert shellRule.shell.find(){ c -> c.contains("-jar mta.jar --mtar")}
@ -172,7 +172,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void buildTargetFromParametersTest() {
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
assert shellRule.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
}
@ -183,7 +183,7 @@ public class MtaBuildTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[buildTarget: 'NEO']]]
jsr.step.mtaBuild(script: nullScript)
stepRule.step.mtaBuild(script: nullScript)
assert shellRule.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
}
@ -191,7 +191,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void canConfigureDockerImage() {
jsr.step.mtaBuild(script: nullScript, dockerImage: 'mta-docker-image:latest')
stepRule.step.mtaBuild(script: nullScript, dockerImage: 'mta-docker-image:latest')
assert 'mta-docker-image:latest' == jder.dockerParams.dockerImage
}
@ -199,7 +199,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void canConfigureDockerOptions() {
jsr.step.mtaBuild(script: nullScript, dockerOptions: 'something')
stepRule.step.mtaBuild(script: nullScript, dockerOptions: 'something')
assert 'something' == jder.dockerParams.dockerOptions
}
@ -209,7 +209,7 @@ public class MtaBuildTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.defaultConfiguration = [steps:[mtaBuild:[buildTarget: 'NEO']]]
jsr.step.mtaBuild(script: nullScript)
stepRule.step.mtaBuild(script: nullScript)
assert shellRule.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
}
@ -218,7 +218,7 @@ public class MtaBuildTest extends BasePiperTest {
@Test
void extensionFromParametersTest() {
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO', extension: 'param_extension')
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO', extension: 'param_extension')
assert shellRule.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=param_extension build')}
}
@ -229,7 +229,7 @@ public class MtaBuildTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[buildTarget: 'NEO', extension: 'config_extension']]]
jsr.step.mtaBuild(script: nullScript)
stepRule.step.mtaBuild(script: nullScript)
assert shellRule.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=config_extension build')}
}

View File

@ -37,7 +37,7 @@ class NeoDeployTest extends BasePiperTest {
private ExpectedException thrown = new ExpectedException().none()
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
@ -49,7 +49,7 @@ class NeoDeployTest extends BasePiperTest {
.around(new JenkinsCredentialsRule(this)
.withCredentials('myCredentialsId', 'anonymous', '********')
.withCredentials('CI_CREDENTIALS_ID', 'defaultUser', '********'))
.around(jsr)
.around(stepRule)
private static workspacePath
private static warArchiveName
@ -99,7 +99,7 @@ class NeoDeployTest extends BasePiperTest {
}
}
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
neoCredentialsId: 'myCredentialsId',
utils: utils
@ -133,7 +133,7 @@ class NeoDeployTest extends BasePiperTest {
Boolean.TRUE.toString())
try {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
neoCredentialsId: 'myCredentialsId',
utils: utils
@ -156,7 +156,7 @@ class NeoDeployTest extends BasePiperTest {
}
}
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
neoCredentialsId: 'myCredentialsId',
utils: utils,
@ -183,7 +183,7 @@ class NeoDeployTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [steps:[neoDeploy: [host: 'configuration-frwk.deploy.host.com',
account: 'configurationFrwkUser123']]]
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
neoCredentialsId: 'myCredentialsId'
)
@ -201,7 +201,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void archivePathFromCPETest() {
nullScript.commonPipelineEnvironment.setMtarFilePath('archive.mtar')
jsr.step.neoDeploy(script: nullScript)
stepRule.step.neoDeploy(script: nullScript)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
@ -211,7 +211,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void archivePathFromParamsHasHigherPrecedenceThanCPETest() {
nullScript.commonPipelineEnvironment.setMtarFilePath('archive2.mtar')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: "archive.mtar")
Assert.assertThat(shellRule.shell,
@ -225,7 +225,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(CredentialNotFoundException)
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
neoCredentialsId: 'badCredentialsId'
)
@ -235,7 +235,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void credentialsIdNotProvidedTest() {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName
)
@ -255,7 +255,7 @@ class NeoDeployTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName
)
@ -270,7 +270,7 @@ class NeoDeployTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
neoCredentialsId: 'myCredentialsId',
neoHome: '/param/neo'
@ -285,7 +285,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void neoHomeFromEnvironmentTest() {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName
)
@ -302,7 +302,7 @@ class NeoDeployTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [steps:[neoDeploy: [host: 'test.deploy.host.com', account: 'trialuser123', neoHome: '/config/neo']]]
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName
)
@ -318,7 +318,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage('Archive path not configured (parameter "archivePath").')
jsr.step.neoDeploy(script: nullScript)
stepRule.step.neoDeploy(script: nullScript)
}
@ -328,7 +328,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(AbortException)
thrown.expectMessage('Archive cannot be found')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: 'wrongArchiveName')
}
@ -341,13 +341,13 @@ class NeoDeployTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [:]
jsr.step.neoDeploy(script: nullScript, archivePath: archiveName)
stepRule.step.neoDeploy(script: nullScript, archivePath: archiveName)
}
@Test
void mtaDeployModeTest() {
jsr.step.neoDeploy(script: nullScript, archivePath: archiveName, deployMode: 'mta')
stepRule.step.neoDeploy(script: nullScript, archivePath: archiveName, deployMode: 'mta')
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
@ -363,7 +363,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void warFileParamsDeployModeTest() {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
applicationName: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
@ -389,7 +389,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void warFileParamsDeployModeRollingUpdateTest() {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warParams',
applicationName: 'testApp',
@ -414,7 +414,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void warPropertiesFileDeployModeTest() {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warPropertiesFile',
propertiesFile: propertiesFileName,
@ -435,7 +435,7 @@ class NeoDeployTest extends BasePiperTest {
@Test
void warPropertiesFileDeployModeRollingUpdateTest() {
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warPropertiesFile',
propertiesFile: propertiesFileName,
@ -459,7 +459,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR applicationName')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warParams',
runtime: 'neo-javaee6-wp',
@ -473,7 +473,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtime')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
applicationName: 'testApp',
deployMode: 'warParams',
@ -486,7 +486,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtimeVersion')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
applicationName: 'testApp',
deployMode: 'warParams',
@ -499,7 +499,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: [mta, warParams, warPropertiesFile]")
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'illegalMode',
applicationName: 'testApp',
@ -515,7 +515,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: [lite, pro, prem, prem-plus].")
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warParams',
applicationName: 'testApp',
@ -531,7 +531,7 @@ class NeoDeployTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: [deploy, rolling-update].")
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warParams',
applicationName: 'testApp',
@ -546,7 +546,7 @@ class NeoDeployTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
deployHost: "my.deploy.host.com"
)
@ -559,7 +559,7 @@ class NeoDeployTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
jsr.step.neoDeploy(script: nullScript,
stepRule.step.neoDeploy(script: nullScript,
archivePath: archiveName,
host: "my.deploy.host.com",
deployAccount: "myAccount"

View File

@ -22,7 +22,7 @@ import org.junit.rules.ExpectedException
class NewmanExecuteTest extends BasePiperTest {
private ExpectedException thrown = ExpectedException.none()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this)
@ -35,7 +35,7 @@ class NewmanExecuteTest extends BasePiperTest {
.around(jedr)
.around(shellRule)
.around(loggingRule)
.around(jsr) // needs to be activated after jedr, otherwise executeDocker is not mocked
.around(stepRule) // needs to be activated after jedr, otherwise executeDocker is not mocked
def gitMap
@ -62,7 +62,7 @@ class NewmanExecuteTest extends BasePiperTest {
@Test
void testExecuteNewmanDefault() throws Exception {
jsr.step.newmanExecute(
stepRule.step.newmanExecute(
script: nullScript,
juStabUtils: utils,
newmanCollection: 'testCollection',
@ -79,7 +79,7 @@ class NewmanExecuteTest extends BasePiperTest {
@Test
void testGlobalInstall() throws Exception {
jsr.step.newmanExecute(
stepRule.step.newmanExecute(
script: nullScript,
juStabUtils: utils,
newmanCollection: 'testCollection',
@ -96,7 +96,7 @@ class NewmanExecuteTest extends BasePiperTest {
void testExecuteNewmanWithNoCollection() throws Exception {
thrown.expectMessage('[newmanExecute] No collection found with pattern \'notFound.json\'')
jsr.step.newmanExecute(
stepRule.step.newmanExecute(
script: nullScript,
juStabUtils: utils,
newmanCollection: 'notFound.json'
@ -107,7 +107,7 @@ class NewmanExecuteTest extends BasePiperTest {
@Test
void testExecuteNewmanFailOnError() throws Exception {
jsr.step.newmanExecute(
stepRule.step.newmanExecute(
script: nullScript,
juStabUtils: utils,
newmanCollection: 'testCollection',
@ -126,7 +126,7 @@ class NewmanExecuteTest extends BasePiperTest {
@Test
void testExecuteNewmanWithFolder() throws Exception {
jsr.step.newmanExecute(
stepRule.step.newmanExecute(
script: nullScript,
juStabUtils: utils,
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'

View File

@ -12,14 +12,14 @@ import util.JenkinsStepRule
class PipelineExecuteTest extends BasePiperTest {
private ExpectedException thrown = new ExpectedException().none()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(jsr)
.around(stepRule)
def pipelinePath
def checkoutParameters = [:]
@ -44,7 +44,7 @@ class PipelineExecuteTest extends BasePiperTest {
@Test
void straightForwardTest() {
jsr.step.pipelineExecute(repoUrl: "https://test.com/myRepo.git")
stepRule.step.pipelineExecute(repoUrl: "https://test.com/myRepo.git")
assert load == "Jenkinsfile"
assert checkoutParameters.branch == 'master'
assert checkoutParameters.repoUrl == "https://test.com/myRepo.git"
@ -55,7 +55,7 @@ class PipelineExecuteTest extends BasePiperTest {
@Test
void parameterizeTest() {
jsr.step.pipelineExecute(repoUrl: "https://test.com/anotherRepo.git",
stepRule.step.pipelineExecute(repoUrl: "https://test.com/anotherRepo.git",
branch: 'feature',
path: 'path/to/Jenkinsfile',
credentialsId: 'abcd1234')
@ -73,6 +73,6 @@ class PipelineExecuteTest extends BasePiperTest {
thrown.expect(Exception)
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR repoUrl")
jsr.step.pipelineExecute()
stepRule.step.pipelineExecute()
}
}

View File

@ -13,14 +13,14 @@ class PipelineRestartStepsTest extends BasePiperTest {
private JenkinsErrorRule jer = new JenkinsErrorRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain chain = Rules.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(jer)
.around(loggingRule)
.around(jsr)
.around(stepRule)
@Test
void testError() throws Exception {
@ -50,7 +50,7 @@ class PipelineRestartStepsTest extends BasePiperTest {
})
try {
jsr.step.pipelineRestartSteps ([
stepRule.step.pipelineRestartSteps ([
script: nullScript,
jenkinsUtilsStub: jenkinsUtils,
sendMail: true,
@ -93,7 +93,7 @@ class PipelineRestartStepsTest extends BasePiperTest {
})
try {
jsr.step.pipelineRestartSteps ([
stepRule.step.pipelineRestartSteps ([
script: nullScript,
jenkinsUtilsStub: jenkinsUtils,
sendMail: false,
@ -111,7 +111,7 @@ class PipelineRestartStepsTest extends BasePiperTest {
@Test
void testSuccess() throws Exception {
jsr.step.pipelineRestartSteps ([
stepRule.step.pipelineRestartSteps ([
script: nullScript,
jenkinsUtilsStub: jenkinsUtils,
sendMail: false,

View File

@ -8,7 +8,7 @@ import static org.junit.Assert.assertFalse
import static org.junit.Assert.assertThat
class PipelineStashFilesAfterBuildTest extends BasePiperTest {
JenkinsStepRule jsr = new JenkinsStepRule(this)
JenkinsStepRule stepRule = new JenkinsStepRule(this)
JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
JenkinsReadJsonRule jrj = new JenkinsReadJsonRule(this)
@ -18,7 +18,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
.around(new JenkinsReadYamlRule(this))
.around(jrj)
.around(loggingRule)
.around(jsr)
.around(stepRule)
@Test
void testStashAfterBuild() {
@ -26,7 +26,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
searchTerm ->
return false
})
jsr.step.pipelineStashFilesAfterBuild(
stepRule.step.pipelineStashFilesAfterBuild(
script: nullScript,
juStabUtils: utils
)
@ -42,7 +42,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
searchTerm ->
return true
})
jsr.step.pipelineStashFilesAfterBuild(
stepRule.step.pipelineStashFilesAfterBuild(
script: nullScript,
juStabUtils: utils,
runCheckmarx: true
@ -59,7 +59,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
searchTerm ->
return true
})
jsr.step.pipelineStashFilesAfterBuild(
stepRule.step.pipelineStashFilesAfterBuild(
script: [commonPipelineEnvironment: [configuration: [steps: [executeCheckmarxScan: [checkmarxProject: 'TestProject']]]]],
juStabUtils: utils,
)

View File

@ -7,7 +7,7 @@ import static org.hamcrest.Matchers.containsString
import static org.junit.Assert.*
class PipelineStashFilesBeforeBuildTest extends BasePiperTest {
JenkinsStepRule jsr = new JenkinsStepRule(this)
JenkinsStepRule stepRule = new JenkinsStepRule(this)
JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
//JenkinsReadJsonRule jrj = new JenkinsReadJsonRule(this)
@ -19,12 +19,12 @@ class PipelineStashFilesBeforeBuildTest extends BasePiperTest {
//.around(jrj)
.around(loggingRule)
.around(shellRule)
.around(jsr)
.around(stepRule)
@Test
void testStashBeforeBuildNoOpa() {
jsr.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils)
stepRule.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils)
// asserts
assertEquals('mkdir -p gitmetadata', shellRule.shell[0])
@ -44,7 +44,7 @@ class PipelineStashFilesBeforeBuildTest extends BasePiperTest {
@Test
void testStashBeforeBuildOpa() {
jsr.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils, runOpaTests: true)
stepRule.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils, runOpaTests: true)
// asserts
assertThat(loggingRule.log, containsString('Stash content: buildDescriptor'))

View File

@ -16,7 +16,7 @@ import static org.junit.Assert.assertThat
class PiperStageWrapperTest extends BasePiperTest {
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private Map lockMap = [:]
private int countNodeUsage = 0
@ -27,7 +27,7 @@ class PiperStageWrapperTest extends BasePiperTest {
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(loggingRule)
.around(jsr)
.around(stepRule)
@Before
void init() throws Exception {
@ -55,7 +55,7 @@ class PiperStageWrapperTest extends BasePiperTest {
@Test
void testDefault() {
def executed = false
jsr.step.piperStageWrapper(
stepRule.step.piperStageWrapper(
script: nullScript,
juStabUtils: utils,
ordinal: 10,
@ -72,7 +72,7 @@ class PiperStageWrapperTest extends BasePiperTest {
@Test
void testNoLocking() {
def executed = false
jsr.step.piperStageWrapper(
stepRule.step.piperStageWrapper(
script: nullScript,
juStabUtils: utils,
nodeLabel: 'testLabel',
@ -101,7 +101,7 @@ class PiperStageWrapperTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.gitBranch = 'testBranch'
def executed = false
jsr.step.piperStageWrapper(
stepRule.step.piperStageWrapper(
script: nullScript,
juStabUtils: utils,
ordinal: 10,

View File

@ -15,7 +15,7 @@ import util.Rules
public class PrepareDefaultValuesTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private ExpectedException thrown = ExpectedException.none()
@ -24,7 +24,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(jsr)
.around(stepRule)
.around(loggingRule)
@Before
@ -43,7 +43,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
@Test
public void testDefaultPipelineEnvironmentOnly() {
jsr.step.prepareDefaultValues(script: nullScript)
stepRule.step.prepareDefaultValues(script: nullScript)
assert DefaultValueCache.getInstance().getDefaultValues().size() == 1
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
@ -55,7 +55,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
def instance = DefaultValueCache.createInstance([key:'value'])
// existing instance is dropped in case a custom config is provided.
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: 'custom.yml')
stepRule.step.prepareDefaultValues(script: nullScript, customDefaults: 'custom.yml')
// this check is for checking we have another instance
assert ! instance.is(DefaultValueCache.getInstance())
@ -72,7 +72,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
def instance = DefaultValueCache.createInstance([key:'value'])
jsr.step.prepareDefaultValues(script: nullScript)
stepRule.step.prepareDefaultValues(script: nullScript)
assert instance.is(DefaultValueCache.getInstance())
assert DefaultValueCache.getInstance().getDefaultValues().size() == 1
@ -86,13 +86,13 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
thrown.expect(hudson.AbortException.class)
thrown.expectMessage('No such library resource not_found could be found')
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: 'not_found')
stepRule.step.prepareDefaultValues(script: nullScript, customDefaults: 'not_found')
}
@Test
public void testDefaultPipelineEnvironmentWithCustomConfigReferencedAsString() {
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: 'custom.yml')
stepRule.step.prepareDefaultValues(script: nullScript, customDefaults: 'custom.yml')
assert DefaultValueCache.getInstance().getDefaultValues().size() == 2
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
@ -102,7 +102,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
@Test
public void testDefaultPipelineEnvironmentWithCustomConfigReferencedAsList() {
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: ['custom.yml'])
stepRule.step.prepareDefaultValues(script: nullScript, customDefaults: ['custom.yml'])
assert DefaultValueCache.getInstance().getDefaultValues().size() == 2
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
@ -112,7 +112,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
@Test
public void testAssertNoLogMessageInCaseOfNoAdditionalConfigFiles() {
jsr.step.prepareDefaultValues(script: nullScript)
stepRule.step.prepareDefaultValues(script: nullScript)
assert ! loggingRule.log.contains("Loading configuration file 'default_pipeline_environment.yml'")
}
@ -120,7 +120,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
@Test
public void testAssertLogMessageInCaseOfMoreThanOneConfigFile() {
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: ['custom.yml'])
stepRule.step.prepareDefaultValues(script: nullScript, customDefaults: ['custom.yml'])
assert loggingRule.log.contains("Loading configuration file 'default_pipeline_environment.yml'")
assert loggingRule.log.contains("Loading configuration file 'custom.yml'")

View File

@ -11,7 +11,7 @@ import static org.junit.Assert.assertThat
class SeleniumExecuteTestsTest extends BasePiperTest {
private ExpectedException thrown = ExpectedException.none()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this)
@ -22,7 +22,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(jedr)
.around(jsr) // needs to be activated after jedr, otherwise executeDocker is not mocked
.around(stepRule) // needs to be activated after jedr, otherwise executeDocker is not mocked
boolean bodyExecuted = false
@ -39,7 +39,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteSeleniumDefault() {
jsr.step.seleniumExecuteTests(
stepRule.step.seleniumExecuteTests(
script: nullScript,
juStabUtils: utils
) {
@ -59,7 +59,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteSeleniumCustomBuildTool() {
jsr.step.seleniumExecuteTests(
stepRule.step.seleniumExecuteTests(
script: nullScript,
buildTool: 'maven',
juStabUtils: utils
@ -74,7 +74,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteSeleniumError() {
thrown.expectMessage('Error occured')
jsr.step.seleniumExecuteTests(
stepRule.step.seleniumExecuteTests(
script: nullScript,
juStabUtils: utils
) {
@ -84,7 +84,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteSeleniumIgnoreError() {
jsr.step.seleniumExecuteTests(
stepRule.step.seleniumExecuteTests(
script: nullScript,
failOnError: false,
juStabUtils: utils
@ -97,7 +97,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
@Test
void testExecuteSeleniumCustomRepo() {
jsr.step.seleniumExecuteTests(
stepRule.step.seleniumExecuteTests(
script: nullScript,
gitBranch: 'test',
gitSshKeyCredentialsId: 'testCredentials',

View File

@ -19,12 +19,12 @@ class SetupCommonPipelineEnvironmentTest extends BasePiperTest {
def usedConfigFile
def swaOldConfigUsed
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain rules = Rules
.getCommonRules(this)
.around(jsr)
.around(stepRule)
@Before
void init() {
@ -55,7 +55,7 @@ class SetupCommonPipelineEnvironmentTest extends BasePiperTest {
return path.endsWith('.pipeline/config.yml')
})
jsr.step.setupCommonPipelineEnvironment(script: nullScript, utils: getSWAMockedUtils())
stepRule.step.setupCommonPipelineEnvironment(script: nullScript, utils: getSWAMockedUtils())
assertEquals(Boolean.FALSE.toString(), swaOldConfigUsed)
assertEquals('.pipeline/config.yml', usedConfigFile)
@ -71,7 +71,7 @@ class SetupCommonPipelineEnvironmentTest extends BasePiperTest {
return path.endsWith('.pipeline/config.properties')
})
jsr.step.setupCommonPipelineEnvironment(script: nullScript, utils: getSWAMockedUtils())
stepRule.step.setupCommonPipelineEnvironment(script: nullScript, utils: getSWAMockedUtils())
assertEquals(Boolean.TRUE.toString(), swaOldConfigUsed)
assertEquals('.pipeline/config.properties', usedConfigFile)

View File

@ -22,7 +22,7 @@ class SnykExecuteTest extends BasePiperTest {
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
@ -32,7 +32,7 @@ class SnykExecuteTest extends BasePiperTest {
.around(jder)
.around(shellRule)
.around(loggingRule)
.around(jsr)
.around(stepRule)
def withCredentialsParameters
List archiveStepPatterns
@ -74,7 +74,7 @@ class SnykExecuteTest extends BasePiperTest {
thrown.expect(hudson.AbortException)
thrown.expectMessage('[ERROR][snykExecute] ScanType \'seagul\' not supported!')
jsr.step.snykExecute(
stepRule.step.snykExecute(
script: nullScript,
juStabUtils: utils,
scanType: 'seagul'
@ -83,7 +83,7 @@ class SnykExecuteTest extends BasePiperTest {
@Test
void testDefaultsSettings() throws Exception {
jsr.step.snykExecute(
stepRule.step.snykExecute(
script: nullScript,
juStabUtils: utils
)
@ -96,7 +96,7 @@ class SnykExecuteTest extends BasePiperTest {
@Test
void testScanTypeNpm() throws Exception {
jsr.step.snykExecute(
stepRule.step.snykExecute(
script: nullScript,
juStabUtils: utils
)
@ -108,7 +108,7 @@ class SnykExecuteTest extends BasePiperTest {
@Test
void testScanTypeNpmWithOrgAndJsonReport() throws Exception {
jsr.step.snykExecute(
stepRule.step.snykExecute(
script: nullScript,
juStabUtils: utils,
snykOrg: 'myOrg',
@ -121,7 +121,7 @@ class SnykExecuteTest extends BasePiperTest {
@Test
void testScanTypeMta() throws Exception {
jsr.step.snykExecute(
stepRule.step.snykExecute(
script: nullScript,
juStabUtils: utils,
scanType: 'mta'

View File

@ -16,13 +16,13 @@ class TestsPublishResultsTest extends BasePiperTest {
Map publisherStepOptions
List archiveStepPatterns
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(jsr)
.around(stepRule)
@Before
void init() {
@ -48,7 +48,7 @@ class TestsPublishResultsTest extends BasePiperTest {
@Test
void testPublishNothingWithDefaultSettings() throws Exception {
jsr.step.testsPublishResults(script: nullScript)
stepRule.step.testsPublishResults(script: nullScript)
// ensure nothing is published
assertTrue('WarningsPublisher options not empty', publisherStepOptions.junit == null)
@ -59,7 +59,7 @@ class TestsPublishResultsTest extends BasePiperTest {
@Test
void testPublishNothingWithAllDisabled() throws Exception {
jsr.step.testsPublishResults(script: nullScript, junit: false, jacoco: false, cobertura: false, jmeter: false)
stepRule.step.testsPublishResults(script: nullScript, junit: false, jacoco: false, cobertura: false, jmeter: false)
// ensure nothing is published
assertTrue('WarningsPublisher options not empty', publisherStepOptions.junit == null)
@ -70,7 +70,7 @@ class TestsPublishResultsTest extends BasePiperTest {
@Test
void testPublishUnitTestsWithDefaultSettings() throws Exception {
jsr.step.testsPublishResults(script: nullScript, junit: true)
stepRule.step.testsPublishResults(script: nullScript, junit: true)
assertTrue('JUnit options are empty', publisherStepOptions.junit != null)
// ensure default patterns are set
@ -84,7 +84,7 @@ class TestsPublishResultsTest extends BasePiperTest {
@Test
void testPublishCoverageWithDefaultSettings() throws Exception {
jsr.step.testsPublishResults(script: nullScript, jacoco: true, cobertura: true)
stepRule.step.testsPublishResults(script: nullScript, jacoco: true, cobertura: true)
assertTrue('JaCoCo options are empty', publisherStepOptions.jacoco != null)
assertTrue('Cobertura options are empty', publisherStepOptions.cobertura != null)
@ -99,7 +99,7 @@ class TestsPublishResultsTest extends BasePiperTest {
@Test
void testPublishJMeterWithDefaultSettings() throws Exception {
jsr.step.testsPublishResults(script: nullScript, jmeter: true)
stepRule.step.testsPublishResults(script: nullScript, jmeter: true)
assertTrue('JMeter options are empty', publisherStepOptions.jmeter != null)
assertEquals('JMeter default pattern not set',
@ -113,7 +113,7 @@ class TestsPublishResultsTest extends BasePiperTest {
@Test
void testPublishUnitTestsWithCustomSettings() throws Exception {
jsr.step.testsPublishResults(script: nullScript, junit: [pattern: 'fancy/file/path', archive: true, active: true])
stepRule.step.testsPublishResults(script: nullScript, junit: [pattern: 'fancy/file/path', archive: true, active: true])
assertTrue('JUnit options are empty', publisherStepOptions.junit != null)
// ensure default patterns are set

View File

@ -17,7 +17,7 @@ class ToolValidateTest extends BasePiperTest {
private ExpectedException thrown = new ExpectedException().none()
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain ruleChain = Rules
@ -25,7 +25,7 @@ class ToolValidateTest extends BasePiperTest {
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(loggingRule)
.around(jsr)
.around(stepRule)
def home = 'home'
@ -35,7 +35,7 @@ class ToolValidateTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("The parameter 'home' can not be null or empty.")
jsr.step.toolValidate(tool: 'java')
stepRule.step.toolValidate(tool: 'java')
}
@Test
@ -44,7 +44,7 @@ class ToolValidateTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("The parameter 'home' can not be null or empty.")
jsr.step.toolValidate(tool: 'java', home: '')
stepRule.step.toolValidate(tool: 'java', home: '')
}
@Test
@ -55,7 +55,7 @@ class ToolValidateTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("The parameter 'tool' can not be null or empty.")
jsr.step.toolValidate(tool: null, home: home)
stepRule.step.toolValidate(tool: null, home: home)
}
@Test
@ -66,7 +66,7 @@ class ToolValidateTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("The parameter 'tool' can not be null or empty.")
jsr.step.toolValidate(tool: '', home: home)
stepRule.step.toolValidate(tool: '', home: home)
}
@Test
@ -77,7 +77,7 @@ class ToolValidateTest extends BasePiperTest {
thrown.expect(AbortException)
thrown.expectMessage("The tool 'test' is not supported.")
jsr.step.toolValidate(tool: 'test', home: home)
stepRule.step.toolValidate(tool: 'test', home: home)
}
@Test
@ -88,7 +88,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
jsr.step.toolValidate(tool: 'java', home: home)
stepRule.step.toolValidate(tool: 'java', home: home)
}
@Test
@ -99,7 +99,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
jsr.step.toolValidate(tool: 'mta', home: home)
stepRule.step.toolValidate(tool: 'mta', home: home)
}
@Test
@ -110,7 +110,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
jsr.step.toolValidate(tool: 'neo', home: home)
stepRule.step.toolValidate(tool: 'neo', home: home)
}
@Test
@ -121,7 +121,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
jsr.step.toolValidate(tool: 'cm', home: home)
stepRule.step.toolValidate(tool: 'cm', home: home)
}
@Test
@ -132,7 +132,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getIncompatibleVersion(m) })
jsr.step.toolValidate(tool: 'java', home: home)
stepRule.step.toolValidate(tool: 'java', home: home)
}
@Test
@ -143,7 +143,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getIncompatibleVersion(m) })
jsr.step.toolValidate(tool: 'mta', home: home)
stepRule.step.toolValidate(tool: 'mta', home: home)
}
@Test
@ -155,7 +155,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getIncompatibleVersion(m) })
binding.setVariable('tool', 'cm')
jsr.step.toolValidate(tool: 'cm', home: home)
stepRule.step.toolValidate(tool: 'cm', home: home)
}
@Test
@ -163,7 +163,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
jsr.step.toolValidate(tool: 'java', home: home)
stepRule.step.toolValidate(tool: 'java', home: home)
assert loggingRule.log.contains('Verifying Java version 1.8.0 or compatible version.')
assert loggingRule.log.contains('Java version 1.8.0 is installed.')
@ -174,7 +174,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
jsr.step.toolValidate(tool: 'mta', home: home)
stepRule.step.toolValidate(tool: 'mta', home: home)
assert loggingRule.log.contains('Verifying SAP Multitarget Application Archive Builder version 1.0.6 or compatible version.')
assert loggingRule.log.contains('SAP Multitarget Application Archive Builder version 1.0.6 is installed.')
@ -185,7 +185,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
jsr.step.toolValidate(tool: 'neo', home: home)
stepRule.step.toolValidate(tool: 'neo', home: home)
}
@Test
@ -193,7 +193,7 @@ class ToolValidateTest extends BasePiperTest {
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
jsr.step.toolValidate(tool: 'cm', home: home)
stepRule.step.toolValidate(tool: 'cm', home: home)
assert loggingRule.log.contains('Verifying Change Management Command Line Interface version 0.0.1 or compatible version.')
assert loggingRule.log.contains('Change Management Command Line Interface version 0.0.1 is installed.')

View File

@ -20,14 +20,14 @@ import hudson.AbortException
public class TransportRequestCreateTest extends BasePiperTest {
private ExpectedException thrown = new ExpectedException()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
@Rule
public RuleChain ruleChain = Rules.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(jsr)
.around(stepRule)
.around(loggingRule)
.around(new JenkinsCredentialsRule(this)
.withCredentials('CM', 'anonymous', '********'))
@ -69,7 +69,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
}
}
jsr.step.transportRequestCreate(script: nullScript, developmentSystemId: '001', cmUtils: cm)
stepRule.step.transportRequestCreate(script: nullScript, developmentSystemId: '001', cmUtils: cm)
}
@Test
@ -78,7 +78,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR developmentSystemId")
jsr.step.transportRequestCreate(script: nullScript, changeDocumentId: '001')
stepRule.step.transportRequestCreate(script: nullScript, changeDocumentId: '001')
}
@Test
@ -101,7 +101,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
thrown.expect(AbortException)
thrown.expectMessage("Exception message.")
jsr.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
stepRule.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
}
@Test
@ -127,7 +127,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
}
}
jsr.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
stepRule.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001'
assert result == [changeId: '001',
@ -166,7 +166,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
}
}
jsr.step.call(script: nullScript,
stepRule.step.call(script: nullScript,
transportType: 'W',
targetSystem: 'XYZ',
description: 'desc',
@ -191,7 +191,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
loggingRule.expect('[INFO] Change management integration intentionally switched off.')
jsr.step.transportRequestCreate(script: nullScript,
stepRule.step.transportRequestCreate(script: nullScript,
changeManagement: [type: 'NONE'])
}
}

View File

@ -21,14 +21,14 @@ import hudson.scm.NullSCM
public class TransportRequestReleaseTest extends BasePiperTest {
private ExpectedException thrown = new ExpectedException()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
@Rule
public RuleChain ruleChain = Rules.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(thrown)
.around(jsr)
.around(stepRule)
.around(loggingRule)
.around(new JenkinsCredentialsRule(this)
.withCredentials('CM', 'anonymous', '********'))
@ -62,7 +62,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("Change document id not provided (parameter: 'changeDocumentId' or via commit history).")
jsr.step.transportRequestRelease(script: nullScript, transportRequestId: '001', cmUtils: cm)
stepRule.step.transportRequestRelease(script: nullScript, transportRequestId: '001', cmUtils: cm)
}
@Test
@ -80,7 +80,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("Transport request id not provided (parameter: 'transportRequestId' or via commit history).")
jsr.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', cmUtils: cm)
stepRule.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', cmUtils: cm)
}
@Test
@ -102,7 +102,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
}
}
jsr.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '001', cmUtils: cm)
stepRule.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '001', cmUtils: cm)
}
@Test
@ -134,7 +134,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
}
}
jsr.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm)
stepRule.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm)
assert receivedParams == [type: BackendType.SOLMAN,
changeId: '001',
@ -149,7 +149,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
loggingRule.expect('[INFO] Change management integration intentionally switched off.')
jsr.step.transportRequestRelease(script: nullScript,
stepRule.step.transportRequestRelease(script: nullScript,
changeManagement: [type: 'NONE'])
}
}

View File

@ -22,14 +22,14 @@ import hudson.AbortException
public class TransportRequestUploadFileTest extends BasePiperTest {
private ExpectedException thrown = new ExpectedException()
private JenkinsStepRule jsr = new JenkinsStepRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
@Rule
public RuleChain ruleChain = Rules.getCommonRules(this)
.around(thrown)
.around(new JenkinsReadYamlRule(this))
.around(jsr)
.around(stepRule)
.around(loggingRule)
.around(new JenkinsCredentialsRule(this)
.withCredentials('CM', 'anonymous', '********'))
@ -73,7 +73,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(script: nullScript, transportRequestId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
stepRule.step.transportRequestUploadFile(script: nullScript, transportRequestId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
}
@Test
@ -93,7 +93,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("Transport request id not provided (parameter: 'transportRequestId' or via commit history).")
jsr.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
stepRule.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
}
@Test
@ -106,7 +106,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR applicationId")
jsr.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', filePath: '/path')
stepRule.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', filePath: '/path')
}
@Test
@ -115,7 +115,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
thrown.expect(IllegalArgumentException)
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR filePath")
jsr.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', applicationId: 'app')
stepRule.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', applicationId: 'app')
}
@Test
@ -137,7 +137,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
thrown.expect(AbortException)
thrown.expectMessage("Exception message")
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeDocumentId: '001',
transportRequestId: '001',
applicationId: 'app',
@ -172,7 +172,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeManagement: [type: 'CTS'],
transportRequestId: '002',
filePath: '/path',
@ -222,7 +222,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeDocumentId: '001',
transportRequestId: '002',
applicationId: 'app',
@ -263,7 +263,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(
stepRule.step.transportRequestUploadFile(
script: nullScript,
changeDocumentId: '001',
transportRequestId: '002',
@ -293,7 +293,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeDocumentId: '001',
transportRequestId: '002',
applicationId: 'app',
@ -323,7 +323,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeDocumentId: '001',
transportRequestId: '002',
applicationId: 'app',
@ -351,7 +351,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
}
}
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeDocumentId: '001',
transportRequestId: '001',
applicationId: 'app',
@ -365,7 +365,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
thrown.expectMessage('Invalid backend type: \'DUMMY\'. Valid values: [SOLMAN, CTS, NONE]. ' +
'Configuration: \'changeManagement/type\'.')
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
applicationId: 'app',
filePath: '/path',
changeManagement: [type: 'DUMMY'])
@ -377,7 +377,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
loggingRule.expect('[INFO] Change management integration intentionally switched off.')
jsr.step.transportRequestUploadFile(script: nullScript,
stepRule.step.transportRequestUploadFile(script: nullScript,
changeManagement: [type: 'NONE'])
}