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

Merge pull request #238 from marcusholl/pr/transportRequestUploadFilewithMtarFileFromCPE

Take mtarFilePath in commonPipelineEnviroment into account
This commit is contained in:
Marcus Holl 2018-08-03 08:55:01 +02:00 committed by GitHub
commit f190f05ec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 0 deletions

View File

@ -181,6 +181,65 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
]
}
@Test
public void uploadFileToTransportRequestFilePathFromParameters() {
// this one is not used when file path is provided via signature
nullScript.commonPipelineEnvironment.setMtarFilePath('/path2')
ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequest(String changeId,
String transportRequestId,
String applicationId,
String filePath,
String endpoint,
String username,
String password,
String cmclientOpts) {
cmUtilReceivedParams.filePath = filePath
}
}
jsr.step.call(script: nullScript,
changeDocumentId: '001',
transportRequestId: '002',
applicationId: 'app',
filePath: '/path',
cmUtils: cm)
assert cmUtilReceivedParams.filePath == '/path'
}
@Test
public void uploadFileToTransportRequestFilePathFromCommonPipelineEnvironment() {
// this one is used since there is nothing in the signature
nullScript.commonPipelineEnvironment.setMtarFilePath('/path2')
ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequest(String changeId,
String transportRequestId,
String applicationId,
String filePath,
String endpoint,
String username,
String password,
String cmclientOpts) {
cmUtilReceivedParams.filePath = filePath
}
}
jsr.step.call(script: nullScript,
changeDocumentId: '001',
transportRequestId: '002',
applicationId: 'app',
cmUtils: cm)
assert cmUtilReceivedParams.filePath == '/path2'
}
@Test
public void uploadFileToTransportRequestUploadFailureTest() {

View File

@ -37,6 +37,7 @@ def call(parameters = [:]) {
.mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, stepConfigurationKeys)
.mixinStepConfig(script.commonPipelineEnvironment, stepConfigurationKeys)
.mixin(parameters, parameterKeys)
.addIfEmpty('filePath', script.commonPipelineEnvironment.getMtarFilePath())
.withMandatoryProperty('applicationId')
.withMandatoryProperty('changeManagement/changeDocumentLabel')
.withMandatoryProperty('changeManagement/clientOpts')