use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class GetResultsAnalyticsTestSteps method getResultsWithFilter.
@When("doing get results operation on SAST scan with {int} {int} {int} {int} results and filter is {string}")
public void getResultsWithFilter(int high, int medium, int low, int info, String filter) throws InterruptedException {
try {
scanResultsToInject = createFakeSASTScanResults();
ScanRequest scanRequest = createScanRequest();
setFindingsSummary(high, medium, low, info, filter);
addAdditionalInfoToResults();
addFlowSummaryToResults(high, medium, low, info);
CompletableFuture<ScanResults> task = resultsService.processScanResultsAsync(scanRequest, PROJECT_ID, SCAN_ID, null, null);
task.get(1, TimeUnit.MINUTES);
} catch (MachinaException | ExecutionException | TimeoutException e) {
String message = "Error processing scan results.";
log.error(message, e);
Assert.fail(message);
}
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class DeleteBranchSteps method initMockers.
private void initMockers() throws CheckmarxException {
ScanResultsAnswerer answerer = new ScanResultsAnswerer();
doAnswer(answerer).when(cxClientMock).deleteProject(any());
when(helperService.getShortUid()).thenReturn("12345");
when(helperService.getCxTeam(any())).thenReturn(TEAM);
when(helperService.getCxProject(any())).thenCallRealMethod();
when(helperService.getPresetFromSources(any())).thenReturn(PRESET);
when(helperService.isBranchProtected(anyString(), anyList(), any())).thenCallRealMethod();
when(helperService.isBranch2Scan(any(), anyList())).thenCallRealMethod();
when(cxClientMock.getTeamId(anyString(), anyString())).thenReturn(TEAM);
when(cxClientMock.getTeamId(anyString())).thenReturn(TEAM);
when(cxClientMock.getScanIdOfExistingScanIfExists(anyInt())).thenReturn(SCAN_ID_EXISTING_SCAN_NOT_EXIST);
when(cxClientMock.getReportContentByScanId(anyInt(), any())).thenReturn(new ScanResults());
when(adoServiceMock.getCxConfigOverride(any(), anyString())).thenReturn(cxConfig);
when(resultsServiceMock.publishCombinedResults(any(), any())).thenReturn(null);
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class Github2AdoSteps method createFakeResults.
private ScanResults createFakeResults() {
ScanResults result = new ScanResults();
result.setScanSummary(new CxScanSummary());
Map<String, Object> details = new HashMap<>();
details.put(Constants.SUMMARY_KEY, new HashMap<>());
if (scannerType.equals(AST)) {
createAstFindings(result);
}
result.setAdditionalDetails(details);
result.setXIssues(ScanResultsBuilder.get2XIssues());
return result;
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class CxConfigSteps method processScanResultsInCxFlow.
private void processScanResultsInCxFlow() throws InterruptedException {
try {
ScanRequest scanRequest = createScanRequest();
CompletableFuture<ScanResults> task = resultsService.processScanResultsAsync(scanRequest, 0, 0, null, null);
task.get(1, TimeUnit.MINUTES);
} catch (MachinaException | ExecutionException | TimeoutException e) {
String message = "Error processing scan results.";
log.error(message, e);
Assert.fail(message);
}
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class CxConfigSteps method createFakeScanResults.
private static ScanResults createFakeScanResults() {
ScanResults result = new ScanResults();
result.setScanSummary(new CxScanSummary());
Map<String, Object> details = new HashMap<>();
details.put(Constants.SUMMARY_KEY, new HashMap<>());
result.setAdditionalDetails(details);
result.setXIssues(new ArrayList<>());
return result;
}
Aggregations