Search in sources :

Example 6 with SSCHandler

use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.

the class VulnerabilitiesTests method extendedData.

@Test
public void extendedData() {
    Issues.Issue issue = new Issues.Issue();
    issue.issueName = "name";
    issue.likelihood = "likelihood";
    issue.impact = "impact";
    issue.kingdom = "kingdom";
    issue.confidance = "confidence";
    issue.removedDate = "removedDate";
    Issues sscIssues = new Issues();
    sscIssues.setData(Arrays.asList(issue));
    SSCHandler sscHandler = new SSCHandler();
    List<OctaneIssue> octaneIssues = createOctaneIssues(sscIssues.getData(), "Tag", new HashMap<>());
    Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("issueName"), "name");
    Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("likelihood"), "likelihood");
    Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("kingdom"), "kingdom");
    Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("impact"), "impact");
    Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("confidence"), "confidence");
    Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("removedDate"), "removedDate");
}
Also used : OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) SSCHandler(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler) SSCToOctaneIssueUtil.createOctaneIssues(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCToOctaneIssueUtil.createOctaneIssues) Issues(com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Issues) OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) Test(org.junit.Test)

Example 7 with SSCHandler

use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.

the class VulnerabilitiesTests method analysisSSCToOctaneWellTransformed.

@Test
public void analysisSSCToOctaneWellTransformed() {
    Issues sscIssues = new Issues();
    Issues.Issue issue1 = new Issues.Issue();
    issue1.reviewed = true;
    Issues.Issue issue2 = new Issues.Issue();
    issue2.audited = true;
    Issues.Issue issue3 = new Issues.Issue();
    issue3.issueStatus = "reviewed";
    Issues.Issue issue4 = new Issues.Issue();
    sscIssues.setData(Arrays.asList(issue1, issue2, issue3, issue4));
    SSCHandler sscHandler = new SSCHandler();
    List<OctaneIssue> octaneIssues = createOctaneIssues(sscIssues.getData(), "Tag", new HashMap<>());
    for (int i = 0; i < 4; i++) {
        if (i != 3) {
            Assert.assertEquals("list_node.issue_analysis_node.reviewed", octaneIssues.get(i).getAnalysis().getId());
        } else {
            Assert.assertNull(octaneIssues.get(i).getAnalysis());
        }
    }
}
Also used : OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) SSCHandler(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler) SSCToOctaneIssueUtil.createOctaneIssues(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCToOctaneIssueUtil.createOctaneIssues) Issues(com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Issues) OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) Test(org.junit.Test)

Example 8 with SSCHandler

use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.

the class VulnerabilitiesTests method stateOctaneWellTransformed.

@Test
public void stateOctaneWellTransformed() {
    Issues.Issue issue1 = new Issues.Issue();
    issue1.scanStatus = "UPDATED";
    Issues.Issue issue2 = new Issues.Issue();
    issue2.scanStatus = "NEW";
    Issues.Issue issue3 = new Issues.Issue();
    issue3.scanStatus = "REINTRODUCED";
    Issues.Issue issue4 = new Issues.Issue();
    issue4.scanStatus = "REMOVED";
    Issues.Issue issue5 = new Issues.Issue();
    Issues sscIssues = new Issues();
    sscIssues.setData(Arrays.asList(issue1, issue2, issue3, issue4, issue5));
    SSCHandler sscHandler = new SSCHandler();
    List<OctaneIssue> octaneIssues = createOctaneIssues(sscIssues.getData(), "Tag", new HashMap<>());
    String[] expectedValues = new String[] { "list_node.issue_state_node.existing", "list_node.issue_state_node.new", "list_node.issue_state_node.reopen", "list_node.issue_state_node.closed" };
    for (int i = 0; i < 5; i++) {
        if (i != 4) {
            Assert.assertEquals(expectedValues[i], octaneIssues.get(i).getState().getId());
        } else {
            Assert.assertNull(octaneIssues.get(i).getState());
        }
    }
}
Also used : OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) SSCHandler(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler) SSCToOctaneIssueUtil.createOctaneIssues(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCToOctaneIssueUtil.createOctaneIssues) Issues(com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Issues) OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) Test(org.junit.Test)

Aggregations

SSCHandler (com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler)8 Test (org.junit.Test)8 Issues (com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Issues)6 OctaneIssue (com.hp.octane.integrations.dto.securityscans.OctaneIssue)4 MockSSCRestClient (com.hp.octane.integrations.services.vulnerabilities.mocks.MockSSCRestClient)4 SSCToOctaneIssueUtil.createOctaneIssues (com.hp.octane.integrations.services.vulnerabilities.ssc.SSCToOctaneIssueUtil.createOctaneIssues)4