Search in sources :

Example 21 with Issue

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

the class PublishingSteps method azureDevOpsInitiallyContainsIssueWithState.

@Given("Azure DevOps initially contains {int} {string} issue with title: {string}")
public void azureDevOpsInitiallyContainsIssueWithState(int issueCount, String stateDescription, String title) throws IOException {
    String desiredState = stateDescription.equals("open") ? adoProperties.getOpenStatus() : adoProperties.getClosedStatus();
    String stateAllowedForCreation = adoProperties.getOpenStatus();
    boolean needToUpdateAfterCreation = !desiredState.equals(stateAllowedForCreation);
    for (int i = 0; i < issueCount; i++) {
        Issue issue = createIssue(title, DESCRIPTION_STUB);
        if (needToUpdateAfterCreation) {
            adoClient.updateIssueState(issue, desiredState);
        }
    }
}
Also used : Issue(com.checkmarx.flow.dto.Issue) Given(io.cucumber.java.en.Given)

Example 22 with Issue

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

the class PublishingSteps method createIssue.

private Issue createIssue(String title, String description) throws IOException {
    Issue issue = new Issue();
    issue.setTitle(title);
    issue.setBody(description);
    issue.setState(adoProperties.getOpenStatus());
    String id = adoClient.createIssue(issue);
    issue.setId(id);
    return issue;
}
Also used : Issue(com.checkmarx.flow.dto.Issue)

Example 23 with Issue

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

the class ServiceNowTrackerTest method searchAndCloseIssues_WithAllParams_Success.

@Test
public void searchAndCloseIssues_WithAllParams_Success() {
    try {
        log.info("Start searchAndCloseIssues_WithAllParams_Success");
        // find an existing issue
        ScanRequest request = getRequest();
        List<Issue> issues = issueTracker.getIssues(request);
        assertNotNull(issues);
        assertTrue(issues.size() > 0);
        assertNotNull(issues.get(0).getId());
        request.setId(issues.get(0).getId());
        // close an existing issue
        issueTracker.closeIssue(issues.get(0), request);
        // check closed issue
        issues = issueTracker.getIssues(request);
        assertNotNull(issues);
        assertTrue(issues.size() > 0);
        assertTrue(issues.get(0).getState().equals("7"));
    } catch (MachinaException e) {
        log.error(e.getMessage());
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) Issue(com.checkmarx.flow.dto.Issue) MachinaException(com.checkmarx.flow.exception.MachinaException) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 24 with Issue

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

the class ServiceNowTrackerTest method searchAndUpdateIssues_WithAllParams_Success.

@Test
public void searchAndUpdateIssues_WithAllParams_Success() {
    try {
        log.info("Start searchAndUpdateIssues_WithAllParams_Success");
        // find an existing issue
        ScanRequest request = getRequest();
        List<Issue> issues = issueTracker.getIssues(request);
        assertNotNull(issues);
        assertTrue(issues.size() > 0);
        assertNotNull(issues.get(0).getId());
        ScanResults.XIssue resultIssue = getIssue("update test incident");
        request.setId(issues.get(0).getId());
        // update existing issue
        Issue upatedIssue = issueTracker.updateIssue(issues.get(0), resultIssue, request);
        assertNotNull(upatedIssue);
    } catch (MachinaException e) {
        log.error(e.getMessage());
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) Issue(com.checkmarx.flow.dto.Issue) ScanResults(com.checkmarx.sdk.dto.ScanResults) MachinaException(com.checkmarx.flow.exception.MachinaException) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 25 with Issue

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

the class ServiceNowTrackerTest method createAndSearchIssues_WithAllParams_Success.

@Test
public void createAndSearchIssues_WithAllParams_Success() {
    try {
        log.info("Start createAndSearchIssues_WithAllParams_Success");
        ScanResults.XIssue issue = getIssue("create test incident");
        ScanRequest request = getRequest();
        issueTracker.init(request, null);
        Issue newIssue = issueTracker.createIssue(issue, request);
        assertNotNull(newIssue);
    } catch (MachinaException e) {
        log.error(e.getMessage());
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) Issue(com.checkmarx.flow.dto.Issue) ScanResults(com.checkmarx.sdk.dto.ScanResults) MachinaException(com.checkmarx.flow.exception.MachinaException) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Issue (com.checkmarx.flow.dto.Issue)27 MachinaException (com.checkmarx.flow.exception.MachinaException)8 ArrayList (java.util.ArrayList)8 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)6 ScanRequest (com.checkmarx.flow.dto.ScanRequest)5 MachinaRuntimeException (com.checkmarx.flow.exception.MachinaRuntimeException)5 ScanResults (com.checkmarx.sdk.dto.ScanResults)5 URI (java.net.URI)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 FlowProperties (com.checkmarx.flow.config.FlowProperties)2 ServiceNowProperties (com.checkmarx.flow.config.ServiceNowProperties)2 IssueTracker (com.checkmarx.flow.custom.IssueTracker)2 Incident (com.checkmarx.flow.dto.servicenow.Incident)2 Result (com.checkmarx.flow.dto.servicenow.Result)2 HTMLHelper (com.checkmarx.flow.utils.HTMLHelper)2 ScanUtils (com.checkmarx.flow.utils.ScanUtils)2 Lists (com.google.common.collect.Lists)2