Search in sources :

Example 11 with BugTracker

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

the class ScaCommonSteps method getBasicScanRequest.

protected ScanRequest getBasicScanRequest(String projectName, String repoWithAuth) {
    BugTracker bt = BugTracker.builder().type(BugTracker.Type.JIRA).customBean("JIRA").build();
    ScanRequest request = ScanRequest.builder().project(projectName).repoUrlWithAuth(repoWithAuth).branch("master").repoType(ScanRequest.Repository.GITHUB).bugTracker(bt).build();
    scaConfigOverrider.initScaConfig(request);
    return request;
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) BugTracker(com.checkmarx.flow.dto.BugTracker)

Example 12 with BugTracker

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

the class GetResultsAnalyticsTestSteps method createScanRequest.

private ScanRequest createScanRequest() {
    ScanRequest scanRequest = new ScanRequest();
    BugTracker issueTracker = BugTracker.builder().type(BugTracker.Type.NONE).build();
    scanRequest.setBugTracker(issueTracker);
    scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
    scanRequest.setProduct(ScanRequest.Product.CX);
    Map<String, String> additionalMetaData = new HashMap<>();
    additionalMetaData.put("statuses_url", PULL_REQUEST_STATUSES_URL);
    scanRequest.setAdditionalMetadata(additionalMetaData);
    return scanRequest;
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) BugTracker(com.checkmarx.flow.dto.BugTracker)

Example 13 with BugTracker

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

the class GitHubCommentsASTSteps method createScanRequest.

private ScanRequest createScanRequest() {
    ScanRequest scanRequest = new ScanRequest();
    scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
    scanRequest.setProduct(ScanRequest.Product.CX);
    Map<String, String> additionalMetaData = new HashMap<>();
    additionalMetaData.put("statuses_url", PULL_REQUEST_STATUSES_URL);
    scanRequest.setAdditionalMetadata(additionalMetaData);
    if (repo.equals(ScanRequest.Repository.GITHUB)) {
        scanRequest.setRepoType(ScanRequest.Repository.GITHUB);
        BugTracker issueTracker = BugTracker.builder().type(BugTracker.Type.GITHUBPULL).build();
        scanRequest.setBugTracker(issueTracker);
    } else {
        throw new UnsupportedOperationException();
    }
    return scanRequest;
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) BugTracker(com.checkmarx.flow.dto.BugTracker)

Example 14 with BugTracker

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

the class ThresholdsSteps method createScanRequest.

private ScanRequest createScanRequest(boolean isGitHub) {
    ScanRequest scanRequest = new ScanRequest();
    BugTracker.Type issueTruckerType;
    Map<String, String> additionalMetadata = new HashMap<>();
    additionalMetadata.put(STATUSES_URL_KEY, PULL_REQUEST_STATUSES_URL);
    if (isGitHub) {
        issueTruckerType = BugTracker.Type.GITHUBPULL;
        scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
        scanRequest.setRepoType(ScanRequest.Repository.GITHUB);
    } else {
        issueTruckerType = BugTracker.Type.ADOPULL;
        additionalMetadata.put("status_id", Integer.toString(1));
        additionalMetadata.put("ado_thread_id", Integer.toString(0));
        scanRequest.setRepoType(ScanRequest.Repository.ADO);
        scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
        scanResultsToInject.setProjectId(Integer.toString(0));
    }
    BugTracker issueTracker = BugTracker.builder().type(issueTruckerType).build();
    scanRequest.setBugTracker(issueTracker);
    scanRequest.setProduct(ScanRequest.Product.CX);
    scanRequest.setAdditionalMetadata(additionalMetadata);
    return scanRequest;
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) HashMap(java.util.HashMap) BugTracker(com.checkmarx.flow.dto.BugTracker)

Example 15 with BugTracker

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

the class IastCliSteps method runningIastService.

@SneakyThrows
@When("running iast service {}")
public void runningIastService(String scanTag) {
    scanTag = removeQuotes(scanTag);
    try {
        BugTracker.Type bugType = BugTracker.Type.GITHUBCOMMIT;
        String assignee = "test_user";
        BugTracker bt = BugTracker.builder().type(bugType).assignee(assignee).build();
        ScanRequest request = ScanRequest.builder().bugTracker(bt).build();
        iastService.stopScanAndCreateIssue(request, scanTag);
    } catch (IastThresholdsSeverityException e) {
    // that is ok. Just Thresholds Severity
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) IastThresholdsSeverityException(com.checkmarx.flow.exception.IastThresholdsSeverityException) BugTracker(com.checkmarx.flow.dto.BugTracker) When(io.cucumber.java.en.When) SneakyThrows(lombok.SneakyThrows)

Aggregations

BugTracker (com.checkmarx.flow.dto.BugTracker)32 ScanRequest (com.checkmarx.flow.dto.ScanRequest)23 FilterConfiguration (com.checkmarx.sdk.dto.filtering.FilterConfiguration)13 CxConfig (com.checkmarx.sdk.dto.sast.CxConfig)6 MachinaRuntimeException (com.checkmarx.flow.exception.MachinaRuntimeException)5 ScanResults (com.checkmarx.sdk.dto.ScanResults)5 JiraClientException (com.checkmarx.flow.exception.JiraClientException)4 IssueInputBuilder (com.atlassian.jira.rest.client.api.domain.input.IssueInputBuilder)3 ComplexIssueInputFieldValue (com.atlassian.jira.rest.client.api.domain.input.ComplexIssueInputFieldValue)2 FieldInput (com.atlassian.jira.rest.client.api.domain.input.FieldInput)2 ControllerRequest (com.checkmarx.flow.dto.ControllerRequest)2 FlowOverride (com.checkmarx.flow.dto.FlowOverride)2 Repository (com.checkmarx.flow.dto.bitbucket.Repository)2 InvalidTokenException (com.checkmarx.flow.exception.InvalidTokenException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)2 com.atlassian.jira.rest.client.api (com.atlassian.jira.rest.client.api)1 com.atlassian.jira.rest.client.api.domain (com.atlassian.jira.rest.client.api.domain)1 TransitionInput (com.atlassian.jira.rest.client.api.domain.input.TransitionInput)1