1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/test/groovy/NeoDeployTest.groovy

713 lines
23 KiB
Groovy
Raw Normal View History

import com.sap.piper.StepAssertions
import com.sap.piper.Utils
import groovy.lang.Script
2017-07-11 15:12:03 +02:00
import hudson.AbortException
import static org.hamcrest.Matchers.allOf
import static org.hamcrest.Matchers.containsString
import static org.hamcrest.Matchers.not
import static org.junit.Assert.assertThat
import org.hamcrest.Matchers
import org.hamcrest.BaseMatcher
import org.hamcrest.Description
import org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException
import org.junit.After
import org.junit.Assert
2017-07-11 15:12:03 +02:00
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.ExpectedException
import org.junit.rules.RuleChain
import util.BasePiperTest
import util.CommandLineMatcher
import util.JenkinsCredentialsRule
import util.JenkinsLockRule
import util.JenkinsLoggingRule
import util.JenkinsPropertiesRule
import util.JenkinsReadYamlRule
2018-01-16 16:03:00 +02:00
import util.JenkinsShellCallRule
import util.JenkinsShellCallRule.Type
2018-02-28 14:11:09 +02:00
import util.JenkinsStepRule
import util.JenkinsWithEnvRule
2019-03-25 17:42:23 +02:00
import util.JenkinsFileExistsRule
import util.Rules
2017-07-11 15:12:03 +02:00
class NeoDeployTest extends BasePiperTest {
2018-02-20 14:10:14 +02:00
private ExpectedException thrown = new ExpectedException().none()
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
2019-01-22 10:19:28 +02:00
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
2019-01-22 10:25:42 +02:00
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsFileExistsRule fileExistsRule = new JenkinsFileExistsRule(this, ['warArchive.war', 'archive.mtar', 'war.properties'])
2017-07-11 15:12:03 +02:00
@Rule
2018-02-28 14:11:09 +02:00
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
2019-03-26 15:16:01 +02:00
.around(new JenkinsPropertiesRule(this, warPropertiesFileName, warProperties))
2018-02-28 14:11:09 +02:00
.around(thrown)
.around(loggingRule)
2019-01-22 10:19:28 +02:00
.around(shellRule)
.around(new JenkinsCredentialsRule(this)
.withCredentials('myCredentialsId', 'anonymous', '********')
.withCredentials('CI_CREDENTIALS_ID', 'defaultUser', '********'))
2019-01-22 10:25:42 +02:00
.around(stepRule)
.around(new JenkinsLockRule(this))
.around(new JenkinsWithEnvRule(this))
.around(fileExistsRule)
2019-03-25 17:42:23 +02:00
private static warArchiveName = 'warArchive.war'
private static warPropertiesFileName = 'war.properties'
private static archiveName = 'archive.mtar'
2019-03-26 15:16:01 +02:00
private static warProperties
2017-07-11 15:12:03 +02:00
2019-03-25 17:42:23 +02:00
@Before
void init() {
2018-02-12 12:03:07 +02:00
2019-03-26 15:16:01 +02:00
warProperties = new Properties()
warProperties.put('account', 'trialuser123')
warProperties.put('host', 'test.deploy.host.com')
warProperties.put('application', 'testApp')
2017-12-13 11:05:19 +02:00
helper.registerAllowedMethod('dockerExecute', [Map, Closure], null)
2019-03-25 17:42:23 +02:00
helper.registerAllowedMethod('pwd', [], { return './' })
2017-07-11 15:12:03 +02:00
nullScript.commonPipelineEnvironment.configuration = [steps: [neoDeploy: [neo: [host: 'test.deploy.host.com', account: 'trialuser123']]]]
2017-07-11 15:12:03 +02:00
}
@After
void tearDown() {
GroovySystem.metaClassRegistry.removeMetaClass(StepAssertions)
}
@Test
void straightForwardTestConfigViaParameters() {
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo:[credentialsId: 'myCredentialsId'],
utils: utils,
2018-02-28 14:11:09 +02:00
)
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
.hasSingleQuotedOption('user', 'anonymous')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*'))
}
@Test
void straightForwardTestConfigViaConfiguration() {
nullScript.commonPipelineEnvironment.configuration = [steps: [
neoDeploy: [
neo: [
host: 'configuration-frwk.deploy.host.com',
account: 'configurationFrwkUser123'
],
source: archiveName
]
]]
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
neo:[credentialsId: 'myCredentialsId']
)
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'configuration-frwk\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'configurationFrwkUser123')
.hasOption('synchronous', '')
.hasSingleQuotedOption('user', 'anonymous')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', archiveName))
}
@Test
void extensionsAsStringTest() {
def checkedExtensionFiles = []
StepAssertions.metaClass.static.assertFileExists =
getFileExistsCheck(checkedExtensionFiles, [archiveName, 'myExtension.yml'])
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: 'myExtension.yml'
)
assert checkedExtensionFiles.contains('myExtension.yml')
assertThat(shellRule.shell,
new CommandLineMatcher()
.hasProlog('neo.sh deploy-mta')
.hasSingleQuotedOption('extensions', 'myExtension.yml'))
}
@Test
void extensionsAsEmptyString() {
thrown.expect(AbortException)
thrown.expectMessage('extension file name was null or empty')
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: ''
)
}
@Test
void extensionsAsSetTest() {
Set extensions= ['myExtension1.yml' ,'myExtension2.yml']
extensionsAsCollectionTest(extensions)
}
@Test
void extensionsAsCollectionWithEmptyStringTest() {
thrown.expect(AbortException)
thrown.expectMessage('extension file name was null or empty')
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: ['myExtension1.yml' ,''])
}
@Test
void extensionsNullTest() {
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: null)
assert shellRule.shell.find { c -> c.startsWith('neo.sh deploy-mta') && ! c.contains('--extensions') }
}
@Test
void extensionsAsEmptyCollectionTest() {
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: [])
assert shellRule.shell.find { c -> c.startsWith('neo.sh deploy-mta') && ! c.contains('--extensions') }
}
@Test
void extensionsAsCollectionsWithNullEntrySetTest() {
thrown.expect(AbortException)
thrown.expectMessage('extension file name was null or empty')
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: [null])
}
@Test
void extensionsAsListTest() {
List extensions= ['myExtension1.yml' ,'myExtension2.yml']
extensionsAsCollectionTest(extensions)
}
@Test
void sameExtensionProvidedTwiceTest() {
List extensions= ['myExtension1.yml' ,'myExtension2.yml', 'myExtension1.yml']
extensionsAsCollectionTest(extensions)
}
void extensionsAsCollectionTest(def extensions) {
def checkedExtensionFiles = []
StepAssertions.metaClass.static.assertFileExists =
getFileExistsCheck(checkedExtensionFiles, [archiveName, 'myExtension1.yml', 'myExtension2.yml'])
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
extensions: extensions
)
assert checkedExtensionFiles.contains('myExtension1.yml')
assert checkedExtensionFiles.contains('myExtension2.yml')
assertThat(shellRule.shell,
new CommandLineMatcher()
.hasProlog('neo.sh deploy-mta')
// some kind of creative usage for the single quotation check (... single quotes inside)
.hasSingleQuotedOption('extensions', 'myExtension1.yml\',\'myExtension2.yml'))
}
private static getFileExistsCheck(def checkedExtensionFiles, def fileNames) {
{ Script step, String filePath ->
checkedExtensionFiles << filePath
if( ! fileNames.contains(filePath) )
step.error("File ${filePath} cannot be found.")
}
}
@Test
void extensionsForWrongDeployModeTest() {
thrown.expect(AbortException)
thrown.expectMessage('Extensions are only supported for deploy mode \'MTA\'')
stepRule.step.neoDeploy(
script: nullScript,
source: archiveName,
deployMode: 'warParams',
extensions: 'myExtension.yml',
neo:
[
application: 'does',
runtime: 'not',
runtimeVersion: 'matter'
]
)
}
2018-08-17 12:52:01 +02:00
@Test
void archivePathFromCPETest() {
2019-03-26 16:04:30 +02:00
2018-08-17 12:52:01 +02:00
nullScript.commonPipelineEnvironment.setMtarFilePath('archive.mtar')
2019-03-26 16:04:30 +02:00
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript)
2018-08-17 12:52:01 +02:00
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('source', 'archive.mtar'))
2018-08-17 12:52:01 +02:00
}
@Test
void archivePathFromParamsHasHigherPrecedenceThanCPETest() {
2019-03-26 16:04:30 +02:00
2018-08-17 12:52:01 +02:00
nullScript.commonPipelineEnvironment.setMtarFilePath('archive2.mtar')
2019-03-26 16:04:30 +02:00
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: "archive.mtar")
2018-08-17 12:52:01 +02:00
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('source', 'archive.mtar'))
2018-08-17 12:52:01 +02:00
}
2017-07-11 15:12:03 +02:00
@Test
void badCredentialsIdTest() {
thrown.expect(CredentialNotFoundException)
2017-07-11 15:12:03 +02:00
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo:[credentialsId: 'badCredentialsId']
)
2017-07-11 15:12:03 +02:00
}
@Test
void credentialsIdNotProvidedTest() {
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: archiveName
)
2017-07-11 15:12:03 +02:00
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*')
)
2017-07-11 15:12:03 +02:00
}
@Test
void wrongArchivePathProvidedTest() {
thrown.expect(AbortException)
thrown.expectMessage('File wrongArchiveName cannot be found')
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: 'wrongArchiveName')
2017-07-11 15:12:03 +02:00
}
@Test
void sanityChecksDeployModeMTATest() {
2017-07-11 15:12:03 +02:00
thrown.expect(Exception)
thrown.expectMessage(
allOf(
containsString('ERROR - NO VALUE AVAILABLE FOR:'),
containsString('neo/host'),
containsString('neo/account'),
containsString('source')))
nullScript.commonPipelineEnvironment.configuration = [:]
// deployMode mta is the default, but for the sake of transparency it is better to repeat it.
stepRule.step.neoDeploy(script: nullScript, deployMode: 'mta')
}
@Test
public void sanityChecksDeployModeWarPropertiesFileTest() {
thrown.expect(IllegalArgumentException)
// using this deploy mode 'account' and 'host' are provided by the properties file
thrown.expectMessage(
allOf(
not(containsString('neo/host')),
not(containsString('neo/account'))))
nullScript.commonPipelineEnvironment.configuration = [:]
stepRule.step.neoDeploy(script: nullScript, deployMode: 'warPropertiesFile', source: warArchiveName)
}
@Test
public void sanityChecksDeployModeWarParamsTest() {
thrown.expect(IllegalArgumentException)
thrown.expectMessage(
allOf(
containsString('ERROR - NO VALUE AVAILABLE FOR:'),
containsString('neo/application'),
containsString('neo/runtime'),
containsString('neo/runtimeVersion'),
containsString('neo/host'),
containsString('neo/account')))
2017-07-11 15:12:03 +02:00
nullScript.commonPipelineEnvironment.configuration = [:]
stepRule.step.neoDeploy(script: nullScript, deployMode: 'warParams', source: warArchiveName)
2017-07-11 15:12:03 +02:00
}
@Test
void mtaDeployModeTest() {
stepRule.step.neoDeploy(script: nullScript, source: archiveName, deployMode: 'mta')
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*'))
}
@Test
void warFileParamsDeployModeTest() {
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
size: 'lite',
],
deployMode: 'warParams',
warAction: 'deploy',
source: warArchiveName)
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasSingleQuotedOption('application', 'testApp')
.hasSingleQuotedOption('runtime', 'neo-javaee6-wp')
.hasSingleQuotedOption('runtime-version', '2\\.125')
.hasSingleQuotedOption('size', 'lite')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*\\.war'))
}
@Test
void warFileParamsDeployModeRollingUpdateTest() {
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.* status .*', 'Status: STARTED')
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warParams',
warAction: 'rolling-update',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
size: 'lite'
]
)
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh rolling-update")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasSingleQuotedOption('application', 'testApp')
.hasSingleQuotedOption('runtime', 'neo-javaee6-wp')
.hasSingleQuotedOption('runtime-version', '2\\.125')
.hasSingleQuotedOption('size', 'lite')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*\\.war'))
}
@Test
void warFirstTimeRollingUpdateTest() {
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.* status .*', 'ERROR: Application [testApp] not found')
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warParams',
warAction: 'rolling-update',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125'
]
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher()
2019-03-07 13:53:25 +02:00
.hasProlog("neo.sh deploy")
.hasSingleQuotedOption('application', 'testApp'))
}
void warNotStartedRollingUpdateTest() {
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.* status .*', 'Status: STOPPED')
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warParams',
warAction: 'rolling-update',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125'
]
)
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
new CommandLineMatcher()
.hasProlog("\"/opt/neo/tools/neo.sh\" deploy")
.hasSingleQuotedOption('application', 'testApp'))
}
@Test
void showLogsOnFailingDeployment() {
thrown.expect(AbortException)
shellRule.setReturnValue(Type.REGEX, '.* deploy .*', {throw new AbortException()})
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warParams',
warAction: 'deploy',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125'
]
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("cat /var/log/neo/*"))
}
@Test
void warPropertiesFileDeployModeTest() {
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warPropertiesFile',
warAction: 'deploy',
neo: [
propertiesFile: warPropertiesFileName
]
)
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh deploy")
2019-03-26 15:16:01 +02:00
.hasArgument('war.properties')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*\\.war'))
}
@Test
void warPropertiesFileDeployModeRollingUpdateTest() {
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.* status .*', 'Status: STARTED')
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warPropertiesFile',
warAction: 'rolling-update',
neo: [
propertiesFile: warPropertiesFileName
])
2019-01-22 10:19:28 +02:00
Assert.assertThat(shellRule.shell,
2019-03-07 13:53:25 +02:00
new CommandLineMatcher().hasProlog("neo.sh rolling-update")
2019-03-26 15:16:01 +02:00
.hasArgument('war.properties')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*\\.war'))
}
@Test
void illegalDeployModeTest() {
thrown.expect(Exception)
thrown.expectMessage("Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: [mta, warParams, warPropertiesFile].")
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'illegalMode',
warAction: 'deploy',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
size: 'lite'
])
}
@Test
void illegalWARActionTest() {
thrown.expect(Exception)
thrown.expectMessage("Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: [deploy, rolling-update].")
2019-01-22 10:25:42 +02:00
stepRule.step.neoDeploy(script: nullScript,
source: warArchiveName,
deployMode: 'warParams',
warAction: 'illegalWARAction',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
size: 'lite'
])
2017-07-11 15:12:03 +02:00
}
@Test
void dontSwallowExceptionWhenUnableToProvideLogsTest() {
thrown.expect(AbortException)
thrown.expectMessage('The execution of the deploy command failed, see the log for details.')
thrown.expect(new BaseMatcher() {
def expectedException = AbortException
def expectedText = 'Cannot provide logs.'
boolean matches(def ex) {
def suppressed = ex.getSuppressed()
return (suppressed.size() == 1 &&
suppressed[0] in expectedException &&
suppressed[0].message == expectedText)
}
void describeTo(Description d) {
d.appendText(" a suppressed ${expectedException} with message ${expectedText}.")
}
})
loggingRule.expect('Unable to provide the logs.')
helper.registerAllowedMethod('fileExists', [String],
{ f ->
f == 'archive.mtar'
}
)
helper.registerAllowedMethod("sh", [String],
{ cmd ->
if (cmd.toString().contains('cat logs/neo/'))
throw new AbortException('Cannot provide logs.')
if (cmd.toString().contains('neo.sh deploy-mta'))
throw new AbortException('Something went wrong during neo deployment.')
}
)
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo:[credentialsId: 'myCredentialsId'],
deployMode: 'mta',
utils: utils,
)
}
2019-04-30 09:48:47 +02:00
@Test
void deployModeAsGStringTest() {
Map deployProps = [deployMode: 'warPropertiesFile']
stepRule.step.neoDeploy(script: nullScript,
utils: utils,
neo: [credentialsId: 'myCredentialsId',
propertiesFile: warPropertiesFileName],
deployMode: "$deployProps.deployMode",
source: archiveName)
}
@Test
public void DefaultMavenDeploymentModuleNoPomTest() {
thrown.expect(AbortException)
thrown.expectMessage(containsString('does not contain a pom file'))
nullScript.commonPipelineEnvironment.configuration = [:]
stepRule.step.neoDeploy(script: nullScript, deployMode: 'warPropertiesFile')
}
@Test
public void DefaultMavenDeploymentModuleTest() {
helper.registerAllowedMethod('readMavenPom', [Map], { return [artifactId:'artifact', packaging: 'war'] })
fileExistsRule.registerExistingFile('./pom.xml')
fileExistsRule.registerExistingFile('./target/artifact.war')
nullScript.commonPipelineEnvironment.configuration = [:]
stepRule.step.neoDeploy([
script: nullScript,
deployMode: 'warParams',
neo: [
application: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
host: 'host',
account: 'account'
]
])
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("neo.sh deploy")
.hasSingleQuotedOption('source', './target/artifact.war'))
}
2017-07-11 15:12:03 +02:00
}