Search in sources :

Example 11 with ScanResults

use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.

the class ThresholdsSteps method processScanResultsInCxFlow.

private void processScanResultsInCxFlow(boolean isGitHub) {
    try {
        ScanRequest scanRequest = createScanRequest(isGitHub);
        CompletableFuture<ScanResults> task = resultsService.processScanResultsAsync(scanRequest, 0, 0, null, null);
        task.get(1, TimeUnit.MINUTES);
    } catch (MachinaException | InterruptedException | ExecutionException | TimeoutException e) {
        String message = "Error processing scan results.";
        log.error(message, e);
        Assert.fail(message);
        Thread.currentThread().interrupt();
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) ScanResults(com.checkmarx.sdk.dto.ScanResults) MachinaException(com.checkmarx.flow.exception.MachinaException) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException)

Example 12 with ScanResults

use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.

the class ThresholdsSteps 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;
}
Also used : HashMap(java.util.HashMap) ScanResults(com.checkmarx.sdk.dto.ScanResults) CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Example 13 with ScanResults

use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.

the class ScaThresholdsSteps method pull_request_should_fail.

@Then("pull request should {word}")
public void pull_request_should_fail(String expected) {
    RepoProperties repoProperties = new RepoProperties();
    repoProperties.setErrorMerge(true);
    ScanResults scanResults = new ScanResults();
    scanResults.setScaResults(scaResults);
    PullRequestReport pullRequestReport = new PullRequestReport();
    boolean actual = thresholdValidatorImpl.isMergeAllowed(scanResults, repoProperties, pullRequestReport);
    log.info("is merged allowed = {} (expecting: {})", actual, expected);
    assertEquals(expected.equals("pass"), actual, "is merged allowed = " + actual + ", but was expecting: " + expected);
}
Also used : PullRequestReport(com.checkmarx.flow.dto.report.PullRequestReport) ScanResults(com.checkmarx.sdk.dto.ScanResults) RepoProperties(com.checkmarx.flow.config.RepoProperties) Then(io.cucumber.java.en.Then)

Example 14 with ScanResults

use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.

the class CxConfigBugTrackerSteps 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;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Example 15 with ScanResults

use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.

the class AstTicketsCreationViaJiraSteps method publishNewAstResults.

@When("publishing new known unfiltered AST results")
public void publishNewAstResults() throws IOException, MachinaException {
    ScanResults scanResults = JsonUtils.json2Object(TestUtils.getFileFromRelativeResourcePath(INPUT_BASE_PATH + INPUT_FILE), ScanResults.class);
    resultsService.processResults(getBasicScanRequest(), scanResults, null);
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) When(io.cucumber.java.en.When)

Aggregations

ScanResults (com.checkmarx.sdk.dto.ScanResults)58 MachinaException (com.checkmarx.flow.exception.MachinaException)17 ScanRequest (com.checkmarx.flow.dto.ScanRequest)16 CheckmarxException (com.checkmarx.sdk.exception.CheckmarxException)14 When (io.cucumber.java.en.When)9 MachinaRuntimeException (com.checkmarx.flow.exception.MachinaRuntimeException)6 CxScanSummary (com.checkmarx.sdk.dto.cx.CxScanSummary)6 FilterConfiguration (com.checkmarx.sdk.dto.filtering.FilterConfiguration)6 ExecutionException (java.util.concurrent.ExecutionException)5 TimeoutException (java.util.concurrent.TimeoutException)5 BugTracker (com.checkmarx.flow.dto.BugTracker)4 ScanParams (com.checkmarx.sdk.dto.ast.ScanParams)4 Filter (com.checkmarx.sdk.dto.sast.Filter)4 Test (org.junit.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 JiraClientException (com.checkmarx.flow.exception.JiraClientException)3 CxScanParams (com.checkmarx.sdk.dto.cx.CxScanParams)3 Finding (com.checkmarx.sdk.dto.sca.report.Finding)3 Package (com.checkmarx.sdk.dto.sca.report.Package)3 IOException (java.io.IOException)3