@Test public void getRemediationActionsSummaryTest_Exception() throws Exception { when(vulnerabilityService.getRemediationActionsSummary(anyString(), anyString())) .thenThrow(new DataException()); ResponseEntity<Object> responseObj = vulnerabilityController.getRemediationActionsSummary("ag", "3"); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }
@RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) public ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup, @RequestParam(name = "severity", required = false) String severity) { Map<String, Object> response = new HashMap<>(); List<Map<String, Object>> remediationList = new ArrayList<>(); try { remediationList = vulnerabilityService.getRemediationActionsSummary(assetGroup, severity); } catch (DataException e) { LOGGER.error("Error in getRemediationActionsSummary", e); return ResponseUtils.buildFailureResponse(e); } response.put("actions", remediationList); return ResponseUtils.buildSucessResponse(response); }
VulnerabilityController implements Constants { @RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) public ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup, @RequestParam(name = "severity", required = false) String severity) { Map<String, Object> response = new HashMap<>(); List<Map<String, Object>> remediationList = new ArrayList<>(); try { remediationList = vulnerabilityService.getRemediationActionsSummary(assetGroup, severity); } catch (DataException e) { LOGGER.error("Error in getRemediationActionsSummary", e); return ResponseUtils.buildFailureResponse(e); } response.put("actions", remediationList); return ResponseUtils.buildSucessResponse(response); } }
VulnerabilityController implements Constants { @RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) public ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup, @RequestParam(name = "severity", required = false) String severity) { Map<String, Object> response = new HashMap<>(); List<Map<String, Object>> remediationList = new ArrayList<>(); try { remediationList = vulnerabilityService.getRemediationActionsSummary(assetGroup, severity); } catch (DataException e) { LOGGER.error("Error in getRemediationActionsSummary", e); return ResponseUtils.buildFailureResponse(e); } response.put("actions", remediationList); return ResponseUtils.buildSucessResponse(response); }  }
VulnerabilityController implements Constants { @RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) public ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup, @RequestParam(name = "severity", required = false) String severity) { Map<String, Object> response = new HashMap<>(); List<Map<String, Object>> remediationList = new ArrayList<>(); try { remediationList = vulnerabilityService.getRemediationActionsSummary(assetGroup, severity); } catch (DataException e) { LOGGER.error("Error in getRemediationActionsSummary", e); return ResponseUtils.buildFailureResponse(e); } response.put("actions", remediationList); return ResponseUtils.buildSucessResponse(response); }  @SuppressWarnings("unchecked") @PostMapping(value = "/v1/vulnerabilities/detail") ResponseEntity<Object> getVulnerabilitiesDetails(@RequestBody(required = true) Request request); @ApiOperation(httpMethod = "POST", value = "Get the cartesian product of vulnerability occureneces of asset and details of assets in an asset group. Filter can receive 'severitylevel' as comma seperated." + "'searchtext' can be used to get the sorted result based on the search text provided.Sample request: {\"ag\":\"pacman\",\"filter\":{\"severitylevel\":\"3,5\"},\"from\":0,\"searchtext\":\"\",\"size\":25}") @PostMapping(value = "/v1/vulnerabilities/occurrences") ResponseEntity<Object> getVulnerabilitiesOccurrences(@RequestBody(required = true) Request request); @RequestMapping(path = "/v1/vulnerabilities/summary", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilitysummary(@RequestParam(name = "ag", required = true) String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/summarybyapplication", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityByApplications(@RequestParam("ag") String assetGroup); @PostMapping(value = "/v1/vulnerabilities/trend") ResponseEntity<Object> getVulnerabilitiesTrend(@RequestBody(required = true) TrendRequest request); @RequestMapping(path = "/v1/vulnerabilities/summarybyenvironment", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityByEnvironment(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "application", required = false) String application); @RequestMapping(path = "/v1/vulnerabilities/distribution", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityDistribution(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/vulnerabilities/summary/{resourceId}", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilitysummaryByResourceId(
			@PathVariable(name = "resourceId", required = true) String resourceId); @SuppressWarnings("unchecked") @RequestMapping(path = "/v1/vulnerabilities/detail/{resourceId}", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityDetailsByResourceId(
			@PathVariable(name = "resourceId", required = true) String resourceId,
			@RequestParam(name = "searchtext", required = false) String searchtext,
			@RequestParam(name = "from", required = false) Integer from,
			@RequestParam(name = "size", required = false) Integer size); @RequestMapping(path = "/v1/vulnerabilities/aging/summary", method = RequestMethod.GET) ResponseEntity<Object> getAgingSummary(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/vulnerabilities/qids", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityByQid(@RequestParam("qid") String qid); @RequestMapping(path = "/v1/vulnerabilities/distribution-vulntype", method = RequestMethod.GET) ResponseEntity<Object> getDistributionSummaryByVulnType(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/distribution-infra", method = RequestMethod.GET) ResponseEntity<Object> getDistributionSummaryByInfraType(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/distribution-env", method = RequestMethod.GET) ResponseEntity<Object> getDistributionSummaryByEnv(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/performers", method = RequestMethod.GET) ResponseEntity<Object> getHighestLowestPerformers(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v2/vulnerabilities/performers", method = RequestMethod.GET) ResponseEntity<Object> getHighestLowestPerformers(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity,
			@RequestParam(name = "type") PerfType type); @Cacheable(cacheNames = "trends", key = "#request.vulnCacheKey", unless = "#result.statusCodeValue!=200") @RequestMapping(path = "/v1/vulnerabilities/trend/open-new", method = RequestMethod.POST) ResponseEntity<Object> getVulnerabilityTrend(@RequestBody(required = true) TrendRequest request); @RequestMapping(path = "/v1/vulnerabilities/trend/notes", method = RequestMethod.POST) ResponseEntity<Object> createTrendAnnotation(@RequestBody(required = true) TrendNote request); @RequestMapping(path = "/v1/vulnerabilities/trend/notes", method = RequestMethod.GET) ResponseEntity<Object> getTrendAnnotations(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "from", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date from); @RequestMapping(path = "/v1/vulnerabilities/trend/notes/{noteId}", method = RequestMethod.DELETE) ResponseEntity<Object> deleteTrendAnnotation(@PathVariable(name = "noteId", required = true) String noteId); @Cacheable(cacheNames = "trendsvuln", key = "#request.vulnCacheKey", unless = "#result.statusCodeValue!=200") @RequestMapping(path = "/v1/vulnerabilities/trend/total-affected", method = RequestMethod.POST) ResponseEntity<Object> getVulnerabilityAssetsTrend(@RequestBody(required = true) TrendRequest request); @RequestMapping(path = "/v1/vulnerabilities/summarybyassets", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilitySummaryByAssets(
			@RequestParam(name = "ag", required = true) String assetGroup); @RequestMapping(path = "/v1/vulnerabilites", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilities(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/trend/compliance/vulnerabilities", method = RequestMethod.POST) ResponseEntity<Object> getVulnTrend(@RequestBody(required = true) CompliantTrendRequest request); }
VulnerabilityController implements Constants { @RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) public ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup, @RequestParam(name = "severity", required = false) String severity) { Map<String, Object> response = new HashMap<>(); List<Map<String, Object>> remediationList = new ArrayList<>(); try { remediationList = vulnerabilityService.getRemediationActionsSummary(assetGroup, severity); } catch (DataException e) { LOGGER.error("Error in getRemediationActionsSummary", e); return ResponseUtils.buildFailureResponse(e); } response.put("actions", remediationList); return ResponseUtils.buildSucessResponse(response); }  @SuppressWarnings("unchecked") @PostMapping(value = "/v1/vulnerabilities/detail") ResponseEntity<Object> getVulnerabilitiesDetails(@RequestBody(required = true) Request request); @ApiOperation(httpMethod = "POST", value = "Get the cartesian product of vulnerability occureneces of asset and details of assets in an asset group. Filter can receive 'severitylevel' as comma seperated." + "'searchtext' can be used to get the sorted result based on the search text provided.Sample request: {\"ag\":\"pacman\",\"filter\":{\"severitylevel\":\"3,5\"},\"from\":0,\"searchtext\":\"\",\"size\":25}") @PostMapping(value = "/v1/vulnerabilities/occurrences") ResponseEntity<Object> getVulnerabilitiesOccurrences(@RequestBody(required = true) Request request); @RequestMapping(path = "/v1/vulnerabilities/summary", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilitysummary(@RequestParam(name = "ag", required = true) String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/summarybyapplication", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityByApplications(@RequestParam("ag") String assetGroup); @PostMapping(value = "/v1/vulnerabilities/trend") ResponseEntity<Object> getVulnerabilitiesTrend(@RequestBody(required = true) TrendRequest request); @RequestMapping(path = "/v1/vulnerabilities/summarybyenvironment", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityByEnvironment(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "application", required = false) String application); @RequestMapping(path = "/v1/vulnerabilities/distribution", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityDistribution(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/vulnerabilities/summary/{resourceId}", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilitysummaryByResourceId(
			@PathVariable(name = "resourceId", required = true) String resourceId); @SuppressWarnings("unchecked") @RequestMapping(path = "/v1/vulnerabilities/detail/{resourceId}", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityDetailsByResourceId(
			@PathVariable(name = "resourceId", required = true) String resourceId,
			@RequestParam(name = "searchtext", required = false) String searchtext,
			@RequestParam(name = "from", required = false) Integer from,
			@RequestParam(name = "size", required = false) Integer size); @RequestMapping(path = "/v1/vulnerabilities/aging/summary", method = RequestMethod.GET) ResponseEntity<Object> getAgingSummary(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/vulnerabilities/qids", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilityByQid(@RequestParam("qid") String qid); @RequestMapping(path = "/v1/vulnerabilities/distribution-vulntype", method = RequestMethod.GET) ResponseEntity<Object> getDistributionSummaryByVulnType(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/distribution-infra", method = RequestMethod.GET) ResponseEntity<Object> getDistributionSummaryByInfraType(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/distribution-env", method = RequestMethod.GET) ResponseEntity<Object> getDistributionSummaryByEnv(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/remediations/summary", method = RequestMethod.GET) ResponseEntity<Object> getRemediationActionsSummary(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v1/vulnerabilities/performers", method = RequestMethod.GET) ResponseEntity<Object> getHighestLowestPerformers(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity); @RequestMapping(path = "/v2/vulnerabilities/performers", method = RequestMethod.GET) ResponseEntity<Object> getHighestLowestPerformers(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "severity", required = false) String severity,
			@RequestParam(name = "type") PerfType type); @Cacheable(cacheNames = "trends", key = "#request.vulnCacheKey", unless = "#result.statusCodeValue!=200") @RequestMapping(path = "/v1/vulnerabilities/trend/open-new", method = RequestMethod.POST) ResponseEntity<Object> getVulnerabilityTrend(@RequestBody(required = true) TrendRequest request); @RequestMapping(path = "/v1/vulnerabilities/trend/notes", method = RequestMethod.POST) ResponseEntity<Object> createTrendAnnotation(@RequestBody(required = true) TrendNote request); @RequestMapping(path = "/v1/vulnerabilities/trend/notes", method = RequestMethod.GET) ResponseEntity<Object> getTrendAnnotations(@RequestParam("ag") String assetGroup,
			@RequestParam(name = "from", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date from); @RequestMapping(path = "/v1/vulnerabilities/trend/notes/{noteId}", method = RequestMethod.DELETE) ResponseEntity<Object> deleteTrendAnnotation(@PathVariable(name = "noteId", required = true) String noteId); @Cacheable(cacheNames = "trendsvuln", key = "#request.vulnCacheKey", unless = "#result.statusCodeValue!=200") @RequestMapping(path = "/v1/vulnerabilities/trend/total-affected", method = RequestMethod.POST) ResponseEntity<Object> getVulnerabilityAssetsTrend(@RequestBody(required = true) TrendRequest request); @RequestMapping(path = "/v1/vulnerabilities/summarybyassets", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilitySummaryByAssets(
			@RequestParam(name = "ag", required = true) String assetGroup); @RequestMapping(path = "/v1/vulnerabilites", method = RequestMethod.GET) ResponseEntity<Object> getVulnerabilities(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/trend/compliance/vulnerabilities", method = RequestMethod.POST) ResponseEntity<Object> getVulnTrend(@RequestBody(required = true) CompliantTrendRequest request);  }