1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Better readable rule names: readYamlRule

This commit is contained in:
Marcus Holl 2019-01-22 09:27:01 +01:00
parent 4e01b94458
commit 5c0abfdff8
3 changed files with 20 additions and 20 deletions

View File

@ -34,7 +34,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
private JenkinsDockerExecuteRule jedr = new JenkinsDockerExecuteRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this)
private JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this)
private JenkinsReadYamlRule readYamlRule = new JenkinsReadYamlRule(this)
private writeInfluxMap = [:]
@ -47,7 +47,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Rule
public RuleChain rules = Rules
.getCommonRules(this)
.around(jryr)
.around(readYamlRule)
.around(thrown)
.around(loggingRule)
.around(shellRule)
@ -125,7 +125,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeWithAppName() {
jryr.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
readYamlRule.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
helper.registerAllowedMethod('writeYaml', [Map], { Map parameters ->
generatedFile = parameters.file
data = parameters.data
@ -152,7 +152,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeWithAppNameCustomApi() {
jryr.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
readYamlRule.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
helper.registerAllowedMethod('writeYaml', [Map], { Map parameters ->
generatedFile = parameters.file
data = parameters.data
@ -175,7 +175,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeWithAppNameCompatible() {
jryr.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
readYamlRule.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
helper.registerAllowedMethod('writeYaml', [Map], { Map parameters ->
generatedFile = parameters.file
data = parameters.data
@ -205,7 +205,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeAppNameFromManifest() {
helper.registerAllowedMethod('fileExists', [String.class], { s -> return true })
jryr.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
readYamlRule.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
helper.registerAllowedMethod('writeYaml', [Map], { Map parameters ->
generatedFile = parameters.file
data = parameters.data
@ -230,7 +230,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeWithoutAppName() {
helper.registerAllowedMethod('fileExists', [String.class], { s -> return true })
jryr.registerYaml('test.yml', "applications: [[]]")
readYamlRule.registerYaml('test.yml', "applications: [[]]")
helper.registerAllowedMethod('writeYaml', [Map], { Map parameters ->
generatedFile = parameters.file
data = parameters.data
@ -253,7 +253,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeBlueGreenDefaultDeleteOldInstance() {
jryr.registerYaml('test.yml', "applications: [[]]")
readYamlRule.registerYaml('test.yml', "applications: [[]]")
stepRule.step.cloudFoundryDeploy([
script: nullScript,
@ -280,7 +280,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeBlueGreenExplicitDeleteOldInstance() {
jryr.registerYaml('test.yml', "applications: [[]]")
readYamlRule.registerYaml('test.yml', "applications: [[]]")
stepRule.step.cloudFoundryDeploy([
script: nullScript,
@ -309,7 +309,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeBlueGreenKeepOldInstance() {
jryr.registerYaml('test.yml', "applications: [[]]")
readYamlRule.registerYaml('test.yml', "applications: [[]]")
stepRule.step.cloudFoundryDeploy([
script: nullScript,
@ -337,7 +337,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testCfNativeStandardShouldNotStopInstance() {
jryr.registerYaml('test.yml', "applications: [[]]")
readYamlRule.registerYaml('test.yml', "applications: [[]]")
stepRule.step.cloudFoundryDeploy([
script: nullScript,
@ -360,7 +360,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
void testCfNativeWithoutAppNameBlueGreen() {
helper.registerAllowedMethod('fileExists', [String.class], { s -> return true })
jryr.registerYaml('test.yml', "applications: [[]]")
readYamlRule.registerYaml('test.yml', "applications: [[]]")
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)')
@ -419,7 +419,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
@Test
void testInfluxReporting() {
jryr.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
readYamlRule.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
helper.registerAllowedMethod('writeYaml', [Map], { Map parameters ->
generatedFile = parameters.file
data = parameters.data

View File

@ -47,13 +47,13 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
*/
JenkinsStepRule stepRule = new JenkinsStepRule(this)
JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this)
JenkinsReadYamlRule readYamlRule = new JenkinsReadYamlRule(this)
JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(jryr)
.around(readYamlRule)
.around(stepRule)
.around(shellRule)
.around(new JenkinsCredentialsRule(this)
@ -88,7 +88,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
//
// the properties below we read out of the yaml file
jryr.registerYaml('mta.yaml', ('''
readYamlRule.registerYaml('mta.yaml', ('''
|ID : "test"
|PATH : "."
|''' as CharSequence).stripMargin())

View File

@ -25,12 +25,12 @@ public class MtaBuildTest extends BasePiperTest {
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this).registerYaml('mta.yaml', defaultMtaYaml() )
private JenkinsReadYamlRule readYamlRule = new JenkinsReadYamlRule(this).registerYaml('mta.yaml', defaultMtaYaml() )
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(jryr)
.around(readYamlRule)
.around(thrown)
.around(loggingRule)
.around(shellRule)
@ -112,7 +112,7 @@ public class MtaBuildTest extends BasePiperTest {
thrown.expect(ParserException)
thrown.expectMessage('while parsing a block mapping')
jryr.registerYaml('mta.yaml', badMtaYaml())
readYamlRule.registerYaml('mta.yaml', badMtaYaml())
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
}
@ -124,7 +124,7 @@ public class MtaBuildTest extends BasePiperTest {
thrown.expect(AbortException)
thrown.expectMessage("Property 'ID' not found in mta.yaml file.")
jryr.registerYaml('mta.yaml', noIdMtaYaml() )
readYamlRule.registerYaml('mta.yaml', noIdMtaYaml() )
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
}