-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rest): API to get vulnerability tracking status
Signed-off-by: Keerthi B L <[email protected]> feat(rest): API to get vulnerability tracking status Signed-off-by: Keerthi B L <[email protected]>
- Loading branch information
1 parent
165d56d
commit 16dae1a
Showing
4 changed files
with
85 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
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 |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
import org.eclipse.sw360.datahandler.thrift.VerificationState; | ||
import org.eclipse.sw360.datahandler.thrift.VerificationStateInfo; | ||
import org.eclipse.sw360.datahandler.thrift.components.Release; | ||
import org.eclipse.sw360.datahandler.thrift.projects.Project; | ||
import org.eclipse.sw360.datahandler.thrift.projects.ProjectType; | ||
import org.eclipse.sw360.datahandler.thrift.users.User; | ||
import org.eclipse.sw360.datahandler.thrift.users.UserGroup; | ||
import org.eclipse.sw360.datahandler.thrift.vulnerabilities.*; | ||
|
@@ -41,6 +43,7 @@ | |
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
|
@@ -87,6 +90,8 @@ public class VulnerabilitySpecTest extends TestRestDocsSpecBase { | |
|
||
private ReleaseVulnerabilityRelation releaseVulnerabilityRelation; | ||
|
||
private Project project; | ||
|
||
@Before | ||
public void before() throws TException { | ||
vulnerability = new Vulnerability(); | ||
|
@@ -205,6 +210,21 @@ public void before() throws TException { | |
vulnerabilityDTO4.setTitle("Updated Title"); | ||
vulnerabilityDTO4.setExternalId("98765"); | ||
|
||
project = new Project(); | ||
project.setId("376576"); | ||
project.setName("Emerald Web"); | ||
project.setProjectType(ProjectType.PRODUCT); | ||
project.setVersion("1.0.2"); | ||
project.setDescription("Emerald Web provides a suite of components for Critical Infrastructures."); | ||
project.setDomain("Hardware"); | ||
project.setCreatedOn("2016-12-15"); | ||
project.setCreatedBy("[email protected]"); | ||
project.setModerators(new HashSet<>(Arrays.asList("[email protected]", "[email protected]"))); | ||
project.setBusinessUnit("sw360 AR"); | ||
project.setExternalIds(Collections.singletonMap("mainline-id-project", "515432")); | ||
project.setOwnerAccountingUnit("4822"); | ||
project.setOwnerCountry("DE"); | ||
|
||
List<ReleaseVulnerabilityRelation> releaseRelation = new ArrayList<ReleaseVulnerabilityRelation>(); | ||
VulnerabilityWithReleaseRelations vulnerabilityWithReleaseRelations = new VulnerabilityWithReleaseRelations( | ||
vulnerability, releaseRelation); | ||
|
@@ -479,4 +499,11 @@ public void should_document_create_release_vulnerability_relation() throws Excep | |
fieldWithPath("usedNeedle").description("The used needle") | ||
))); | ||
} | ||
@Test | ||
public void should_document_get_vulnerabilities_tracking_status() throws Exception { | ||
String accessToken = TestHelper.getAccessToken(mockMvc, testUserId, testUserPassword); | ||
mockMvc.perform(get("/api/vulnerabilities/trackingstatus/" + project.getId()) | ||
.header("Authorization", "Bearer " + accessToken).accept(MediaTypes.HAL_JSON)) | ||
.andExpect(status().isOk()).andDo(this.documentationHandler.document()); | ||
} | ||
} |