forked from eclipse-sw360/sw360
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Rest): new endpoint will help to get the package details by proje…
…ctId. Signed-off-by: Nikesh kumar <[email protected]>
- Loading branch information
Showing
3 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,6 +276,7 @@ public void before() throws TException, IOException { | |
project.setSpecialRisks3rdParty("Lorem Ipsum"); | ||
project.setLicenseInfoHeaderText("Lorem Ipsum"); | ||
project.setDeliveryChannels("Lorem Ipsum"); | ||
project.setPackageIds(new HashSet<>(Arrays.asList("pkg-001", "pkg-002", "pkg-003"))); | ||
project.setVendor(new Vendor()); | ||
project.setRemarksAdditionalRequirements("Lorem Ipsum"); | ||
ReleaseClearingStateSummary clearingCount = new ReleaseClearingStateSummary(); | ||
|
@@ -3250,4 +3251,35 @@ public void should_document_get_projects_by_advance_search() throws Exception { | |
fieldWithPath("page.number").description("Number of the current page") | ||
))); | ||
} | ||
|
||
@Test | ||
public void should_document_get_package_by_project_id() throws Exception { | ||
Set<String> licenseIds = new HashSet<>(); | ||
licenseIds.add("MIT"); | ||
licenseIds.add("GPL"); | ||
|
||
Package packages = new Package("angular-sanitize", "1.8.2", "pkg:npm/[email protected]", | ||
CycloneDxComponentType.FRAMEWORK) | ||
.setId("122357345") | ||
.setCreatedBy("[email protected]") | ||
.setCreatedOn("2023-01-02") | ||
.setVcs("git+https://github.com/angular/angular.js.git") | ||
.setHomepageUrl("http://angularjs.org") | ||
.setLicenseIds(licenseIds) | ||
.setReleaseId("12345678") | ||
.setPackageManager(PackageManager.NPM) | ||
.setDescription("Sanitizes an html string by stripping all potentially dangerous tokens."); | ||
|
||
given(this.packageServiceMock.getPackageForUserById(eq(packages.getId()))).willReturn(packages); | ||
|
||
Project sw360Project = new Project(); | ||
sw360Project.setId(project.getId()); | ||
sw360Project.setPackageIds(new HashSet<>(Collections.singleton("122357345"))); | ||
|
||
given(this.projectServiceMock.getProjectForUserById(eq(project.getId()), any())).willReturn(sw360Project); | ||
|
||
mockMvc.perform(get("/api/projects/" + project.getId() + "/packages") | ||
.header("Authorization", TestHelper.generateAuthHeader(testUserId, testUserPassword)) | ||
.accept(MediaTypes.HAL_JSON)).andExpect(status().isOk()); | ||
} | ||
} |