From f748c7cbac741660ad5bc56659d773d81dbe07f0 Mon Sep 17 00:00:00 2001 From: tuannn2 Date: Mon, 16 Oct 2023 14:17:46 +0700 Subject: [PATCH] fix(package): Create package by API can't link release Signed-off-by: tuannn2 --- .../rest/resourceserver/core/JacksonCustomizations.java | 1 - .../sw360/rest/resourceserver/restdocs/PackageSpecTest.java | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/JacksonCustomizations.java b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/JacksonCustomizations.java index c227900dc1..cf4d0593fb 100644 --- a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/JacksonCustomizations.java +++ b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/JacksonCustomizations.java @@ -577,7 +577,6 @@ static abstract class ComponentMixin extends Component { "setHomepageUrl", "setVcs", "setPackageManager", - "releaseId", "setRelease", "setPackageType" }) diff --git a/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/PackageSpecTest.java b/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/PackageSpecTest.java index 4ac1ae769a..cbb706ae3d 100644 --- a/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/PackageSpecTest.java +++ b/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/PackageSpecTest.java @@ -224,6 +224,7 @@ public void should_document_get_packages_with_all_details() throws Exception { fieldWithPath("_embedded.sw360:packages.[]vcs").description("VCS(Version Control System) is the URL of the source code"), fieldWithPath("_embedded.sw360:packages.[]homepageUrl").description("URL of the package website"), fieldWithPath("_embedded.sw360:packages.[]licenseIds").description("The associated licenses").optional(), + fieldWithPath("_embedded.sw360:packages.[]releaseId").description("The associated release").optional(), fieldWithPath("_embedded.sw360:packages.[]description").description("Description of the package"), subsectionWithPath("_embedded.sw360:packages.[]_embedded.sw360:release").description("The release to which the package is linked").optional(), subsectionWithPath("_embedded.sw360:packages.[]_embedded.createdBy").description("The user who created this component"), @@ -258,6 +259,7 @@ public void should_document_get_package() throws Exception { fieldWithPath("vcs").description("VCS(Version Control System) is the URL of the source code"), fieldWithPath("homepageUrl").description("URL of the package website"), fieldWithPath("licenseIds").description("The associated licenses"), + fieldWithPath("releaseId").description("The associated release"), fieldWithPath("description").description("Description of the package"), subsectionWithPath("_links").description("<> to other resources"), subsectionWithPath("_embedded.sw360:release").description("The release to which the package is linked"), @@ -356,7 +358,7 @@ public void should_document_create_package() throws Exception { pkg.put("vcs", "git+https://github.com/angular/angular.js.git"); pkg.put("homepageUrl", "https://github.com/angular/angular-sanitize"); pkg.put("licenseIds", licenseIds); - pkg.put("releaseId", "69da0e106074ab7b3856df5fbc3e"); + pkg.put("releaseId", "98745"); pkg.put("description", "Sanitizes a html string by stripping all potentially dangerous tokens."); String accessToken = TestHelper.getAccessToken(mockMvc, testUserId, testUserPassword); @@ -389,6 +391,7 @@ public void should_document_create_package() throws Exception { fieldWithPath("vcs").description("VCS(Version Control System) is the URL of the source code"), fieldWithPath("homepageUrl").description("URL of the package website"), fieldWithPath("licenseIds").description("The associated licenses"), + fieldWithPath("releaseId").description("The associated release"), fieldWithPath("description").description("Description of the package"), subsectionWithPath("_links").description("<> to other resources"), subsectionWithPath("_embedded.sw360:release").description("The release to which the package is linked"), @@ -423,6 +426,7 @@ public void should_document_update_package() throws Exception { fieldWithPath("vcs").description("VCS(Version Control System) is the URL of the source code"), fieldWithPath("homepageUrl").description("URL of the package website"), fieldWithPath("licenseIds").description("The associated licenses"), + fieldWithPath("releaseId").description("The associated release"), fieldWithPath("description").description("Description of the package"), subsectionWithPath("_links").description("<> to other resources"), subsectionWithPath("_embedded.sw360:release").description("The release to which the package is linked"),