use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.
the class SSCHandlerTest method scanIsOverButNoIssueTest.
@Test
public void scanIsOverButNoIssueTest() throws IOException {
String projectResponse = getDummyProjectResponse();
String projectVersionsResponse = getProjectVersionResponse();
String artifactResponse = getArtificatResponse("PROCESS_COMPLETE");
MockSSCRestClient mockSSCRestClient = new MockSSCRestClient(Arrays.asList(projectResponse, projectVersionsResponse, artifactResponse, "{\"data\":[]}"));
SSCHandler sscHandler = new SSCHandler(queueItem, configMock, mockSSCRestClient);
Optional<Issues> issuesIfScanCompleted = sscHandler.getIssuesIfScanCompleted();
Assert.assertTrue(issuesIfScanCompleted.isPresent());
Assert.assertEquals(0, issuesIfScanCompleted.get().getData().size());
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.
the class SSCHandlerTest method errorInScanTest.
@Test(expected = PermanentException.class)
public void errorInScanTest() throws IOException {
String projectResponse = getDummyProjectResponse();
String projectVersionsResponse = getProjectVersionResponse();
String artifactResponse = getArtificatResponse("ERROR_PROCESSING");
MockSSCRestClient mockSSCRestClient = new MockSSCRestClient(Arrays.asList(projectResponse, projectVersionsResponse, artifactResponse));
SSCHandler sscHandler = new SSCHandler(queueItem, configMock, mockSSCRestClient);
sscHandler.isScanProcessFinished();
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.
the class SSCHandlerTest method scanIsNotOverTest.
@Test
public void scanIsNotOverTest() throws IOException {
String projectResponse = getDummyProjectResponse();
String projectVersionsResponse = getProjectVersionResponse();
String artifactResponse = getArtificatResponse("PROCESSING");
MockSSCRestClient mockSSCRestClient = new MockSSCRestClient(Arrays.asList(projectResponse, projectVersionsResponse, artifactResponse));
SSCHandler sscHandler = new SSCHandler(queueItem, configMock, mockSSCRestClient);
Assert.assertFalse(sscHandler.isScanProcessFinished());
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.
the class SSCHandlerTest method scanIsOverAndThereAreIssuesTest.
@Test
public void scanIsOverAndThereAreIssuesTest() throws IOException {
String projectResponse = getDummyProjectResponse();
String projectVersionsResponse = getProjectVersionResponse();
String artifactResponse = getArtificatResponse("PROCESS_COMPLETE");
MockSSCRestClient mockSSCRestClient = new MockSSCRestClient(Arrays.asList(projectResponse, projectVersionsResponse, artifactResponse, DummyContents.issuesPart1, DummyContents.issuesPart2, DummyContents.issuesPart3));
SSCHandler sscHandler = new SSCHandler(queueItem, configMock, mockSSCRestClient);
Optional<Issues> issuesIfScanCompleted = sscHandler.getIssuesIfScanCompleted();
Assert.assertTrue(issuesIfScanCompleted.isPresent());
Assert.assertEquals(3, issuesIfScanCompleted.get().getData().size());
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCHandler in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesTests method simpleFields.
@Test
public void simpleFields() {
Issues.Issue issue = new Issues.Issue();
issue.fullFileName = "fullFileName";
issue.lineNumber = 100;
issue.issueInstanceId = "ID_ID_ID";
issue.foundDate = "2018-09-12T14:01:20.590+0000";
issue.hRef = "hRef";
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).getPrimaryLocationFull(), "fullFileName");
Assert.assertEquals(String.valueOf(octaneIssues.get(0).getLine()), String.valueOf(100));
Assert.assertEquals(octaneIssues.get(0).getRemoteId(), "ID_ID_ID");
Assert.assertNotNull(octaneIssues.get(0).getIntroducedDate());
Assert.assertEquals(octaneIssues.get(0).getExternalLink(), "hRef");
}
Aggregations