diff --git a/CHANGELOG.md b/CHANGELOG.md index 7494906e3..0cb9a66c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ - RM: test component causes new jenkins (run) instance after branch is created for release ([#823](https://github.com/opendevstack/ods-jenkins-shared-library/issues/823)) - Improve error message when two coded tests are linked to the same test issue ([#826](https://github.com/opendevstack/ods-jenkins-shared-library/pull/826)) +- Remove support for EDP 1.0 projects in the Release Manager ([#748](https://github.com/opendevstack/ods-jenkins-shared-library/pull/748)) ## [3.0] - 2020-08-11 diff --git a/src/org/ods/orchestration/service/JiraService.groovy b/src/org/ods/orchestration/service/JiraService.groovy index a42c701e1..7dd585bc5 100644 --- a/src/org/ods/orchestration/service/JiraService.groovy +++ b/src/org/ods/orchestration/service/JiraService.groovy @@ -240,34 +240,6 @@ class JiraService { return createIssueType("Bug", projectKey, summary, description, fixVersion) } - @NonCPS - Map getDocGenData(String projectKey) { - if (!projectKey?.trim()) { - throw new IllegalArgumentException('Error: unable to get documentation generation data from Jira. ' + - '\'projectKey\' is undefined.') - } - - def response = Unirest.get("${this.baseURL}/rest/platform/1.0/docgenreports/{projectKey}") - .routeParam("projectKey", projectKey.toUpperCase()) - .basicAuth(this.username, this.password) - .header("Accept", "application/json") - .asString() - - response.ifFailure { - def message = 'Error: unable to get documentation generation data. Jira responded with code: ' + - "'${response.getStatus()}' and message: '${response.getBody()}'." - - if (response.getStatus() == 404) { - message = 'Error: unable to get documentation generation data. ' + - "Jira could not be found at: '${this.baseURL}'." - } - - throw new RuntimeException(message) - } - - return new JsonSlurperClassic().parseText(StringCleanup.removeCharacters(response.getBody(), CHARACTER_REMOVEABLE)) - } - @NonCPS Map getDeltaDocGenData(String projectKey, String version) { if (!projectKey?.trim()) { @@ -685,43 +657,4 @@ class JiraService { new JsonSlurperClassic().parseText(response.getBody()).getOrDefault("fields", [:]) } - @NonCPS - Boolean isVersionEnabledForDelta(String projectKey, String versionName) { - if (!projectKey?.trim()) { - throw new IllegalArgumentException('Error: unable to check project versions from Jira. ' + - '\'projectKey\' is undefined.') - } - - if (!versionName?.trim()) { - throw new IllegalArgumentException('Error: unable to check project versions from Jira. ' + - '\'versionName\' is undefined.') - } - - def response = Unirest.get("${this.baseURL}/rest/platform/1.1/productreleases/{projectKey}/versions/{version}") - .routeParam('projectKey', projectKey.toUpperCase()) - .routeParam('version', versionName) - .basicAuth(this.username, this.password) - .header('Accept', 'application/json') - .asString() - - response.ifFailure { - if (response.getStatus() == 400) { - if(response.getBody().contains("Invalid project versionName.")) { - return false - } - } - def message = 'Error: unable to get project versions in url ' + - "${this.baseURL}/rest/platform/1.1/productreleases/${projectKey.toUpperCase()}/versions/${versionName}" + - ' Jira responded with code: ' + - "'${response.getStatus()}' and message: '${response.getBody()}'." - - if (response.getStatus() == 404) { - message = "Error: unable to get project versions. Jira could not be found at: '${this.baseURL}'." - } - - throw new RuntimeException(message) - } - return true - } - } diff --git a/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy b/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy index f5e391404..c1990d3c7 100644 --- a/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy +++ b/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy @@ -1649,14 +1649,8 @@ class LeVADocumentUseCase extends DocGenUseCase { def documentationTrackingIssueFields = this.project.getJiraFieldsForIssueType(JiraUseCase.IssueTypes.DOCUMENTATION_TRACKING) def documentationTrackingIssueDocumentVersionField = documentationTrackingIssueFields[JiraUseCase.CustomIssueFields.DOCUMENT_VERSION] - if (this.project.isVersioningEnabled) { - if (!this.project.isDeveloperPreviewMode() && !this.project.hasWipJiraIssues()) { - // In case of generating a final document, we add the label for the version that should be released - this.jiraUseCase.jira.updateTextFieldsOnIssue(jiraIssueKey, - [(documentationTrackingIssueDocumentVersionField.id): "${docVersionId}"]) - } - } else { - // TODO removeme for ODS 4.0 + if (!this.project.isDeveloperPreviewMode() && !this.project.hasWipJiraIssues()) { + // In case of generating a final document, we add the label for the version that should be released this.jiraUseCase.jira.updateTextFieldsOnIssue(jiraIssueKey, [(documentationTrackingIssueDocumentVersionField.id): "${docVersionId}"]) } @@ -1761,25 +1755,18 @@ class LeVADocumentUseCase extends DocGenUseCase { } protected String getVersion(Project project, String doc) { - def version - - if (project.isVersioningEnabled) { - version = project.getDocumentVersionFromHistories(doc) - if (!version) { - // The document has not (yet) been generated in this pipeline run. - def envs = Environment.values().collect { it.toString() } - def trackingIssues = this.getDocumentTrackingIssuesForHistory(doc, envs) - version = this.jiraUseCase.getLatestDocVersionId(trackingIssues) - if (project.isWorkInProgress || - LeVADocumentScheduler.getFirstCreationEnvironment(doc) == - project.buildParams.targetEnvironmentToken ) { - // Either this is a developer preview or the history is to be updated in this environment. - version += 1L - } + def version = project.getDocumentVersionFromHistories(doc) + if (!version) { + // The document has not (yet) been generated in this pipeline run. + def envs = Environment.values().collect { it.toString() } + def trackingIssues = this.getDocumentTrackingIssuesForHistory(doc, envs) + version = this.jiraUseCase.getLatestDocVersionId(trackingIssues) + if (project.isWorkInProgress || + LeVADocumentScheduler.getFirstCreationEnvironment(doc) == + project.buildParams.targetEnvironmentToken ) { + // Either this is a developer preview or the history is to be updated in this environment. + version += 1L } - } else { - // TODO removeme in ODS 4.x - version = "${project.buildParams.version}-${this.steps.env.BUILD_NUMBER}" } if (project.isWorkInProgress) { diff --git a/src/org/ods/orchestration/util/Project.groovy b/src/org/ods/orchestration/util/Project.groovy index 155182e27..f3eacf6ae 100644 --- a/src/org/ods/orchestration/util/Project.groovy +++ b/src/org/ods/orchestration/util/Project.groovy @@ -267,7 +267,6 @@ class Project { protected ILogger logger protected Map config protected String targetProject - protected Boolean isVersioningEnabled = false protected Map data = [:] @@ -346,10 +345,7 @@ class Project { // Get more info of the versions from Jira this.data.jira.project.version = this.loadCurrentVersionDataFromJira() - def version = null - if (this.isVersioningEnabled) { - version = this.getVersionName() - } + def version = this.getVersionName() // FIXME: contrary to the comment below, the bug data from this method is still relevant // implementation needs to be cleaned up and bug data should be delivered through plugin's @@ -547,10 +543,6 @@ class Project { !getIsPromotionMode() } - boolean getIsVersioningEnabled() { - isVersioningEnabled - } - static boolean isPromotionMode(String targetEnvironmentToken) { ['Q', 'P'].contains(targetEnvironmentToken) } @@ -1058,23 +1050,6 @@ class Project { ] } - /** - * Checks if the JIRA version supports the versioning feature - * If jira or JiraUsecase is not enabled -> false - * If templates version is 1.0 -> false - * Otherwise, check from Jira - * @ true if versioning is enabled - */ - boolean checkIfVersioningIsEnabled(String projectKey, String versionName) { - if (!this.jiraUseCase) return false - if (!this.jiraUseCase.jira) return false - def levaDocsCapability = this.getCapability('LeVADocs') - if (levaDocsCapability.templatesVersion == '1.0') { - return false - } - return this.jiraUseCase.jira.isVersionEnabledForDelta(projectKey, versionName) - } - protected Map loadJiraData(String projectKey) { def result = [ components: [:], @@ -1092,16 +1067,8 @@ class Project { // than once. However, it's also called via this.project.versionFromReleaseStatusIssue in JiraUseCase.groovy. def currentVersion = this.getVersionFromReleaseStatusIssue() // TODO why is param.version not sufficient here? - this.isVersioningEnabled = this.checkIfVersioningIsEnabled(projectKey, currentVersion) - if (this.isVersioningEnabled) { - // We detect the correct version even if the build is WIP - logger.info("Project has versioning enabled.") - result = this.loadJiraDataForCurrentVersion(projectKey, currentVersion) - } else { - // TODO remove in ODS 4.0 version - logger.info("Versioning not supported for this release") - result = this.loadFullJiraData(projectKey) - } + // We detect the correct version even if the build is WIP + result = this.loadJiraDataForCurrentVersion(projectKey, currentVersion) } return result @@ -1112,17 +1079,6 @@ class Project { return this.jiraUseCase.getVersionFromReleaseStatusIssue() } - protected Map loadFullJiraData(String projectKey) { - def result = this.jiraUseCase.jira.getDocGenData(projectKey) - if (result?.project?.id == null) { - throw new IllegalArgumentException( - "Error: unable to load documentation generation data from Jira. 'project.id' is undefined.") - } - def docChapterData = this.getDocumentChapterData(projectKey) - result << [(JiraDataItem.TYPE_DOCS as String): docChapterData] - return result - } - protected Map loadVersionJiraData(String projectKey, String versionName) { def result = this.jiraUseCase.jira.getDeltaDocGenData(projectKey, versionName) if (result?.project?.id == null) { @@ -1135,16 +1091,9 @@ class Project { return result } - protected Map getDocumentChapterData(String projectKey, String versionName = null) { + protected Map getDocumentChapterData(String projectKey, String versionName) { def docChapters = this.jiraUseCase.getDocumentChapterData(projectKey, versionName) - if (docChapters.isEmpty() && !this.isVersioningEnabled) { - //TODO remove for ODS 4.0 - //If versioning is not enabled, the query should always return results. If not, there is an issue with - // the jira project itself. - throw new IllegalStateException("Error: could not find document chapters for project ${projectKey}.") - } else { - return docChapters - } + return docChapters } protected Map loadJiraDataForCurrentVersion(String projectKey, String versionName) { diff --git a/test/groovy/org/ods/orchestration/service/JiraServiceSpec.groovy b/test/groovy/org/ods/orchestration/service/JiraServiceSpec.groovy index 27f9e320a..b54cd92d0 100644 --- a/test/groovy/org/ods/orchestration/service/JiraServiceSpec.groovy +++ b/test/groovy/org/ods/orchestration/service/JiraServiceSpec.groovy @@ -1008,10 +1008,11 @@ class JiraServiceSpec extends SpecHelper { } - Map getDocGenDataRequestData(Map mixins = [:]) { + Map getDeltaDocGenDataRequestData(Map mixins = [:]) { def result = [ data: [ - projectKey: "DEMO" + projectKey: "DEMO", + version: "1.0" ], headers: [ "Accept": "application/json" @@ -1020,12 +1021,12 @@ class JiraServiceSpec extends SpecHelper { username: "username" ] - result.path = "/rest/platform/1.0/docgenreports/${result.data.projectKey}" + result.path = "/rest/platform/1.1/deltadocgenreports/${result.data.projectKey}/${result.data.version}" return result << mixins } - Map getDocGenDataResponseData(Map mixins = [:]) { + Map getDeltaDocGenDataResponseData(Map mixins = [:]) { def result = [ body: JsonOutput.toJson([ project: [:], @@ -1042,14 +1043,14 @@ class JiraServiceSpec extends SpecHelper { def "get doc gen data with invalid project key"() { given: - def request = getDocGenDataRequestData() - def response = getDocGenDataResponseData() + def request = getDeltaDocGenDataRequestData() + def response = getDeltaDocGenDataResponseData() def server = createServer(WireMock.&get, request, response) def service = createService(server.port(), request.username, request.password) when: - def result = service.getDocGenData(null) + def result = service.getDeltaDocGenData(null, request.data.version) then: def e = thrown(IllegalArgumentException) @@ -1061,14 +1062,14 @@ class JiraServiceSpec extends SpecHelper { def "get doc gen data"() { given: - def request = getDocGenDataRequestData() - def response = getDocGenDataResponseData() + def request = getDeltaDocGenDataRequestData() + def response = getDeltaDocGenDataResponseData() def server = createServer(WireMock.&get, request, response) def service = createService(server.port(), request.username, request.password) when: - def result = service.getDocGenData("DEMO") + def result = service.getDeltaDocGenData("DEMO", request.data.version) then: result == [ @@ -1085,8 +1086,8 @@ class JiraServiceSpec extends SpecHelper { def "get doc gen data with HTTP 400 failure"() { given: - def request = getDocGenDataRequestData() - def response = getDocGenDataResponseData([ + def request = getDeltaDocGenDataRequestData() + def response = getDeltaDocGenDataResponseData([ body: "Sorry, doesn't work!", status: 400 ]) @@ -1095,7 +1096,7 @@ class JiraServiceSpec extends SpecHelper { def service = createService(server.port(), request.username, request.password) when: - service.getDocGenData("DEMO") + service.getDeltaDocGenData("DEMO", request.data.version) then: def e = thrown(RuntimeException) @@ -1107,8 +1108,8 @@ class JiraServiceSpec extends SpecHelper { def "get doc gen data with HTTP 404 failure"() { given: - def request = getDocGenDataRequestData() - def response = getDocGenDataResponseData([ + def request = getDeltaDocGenDataRequestData() + def response = getDeltaDocGenDataResponseData([ status: 404 ]) @@ -1116,7 +1117,7 @@ class JiraServiceSpec extends SpecHelper { def service = createService(server.port(), request.username, request.password) when: - service.getDocGenData("DEMO") + service.getDeltaDocGenData("DEMO", request.data.version) then: def e = thrown(RuntimeException) @@ -1128,8 +1129,8 @@ class JiraServiceSpec extends SpecHelper { def "get doc gen data with HTTP 500 failure"() { given: - def request = getDocGenDataRequestData() - def response = getDocGenDataResponseData([ + def request = getDeltaDocGenDataRequestData() + def response = getDeltaDocGenDataResponseData([ body: "Sorry, doesn't work!", status: 500 ]) @@ -1138,7 +1139,7 @@ class JiraServiceSpec extends SpecHelper { def service = createService(server.port(), request.username, request.password) when: - service.getDocGenData("DEMO") + service.getDeltaDocGenData("DEMO", request.data.version) then: def e = thrown(RuntimeException) diff --git a/test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy b/test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy index 693c54df8..a8a7cd2d5 100644 --- a/test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy +++ b/test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy @@ -157,99 +157,6 @@ class JiraUseCaseSpec extends SpecHelper { testIssues.find { it.key == "NET-140" }.bugs.contains("BUG-1") } - def "get document chapter data"() { - given: - // Test Parameters - - def docChapterFields = [ - (JiraUseCase.CustomIssueFields.HEADING_NUMBER): [id:"0"], - (JiraUseCase.CustomIssueFields.CONTENT): [id: "1"], - ] - - // Argument Constraints - def jqlQuery = [ - fields: ['key', 'status', 'summary', 'labels', 'issuelinks', - docChapterFields[JiraUseCase.CustomIssueFields.CONTENT].id, - docChapterFields[JiraUseCase.CustomIssueFields.HEADING_NUMBER].id], - jql: "project = ${project.jiraProjectKey} AND issuetype = '${JiraUseCase.IssueTypes.DOCUMENTATION_CHAPTER}'", - expand: ['renderedFields'], - ] - - // Stubbed Method Responses - def jiraIssue1 = createJiraIssue("1", null, null, null, "DONE") - jiraIssue1.fields["0"] = "1.0" - jiraIssue1.fields.labels = [JiraUseCase.LabelPrefix.DOCUMENT+ "CSD"] - jiraIssue1.renderedFields = [:] - jiraIssue1.renderedFields["1"] = "myContent1" - jiraIssue1.renderedFields.description = "1-description" - - def jiraIssue2 = createJiraIssue("2", null, null, null, "DONE") - jiraIssue2.fields["0"] = "2.0" - jiraIssue2.fields.labels = [JiraUseCase.LabelPrefix.DOCUMENT+ "SSDS"] - jiraIssue2.renderedFields = [:] - jiraIssue2.renderedFields["1"] = "myContent2" - jiraIssue2.renderedFields.description = "2-description" - - def jiraIssue3 = createJiraIssue("3", null, null, null, "DONE") - jiraIssue3.fields["0"] = "3.0" - jiraIssue3.fields.labels = [JiraUseCase.LabelPrefix.DOCUMENT+ "DTP"] - jiraIssue3.renderedFields = [:] - jiraIssue3.renderedFields["1"] = "myContent3" - jiraIssue3.renderedFields.description = "3-description" - - def jiraResult = [ - issues: [jiraIssue1, jiraIssue2, jiraIssue3], - ] - - when: - def result = usecase.getDocumentChapterData(project.jiraProjectKey) - - then: - 1 * project.getJiraFieldsForIssueType(JiraUseCase.IssueTypes.DOCUMENTATION_CHAPTER) >> docChapterFields - 1 * jira.searchByJQLQuery(jqlQuery) >> jiraResult - - then: - def expected = [ - 'JIRA-1': [ - section: 'sec1s0', - number : '1.0', - heading: '1-summary', - documents: ['CSD'], - content: 'myContent1', - status: 'DONE', - key: 'JIRA-1', - predecessors: [], - versions: [], - ], - 'JIRA-2': [ - section: 'sec2s0', - number : '2.0', - heading: '2-summary', - documents: ['SSDS'], - content: 'myContent2', - status: 'DONE', - key: 'JIRA-2', - predecessors: [], - versions: [], - ], - 'JIRA-3': [ - section: 'sec3s0', - number : '3.0', - heading: '3-summary', - documents: ['DTP'], - content: 'myContent3', - status: 'DONE', - key: 'JIRA-3', - predecessors: [], - versions: [], - ] - ] - - result['JIRA-1'] == expected['JIRA-1'] - result['JIRA-2'] == expected['JIRA-2'] - result['JIRA-3'] == expected['JIRA-3'] - } - def "get document chapter data with version"() { given: // Test Parameters diff --git a/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy b/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy index 220686852..79610b1cd 100644 --- a/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy +++ b/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy @@ -1449,14 +1449,14 @@ class LeVADocumentUseCaseSpec extends SpecHelper { ] project.data.jira.trackingDocs << trackingIssues + this.project.isDeveloperPreviewMode() >> false + this.project.hasWipJiraIssues() >> false when: usecase.updateJiraDocumentationTrackingIssue(documentType, message, "1") then: 1 * usecase.getSectionsNotDone(documentType) >> [] - (1.._) * this.project.isDeveloperPreviewMode() >> false - (1.._) * this.project.hasWipJiraIssues() >> false then: 1 * usecase.updateValidDocVersionInJira("TRK-1", "1") @@ -1673,7 +1673,6 @@ class LeVADocumentUseCaseSpec extends SpecHelper { def "referenced documents version"() { given: def project = Stub(Project) - project.isVersioningEnabled >> true project.getDocumentVersionFromHistories('CSD') >> 3L project.getDocumentVersionFromHistories('DTR') >> 4L project.buildParams >> [targetEnvironmentToken: 'D', configItem: 'ConfigItem'] @@ -1720,27 +1719,9 @@ class LeVADocumentUseCaseSpec extends SpecHelper { ] } - def "get version if versioning not enabled"() { - given: - def project = Stub(Project) - project.isVersioningEnabled >> false - project.buildParams >> [version: '3'] - steps.env.BUILD_NUMBER = '56' - def jiraService = Stub(JiraService) - def jiraUseCase = Spy(new JiraUseCase(null, null, null, jiraService, null)) - def useCase = Spy(new LeVADocumentUseCase(project, steps, null, null, null, jiraUseCase, null, null, null, null, null, null, null, null)) - - when: - def version = useCase.getVersion(project, 'CSD') - - then: - version == '3-56' - } - def "get version from histories not WIP"() { given: def project = Stub(Project) - project.isVersioningEnabled >> true project.getDocumentVersionFromHistories('CSD') >> 3L def jiraService = Stub(JiraService) def jiraUseCase = Spy(new JiraUseCase(null, null, null, jiraService, null)) @@ -1756,7 +1737,6 @@ class LeVADocumentUseCaseSpec extends SpecHelper { def "get version from histories WIP"() { given: def project = Stub(Project) - project.isVersioningEnabled >> true project.isWorkInProgress >> true project.getDocumentVersionFromHistories('CSD') >> 3L def jiraService = Stub(JiraService) @@ -1773,7 +1753,6 @@ class LeVADocumentUseCaseSpec extends SpecHelper { def "get version new version WIP"() { given: def project = Stub(Project) - project.isVersioningEnabled >> true project.isWorkInProgress >> true project.getDocumentVersionFromHistories('CSD') >> null def jiraService = Stub(JiraService) @@ -1792,7 +1771,6 @@ class LeVADocumentUseCaseSpec extends SpecHelper { def "get version new version not WIP in first environment"() { given: def project = Stub(Project) - project.isVersioningEnabled >> true project.buildParams >> [targetEnvironmentToken: 'D'] project.getDocumentVersionFromHistories('CSD') >> null def jiraService = Stub(JiraService) @@ -1811,7 +1789,6 @@ class LeVADocumentUseCaseSpec extends SpecHelper { def "get version new version not WIP in second environment"() { given: def project = Stub(Project) - project.isVersioningEnabled >> true project.buildParams >> [targetEnvironmentToken: 'Q'] project.getDocumentVersionFromHistories('CSD') >> null def jiraService = Stub(JiraService) diff --git a/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy b/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy index e2760bcb8..b593dd646 100644 --- a/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy +++ b/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy @@ -1196,10 +1196,9 @@ class ProjectSpec extends SpecHelper { jiraIssue1.renderedFields.description = "1-description" def jira = Mock(JiraService) { - getDocGenData(_) >> { + getDeltaDocGenData(*_) >> { return docGenData } - isVersionEnabledForDelta(*_) >> { return false } searchByJQLQuery(*_) >> { return [ issues: [jiraIssue1]]} getTextFieldsOfIssue(*_) >> { return [field_0: [name: "1"]]} } @@ -1567,48 +1566,6 @@ class ProjectSpec extends SpecHelper { metadataFile.delete() } - def "use old docGen report when version is not enabled for the feature"() { - setup: - def versionEnabled - def jiraServiceStubs = { JiraService it -> - it.isVersionEnabledForDelta(*_) >> { - return versionEnabled - } - it.getDocGenData(*_) >> { return [project:[id:"1"]] } - it.getDeltaDocGenData(*_) >> { return [project:[id:"1"]] } - it.getTextFieldsOfIssue(*_) >> { return [field_0: [name: "1"]]} - } - project = setupWithJiraService(jiraServiceStubs) - project.data.jira = [issueTypes: [ - (JiraUseCase.IssueTypes.RELEASE_STATUS): [ fields: [ - (JiraUseCase.CustomIssueFields.RELEASE_VERSION): [id: "field_0"], - ]] - ]] - - when: - versionEnabled = false - project.loadJiraData("projectKey") - - then: - 1 * project.getDocumentChapterData(_) >> [:] - 1 * project.getVersionFromReleaseStatusIssue() - 0 * project.loadJiraDataForCurrentVersion(*_) - 1 * project.loadFullJiraData(_) - - when: - versionEnabled = true - project.loadJiraData("DEMO") - - then: - 1 * project.getVersionFromReleaseStatusIssue() >> '1' - - then: - 1 * project.loadJiraDataForCurrentVersion(*_) - 1 * project.getDocumentChapterData(*_) >> [:] - 0 * project.loadFullJiraData(_) - - } - def "load saved data from the previousVersion"() { setup: def firstVersion = '1' @@ -2617,9 +2574,7 @@ class ProjectSpec extends SpecHelper { } Project setupWithJiraService(Closure jiraMockedMethods = null) { - def jiraMockedM = jiraMockedMethods ?: { JiraService it -> - it.isVersionEnabledForDelta(*_) >> { return true } - } + def jiraMockedM = jiraMockedMethods ?: { } def projectObj = new Project(steps, logger) projectObj.git = git def jira = Mock(JiraService) { jiraMockedM(it) } @@ -2712,54 +2667,6 @@ class ProjectSpec extends SpecHelper { result == expected } - def "assert if versioning is enabled for the project"() { - given: - def versionEnabled - def jiraServiceStubs = { JiraService it -> - it.isVersionEnabledForDelta(*_) >> { - return versionEnabled - } - } - def project = setupWithJiraService( jiraServiceStubs ) - - when: - versionEnabled = true - def result = project.checkIfVersioningIsEnabled('project', 'version') - - then: - result - - when: - versionEnabled = false - result = project.checkIfVersioningIsEnabled('project', 'version') - - then: - !result - - when: - versionEnabled = false - result = project.checkIfVersioningIsEnabled('project', 'version') - - then: - project.getCapability('LeVADocs') >> [templatesVersion: '1.0'] - - then: - !result - - when: - versionEnabled = true - result = project.checkIfVersioningIsEnabled('project', 'version') - - then: - project.getCapability('LeVADocs') >> [templatesVersion: '1.0'] - - then: - !result - - - - } - def "get version for document type"() { given: def project = new Project(null, null)