2019-01-30 17:57:25 +02:00
|
|
|
import java.util.List
|
2018-07-13 15:13:58 +02:00
|
|
|
import java.util.Map
|
|
|
|
|
2018-06-20 11:46:28 +02:00
|
|
|
import org.junit.Before
|
|
|
|
import org.junit.Rule
|
|
|
|
import org.junit.Test
|
|
|
|
import org.junit.rules.ExpectedException
|
|
|
|
import org.junit.rules.RuleChain
|
|
|
|
|
2018-12-14 16:24:03 +02:00
|
|
|
import com.sap.piper.JenkinsUtils
|
2018-09-24 14:06:48 +02:00
|
|
|
import com.sap.piper.cm.BackendType
|
2018-06-29 10:11:46 +02:00
|
|
|
import com.sap.piper.cm.ChangeManagement
|
|
|
|
import com.sap.piper.cm.ChangeManagementException
|
|
|
|
|
2018-06-20 11:46:28 +02:00
|
|
|
import util.BasePiperTest
|
2018-07-13 13:27:21 +02:00
|
|
|
import util.JenkinsCredentialsRule
|
2018-06-20 11:46:28 +02:00
|
|
|
import util.JenkinsStepRule
|
|
|
|
import util.JenkinsLoggingRule
|
2018-08-31 10:22:43 +02:00
|
|
|
import util.JenkinsReadYamlRule
|
2018-06-20 11:46:28 +02:00
|
|
|
import util.Rules
|
|
|
|
|
|
|
|
import hudson.AbortException
|
|
|
|
|
|
|
|
public class TransportRequestUploadFileTest extends BasePiperTest {
|
|
|
|
|
|
|
|
private ExpectedException thrown = new ExpectedException()
|
2019-01-22 10:25:42 +02:00
|
|
|
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
2019-01-22 10:22:15 +02:00
|
|
|
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
2018-06-20 11:46:28 +02:00
|
|
|
|
|
|
|
@Rule
|
|
|
|
public RuleChain ruleChain = Rules.getCommonRules(this)
|
|
|
|
.around(thrown)
|
2018-08-31 10:22:43 +02:00
|
|
|
.around(new JenkinsReadYamlRule(this))
|
2019-01-22 10:25:42 +02:00
|
|
|
.around(stepRule)
|
2019-01-22 10:22:15 +02:00
|
|
|
.around(loggingRule)
|
2018-07-13 13:27:21 +02:00
|
|
|
.around(new JenkinsCredentialsRule(this)
|
|
|
|
.withCredentials('CM', 'anonymous', '********'))
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-13 15:13:58 +02:00
|
|
|
private Map cmUtilReceivedParams = [:]
|
2018-06-20 11:46:28 +02:00
|
|
|
|
|
|
|
@Before
|
|
|
|
public void setup() {
|
|
|
|
|
2018-07-13 15:13:58 +02:00
|
|
|
cmUtilReceivedParams.clear()
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-17 09:21:56 +02:00
|
|
|
nullScript.commonPipelineEnvironment.configuration = [general:
|
|
|
|
[changeManagement:
|
2018-06-20 11:46:28 +02:00
|
|
|
[
|
2018-06-28 16:24:14 +02:00
|
|
|
credentialsId: 'CM',
|
2018-09-28 14:06:06 +02:00
|
|
|
type: 'SOLMAN',
|
2018-06-28 16:24:14 +02:00
|
|
|
endpoint: 'https://example.org/cm'
|
2018-06-20 11:46:28 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2018-09-24 14:06:48 +02:00
|
|
|
public void changeDocumentIdNotProvidedSOLMANTest() {
|
|
|
|
|
|
|
|
// we expect the failure only for SOLMAN (which is the default).
|
|
|
|
// Use case for CTS without change document id is checked by the
|
|
|
|
// straight forward test case for CTS
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-12 08:54:04 +02:00
|
|
|
thrown.expect(IllegalArgumentException)
|
2018-07-13 09:28:41 +02:00
|
|
|
thrown.expectMessage("Change document id not provided (parameter: 'changeDocumentId' or via commit history).")
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-10 15:15:54 +02:00
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
|
|
|
String getChangeDocumentId(
|
|
|
|
String from,
|
|
|
|
String to,
|
|
|
|
String pattern,
|
|
|
|
String format
|
|
|
|
) {
|
|
|
|
throw new ChangeManagementException('Cannot retrieve changeId from git commits.')
|
2018-07-12 13:55:01 +02:00
|
|
|
}
|
2018-07-10 15:15:54 +02:00
|
|
|
}
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript, transportRequestId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void transportRequestIdNotProvidedTest() {
|
|
|
|
|
2018-07-12 13:55:01 +02:00
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
|
|
|
String getTransportRequestId(
|
|
|
|
String from,
|
|
|
|
String to,
|
|
|
|
String pattern,
|
|
|
|
String format
|
|
|
|
) {
|
|
|
|
throw new ChangeManagementException('Cannot retrieve transport request id from git commits.')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-12 08:54:04 +02:00
|
|
|
thrown.expect(IllegalArgumentException)
|
2018-07-16 11:04:20 +02:00
|
|
|
thrown.expectMessage("Transport request id not provided (parameter: 'transportRequestId' or via commit history).")
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2018-09-24 14:06:48 +02:00
|
|
|
public void applicationIdNotProvidedSOLMANTest() {
|
|
|
|
|
|
|
|
// we expect the failure only for SOLMAN (which is the default).
|
|
|
|
// Use case for CTS without applicationId is checked by the
|
|
|
|
// straight forward test case for CTS
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-12 08:54:04 +02:00
|
|
|
thrown.expect(IllegalArgumentException)
|
|
|
|
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR applicationId")
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', filePath: '/path')
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void filePathNotProvidedTest() {
|
|
|
|
|
2018-07-12 08:54:04 +02:00
|
|
|
thrown.expect(IllegalArgumentException)
|
|
|
|
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR filePath")
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', applicationId: 'app')
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2019-01-30 15:53:34 +02:00
|
|
|
public void uploadFileToTransportRequestSOLMANFailureTest() {
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-06-29 10:11:46 +02:00
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestSOLMAN(
|
2018-09-18 12:29:14 +02:00
|
|
|
String changeId,
|
2018-06-29 10:11:46 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
2018-07-16 15:41:46 +02:00
|
|
|
String credentialsId,
|
2018-06-29 14:54:29 +02:00
|
|
|
String cmclientOpts) {
|
2018-06-29 10:11:46 +02:00
|
|
|
throw new ChangeManagementException('Exception message')
|
|
|
|
}
|
|
|
|
}
|
2018-06-20 11:46:28 +02:00
|
|
|
|
|
|
|
thrown.expect(AbortException)
|
2018-06-29 10:11:46 +02:00
|
|
|
thrown.expectMessage("Exception message")
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-06-29 10:11:46 +02:00
|
|
|
changeDocumentId: '001',
|
|
|
|
transportRequestId: '001',
|
|
|
|
applicationId: 'app',
|
|
|
|
filePath: '/path',
|
|
|
|
cmUtils: cm)
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2018-09-24 14:06:48 +02:00
|
|
|
public void uploadFileToTransportRequestCTSSuccessTest() {
|
|
|
|
|
2019-01-22 10:22:15 +02:00
|
|
|
loggingRule.expect("[INFO] Uploading file '/path' to transport request '002'.")
|
|
|
|
loggingRule.expect("[INFO] File '/path' has been successfully uploaded to transport request '002'.")
|
2018-09-24 14:06:48 +02:00
|
|
|
|
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestCTS(
|
2018-09-24 14:06:48 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
|
|
|
String credentialsId,
|
|
|
|
String cmclientOpts) {
|
|
|
|
|
|
|
|
cmUtilReceivedParams.transportRequestId = transportRequestId
|
|
|
|
cmUtilReceivedParams.applicationId = applicationId
|
|
|
|
cmUtilReceivedParams.filePath = filePath
|
|
|
|
cmUtilReceivedParams.endpoint = endpoint
|
|
|
|
cmUtilReceivedParams.credentialsId = credentialsId
|
|
|
|
cmUtilReceivedParams.cmclientOpts = cmclientOpts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-09-24 14:06:48 +02:00
|
|
|
changeManagement: [type: 'CTS'],
|
|
|
|
transportRequestId: '002',
|
|
|
|
filePath: '/path',
|
|
|
|
cmUtils: cm)
|
|
|
|
|
|
|
|
assert cmUtilReceivedParams ==
|
|
|
|
[
|
|
|
|
transportRequestId: '002',
|
|
|
|
applicationId: null,
|
|
|
|
filePath: '/path',
|
|
|
|
endpoint: 'https://example.org/cm',
|
|
|
|
credentialsId: 'CM',
|
|
|
|
cmclientOpts: ''
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2018-12-14 16:24:03 +02:00
|
|
|
@Test
|
|
|
|
public void uploadFileToTransportRequestRFCSuccessTest() {
|
|
|
|
|
2019-01-30 17:57:25 +02:00
|
|
|
def cmUtilsReceivedParams
|
2018-12-14 16:24:03 +02:00
|
|
|
|
2019-01-30 17:57:25 +02:00
|
|
|
nullScript.commonPipelineEnvironment.configuration =
|
|
|
|
[general:
|
|
|
|
[changeManagement:
|
|
|
|
[
|
|
|
|
endpoint: 'https://example.org/rfc'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
def cm = new ChangeManagement(nullScript) {
|
|
|
|
|
|
|
|
void uploadFileToTransportRequestRFC(
|
|
|
|
String dockerImage,
|
|
|
|
List dockerOptions,
|
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String applicationURL,
|
|
|
|
String endpoint,
|
|
|
|
String credentialsId,
|
|
|
|
String developmentInstance,
|
|
|
|
String developmentClient,
|
|
|
|
String applicationDescription,
|
|
|
|
String abapPackage) {
|
|
|
|
|
|
|
|
cmUtilsReceivedParams = [
|
|
|
|
dockerImage: dockerImage,
|
|
|
|
dockerOptions: dockerOptions,
|
|
|
|
transportRequestId: transportRequestId,
|
|
|
|
applicationId: applicationId,
|
|
|
|
applicationURL: applicationURL,
|
|
|
|
endpoint: endpoint,
|
|
|
|
credentialsId: credentialsId,
|
|
|
|
developmentInstance: developmentInstance,
|
|
|
|
developmentClient: developmentClient,
|
|
|
|
applicationDescription: applicationDescription,
|
|
|
|
abapPackage: abapPackage]
|
|
|
|
}
|
|
|
|
}
|
2018-12-14 16:24:03 +02:00
|
|
|
|
2019-01-29 16:23:27 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2019-01-30 11:16:38 +02:00
|
|
|
applicationUrl: 'http://example.org/blobstore/xyz.zip',
|
2018-12-14 16:24:03 +02:00
|
|
|
transportRequestId: '123456',
|
|
|
|
changeManagement: [type: 'RFC'],
|
|
|
|
developmentInstance:'001',
|
|
|
|
developmentClient: '002',
|
|
|
|
applicationId: '42',
|
|
|
|
applicationDescription: 'Lorem ipsum',
|
2019-01-30 17:57:25 +02:00
|
|
|
abapPackage: 'XYZ',
|
|
|
|
cmUtils: cm,)
|
2018-12-14 16:24:03 +02:00
|
|
|
|
2019-01-30 17:57:25 +02:00
|
|
|
assert cmUtilsReceivedParams ==
|
|
|
|
[
|
|
|
|
dockerImage: 'rfc',
|
|
|
|
dockerOptions: [],
|
|
|
|
transportRequestId: '123456',
|
|
|
|
applicationId: '42',
|
|
|
|
applicationURL: 'http://example.org/blobstore/xyz.zip',
|
|
|
|
endpoint: 'https://example.org/rfc',
|
|
|
|
credentialsId: 'CM',
|
|
|
|
developmentInstance: '001',
|
|
|
|
developmentClient: '002',
|
|
|
|
applicationDescription: 'Lorem ipsum',
|
|
|
|
abapPackage:'XYZ'
|
|
|
|
]
|
|
|
|
}
|
2018-12-14 16:24:03 +02:00
|
|
|
|
2018-09-24 14:06:48 +02:00
|
|
|
@Test
|
|
|
|
public void uploadFileToTransportRequestSOLMANSuccessTest() {
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-11-06 14:47:32 +02:00
|
|
|
// Here we test only the case where the transportRequestId is
|
|
|
|
// provided via parameters. The other cases are tested by
|
|
|
|
// corresponding tests for StepHelpers#getTransportRequestId(./.)
|
|
|
|
|
2019-01-22 10:22:15 +02:00
|
|
|
loggingRule.expect("[INFO] Uploading file '/path' to transport request '002' of change document '001'.")
|
|
|
|
loggingRule.expect("[INFO] File '/path' has been successfully uploaded to transport request '002' of change document '001'.")
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-13 15:13:58 +02:00
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestSOLMAN(
|
2018-09-18 12:29:14 +02:00
|
|
|
String changeId,
|
2018-07-13 15:13:58 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
2018-07-16 15:41:46 +02:00
|
|
|
String credentialsId,
|
2018-07-13 15:13:58 +02:00
|
|
|
String cmclientOpts) {
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-13 15:13:58 +02:00
|
|
|
cmUtilReceivedParams.changeId = changeId
|
|
|
|
cmUtilReceivedParams.transportRequestId = transportRequestId
|
|
|
|
cmUtilReceivedParams.applicationId = applicationId
|
|
|
|
cmUtilReceivedParams.filePath = filePath
|
|
|
|
cmUtilReceivedParams.endpoint = endpoint
|
2018-07-16 15:41:46 +02:00
|
|
|
cmUtilReceivedParams.credentialsId = credentialsId
|
2018-07-13 15:13:58 +02:00
|
|
|
cmUtilReceivedParams.cmclientOpts = cmclientOpts
|
|
|
|
}
|
|
|
|
}
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-07-13 14:40:29 +02:00
|
|
|
changeDocumentId: '001',
|
2018-07-13 15:13:58 +02:00
|
|
|
transportRequestId: '002',
|
2018-07-13 14:40:29 +02:00
|
|
|
applicationId: 'app',
|
2018-07-13 15:13:58 +02:00
|
|
|
filePath: '/path',
|
|
|
|
cmUtils: cm)
|
|
|
|
|
|
|
|
assert cmUtilReceivedParams ==
|
|
|
|
[
|
|
|
|
changeId: '001',
|
|
|
|
transportRequestId: '002',
|
|
|
|
applicationId: 'app',
|
|
|
|
filePath: '/path',
|
|
|
|
endpoint: 'https://example.org/cm',
|
2018-07-16 15:41:46 +02:00
|
|
|
credentialsId: 'CM',
|
2018-07-25 12:26:20 +02:00
|
|
|
cmclientOpts: ''
|
2018-07-13 15:13:58 +02:00
|
|
|
]
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
2018-07-13 15:13:58 +02:00
|
|
|
|
2018-08-03 12:41:50 +02:00
|
|
|
@Test
|
2019-01-30 15:53:34 +02:00
|
|
|
public void uploadFileToTransportRequestSOLMANSuccessApplicationIdFromConfigurationTest() {
|
2018-08-03 12:41:50 +02:00
|
|
|
|
|
|
|
nullScript.commonPipelineEnvironment.configuration.put(['steps',
|
|
|
|
[transportRequestUploadFile:
|
|
|
|
[applicationId: 'AppIdfromConfig']]])
|
|
|
|
|
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestSOLMAN(
|
2018-09-18 12:29:14 +02:00
|
|
|
String changeId,
|
2018-08-03 12:41:50 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
|
|
|
String credentialsId,
|
|
|
|
String cmclientOpts) {
|
|
|
|
|
|
|
|
cmUtilReceivedParams.applicationId = applicationId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(
|
2018-08-03 12:41:50 +02:00
|
|
|
script: nullScript,
|
|
|
|
changeDocumentId: '001',
|
|
|
|
transportRequestId: '002',
|
|
|
|
filePath: '/path',
|
|
|
|
cmUtils: cm)
|
|
|
|
|
|
|
|
assert cmUtilReceivedParams.applicationId == 'AppIdfromConfig'
|
|
|
|
}
|
|
|
|
|
2018-07-31 15:43:25 +02:00
|
|
|
@Test
|
2019-01-30 15:53:34 +02:00
|
|
|
public void uploadFileToTransportRequestSOLMANFilePathFromParameters() {
|
2018-07-31 15:43:25 +02:00
|
|
|
|
|
|
|
// this one is not used when file path is provided via signature
|
|
|
|
nullScript.commonPipelineEnvironment.setMtarFilePath('/path2')
|
|
|
|
|
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestSOLMAN(
|
2018-09-18 12:29:14 +02:00
|
|
|
String changeId,
|
2018-07-31 15:43:25 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
2018-07-16 15:41:46 +02:00
|
|
|
String credentialsId,
|
2018-07-31 15:43:25 +02:00
|
|
|
String cmclientOpts) {
|
|
|
|
|
|
|
|
cmUtilReceivedParams.filePath = filePath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-07-31 15:43:25 +02:00
|
|
|
changeDocumentId: '001',
|
|
|
|
transportRequestId: '002',
|
|
|
|
applicationId: 'app',
|
|
|
|
filePath: '/path',
|
|
|
|
cmUtils: cm)
|
|
|
|
|
|
|
|
assert cmUtilReceivedParams.filePath == '/path'
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2019-01-30 15:53:34 +02:00
|
|
|
public void uploadFileToTransportRequestSOLMANFilePathFromCommonPipelineEnvironment() {
|
2018-07-31 15:43:25 +02:00
|
|
|
|
|
|
|
// this one is used since there is nothing in the signature
|
|
|
|
nullScript.commonPipelineEnvironment.setMtarFilePath('/path2')
|
|
|
|
|
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestSOLMAN(
|
2018-09-18 12:29:14 +02:00
|
|
|
String changeId,
|
2018-07-31 15:43:25 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
2018-07-16 15:41:46 +02:00
|
|
|
String credentialsId,
|
2018-07-31 15:43:25 +02:00
|
|
|
String cmclientOpts) {
|
|
|
|
|
|
|
|
cmUtilReceivedParams.filePath = filePath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-07-31 15:43:25 +02:00
|
|
|
changeDocumentId: '001',
|
|
|
|
transportRequestId: '002',
|
|
|
|
applicationId: 'app',
|
|
|
|
cmUtils: cm)
|
|
|
|
|
|
|
|
assert cmUtilReceivedParams.filePath == '/path2'
|
|
|
|
}
|
|
|
|
|
2018-07-13 15:13:58 +02:00
|
|
|
@Test
|
2019-01-30 15:53:34 +02:00
|
|
|
public void uploadFileToTransportRequestSOLMANUploadFailureTest() {
|
2018-07-13 15:13:58 +02:00
|
|
|
|
|
|
|
thrown.expect(AbortException)
|
|
|
|
thrown.expectMessage('Upload failure.')
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2018-07-13 15:13:58 +02:00
|
|
|
ChangeManagement cm = new ChangeManagement(nullScript) {
|
2018-12-14 16:24:03 +02:00
|
|
|
void uploadFileToTransportRequestSOLMAN(
|
2018-09-18 12:29:14 +02:00
|
|
|
String changeId,
|
2018-07-13 15:13:58 +02:00
|
|
|
String transportRequestId,
|
|
|
|
String applicationId,
|
|
|
|
String filePath,
|
|
|
|
String endpoint,
|
2018-07-16 15:41:46 +02:00
|
|
|
String credentialsId,
|
2018-07-13 15:13:58 +02:00
|
|
|
String cmclientOpts) {
|
|
|
|
throw new ChangeManagementException('Upload failure.')
|
|
|
|
}
|
|
|
|
}
|
2018-06-20 11:46:28 +02:00
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-07-13 15:13:58 +02:00
|
|
|
changeDocumentId: '001',
|
|
|
|
transportRequestId: '001',
|
|
|
|
applicationId: 'app',
|
|
|
|
filePath: '/path',
|
|
|
|
cmUtils: cm)
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|
2018-07-13 15:13:58 +02:00
|
|
|
|
2018-09-18 14:49:06 +02:00
|
|
|
@Test
|
|
|
|
public void invalidBackendTypeTest() {
|
|
|
|
thrown.expect(AbortException)
|
2018-12-14 16:24:03 +02:00
|
|
|
thrown.expectMessage('Invalid backend type: \'DUMMY\'. Valid values: [SOLMAN, CTS, RFC, NONE]. ' +
|
2018-09-18 14:49:06 +02:00
|
|
|
'Configuration: \'changeManagement/type\'.')
|
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-09-18 14:49:06 +02:00
|
|
|
applicationId: 'app',
|
|
|
|
filePath: '/path',
|
|
|
|
changeManagement: [type: 'DUMMY'])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-09-28 13:45:26 +02:00
|
|
|
@Test
|
|
|
|
public void cmIntegrationSwichtedOffTest() {
|
|
|
|
|
2019-01-22 10:22:15 +02:00
|
|
|
loggingRule.expect('[INFO] Change management integration intentionally switched off.')
|
2018-09-28 13:45:26 +02:00
|
|
|
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
2018-09-28 13:45:26 +02:00
|
|
|
changeManagement: [type: 'NONE'])
|
|
|
|
}
|
|
|
|
|
2018-06-20 11:46:28 +02:00
|
|
|
}
|