2018-08-08 22:21:26 +02:00
|
|
|
package com.sap.piper.versioning
|
|
|
|
|
|
|
|
import org.junit.Rule
|
|
|
|
import org.junit.Test
|
|
|
|
import org.junit.rules.RuleChain
|
|
|
|
import util.BasePiperTest
|
|
|
|
import util.JenkinsReadFileRule
|
|
|
|
import util.JenkinsWriteFileRule
|
|
|
|
import util.Rules
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertEquals
|
|
|
|
|
|
|
|
class PipArtifactVersioningTest extends BasePiperTest{
|
|
|
|
|
2019-01-22 10:33:12 +02:00
|
|
|
JenkinsReadFileRule readFileRule = new JenkinsReadFileRule(this, 'test/resources/versioning/PipArtifactVersioning/')
|
2019-01-22 10:29:15 +02:00
|
|
|
JenkinsWriteFileRule writeFileRule = new JenkinsWriteFileRule(this)
|
2018-08-08 22:21:26 +02:00
|
|
|
|
|
|
|
@Rule
|
|
|
|
public RuleChain ruleChain = Rules
|
|
|
|
.getCommonRules(this)
|
2019-01-22 10:33:12 +02:00
|
|
|
.around(readFileRule)
|
2019-01-22 10:29:15 +02:00
|
|
|
.around(writeFileRule)
|
2018-08-08 22:21:26 +02:00
|
|
|
|
|
|
|
@Test
|
|
|
|
void testVersioning() {
|
|
|
|
PipArtifactVersioning av = new PipArtifactVersioning(nullScript, [filePath: 'version.txt'])
|
|
|
|
assertEquals('1.2.3', av.getVersion())
|
|
|
|
av.setVersion('1.2.3-20180101')
|
2019-01-22 10:29:15 +02:00
|
|
|
assertEquals('1.2.3-20180101', writeFileRule.files['version.txt'])
|
2018-08-08 22:21:26 +02:00
|
|
|
}
|
|
|
|
}
|