use of com.hp.octane.integrations.services.vulnerabilities.mocks.MockSSCRestClient 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.mocks.MockSSCRestClient 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.mocks.MockSSCRestClient 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.mocks.MockSSCRestClient in project octane-ci-java-sdk by MicroFocus.
the class SSCProjectConnectorPagingTest method pagingOfIssues.
@Test
public void pagingOfIssues() {
SSCProjectConfiguration configMock = createNiceMock(SSCProjectConfiguration.class);
expect(configMock.getSSCUrl()).andReturn("DummyURL").anyTimes();
replay(configMock);
SSCProjectConnector sscProjectConnector = new SSCProjectConnector(configMock, new MockSSCRestClient(Arrays.asList(DummyContents.issuesPart1, DummyContents.issuesPart2, DummyContents.issuesPart3)));
Issues issues = sscProjectConnector.readIssues(1);
Assert.assertEquals(3, issues.getCount());
Assert.assertEquals("Issue 1", issues.getData().get(0).issueName);
Assert.assertEquals("Issue 2", issues.getData().get(1).issueName);
Assert.assertEquals("Issue 3", issues.getData().get(2).issueName);
}
use of com.hp.octane.integrations.services.vulnerabilities.mocks.MockSSCRestClient 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());
}
Aggregations