use of com.hp.octane.integrations.dto.securityscans.SSCProjectConfiguration in project octane-ci-java-sdk by MicroFocus.
the class SSCHandlerTest method getSscProjectConfiguration.
private SSCProjectConfiguration getSscProjectConfiguration() {
SSCProjectConfiguration configMock = createNiceMock(SSCProjectConfiguration.class);
expect(configMock.getSSCUrl()).andReturn("DummyURL").anyTimes();
expect(configMock.isValid()).andReturn(true).anyTimes();
expect(configMock.getProjectName()).andReturn("ABCDEF").anyTimes();
expect(configMock.getProjectVersion()).andReturn("1").anyTimes();
replay(configMock);
return configMock;
}
use of com.hp.octane.integrations.dto.securityscans.SSCProjectConfiguration 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.dto.securityscans.SSCProjectConfiguration in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesTests method wellFormedURLS.
@Test
public void wellFormedURLS() {
SSCProjectConfiguration sscFortifyConfigurations = dtoFactory.newDTO(SSCProjectConfiguration.class).setSSCUrl("server_url").setProjectName("project").setProjectVersion("version").setSSCBaseAuthToken("");
SSCRestClient sscClientMock = createNiceMock(SSCRestClient.class);
replay();
SSCProjectConnector sscProjectConnector = new SSCProjectConnector(sscFortifyConfigurations, sscClientMock);
String projectIdURL = sscProjectConnector.getProjectIdURL();
String newIssuesURL = sscProjectConnector.getIssuesURL(1);
String artifactsURL = sscProjectConnector.getArtifactsURL(100, 1000);
String urlForProjectVersion = sscProjectConnector.getURLForProjectVersion(500);
Assert.assertEquals(projectIdURL, "projects?q=name:project");
Assert.assertEquals(newIssuesURL, "projectVersions/1/issues?showhidden=false&showremoved=false&showsuppressed=false");
Assert.assertEquals(artifactsURL, "projectVersions/100/artifacts?limit=1000");
Assert.assertEquals(urlForProjectVersion, "projects/500/versions?q=name:version");
}
use of com.hp.octane.integrations.dto.securityscans.SSCProjectConfiguration in project octane-ci-java-sdk by MicroFocus.
the class SSCServiceImpl method getNonCacheVulnerabilitiesScanResultStream.
private List<OctaneIssue> getNonCacheVulnerabilitiesScanResultStream(VulnerabilitiesQueueItem queueItem) throws IOException {
SSCProjectConfiguration sscProjectConfiguration = configurer.pluginServices.getSSCProjectConfiguration(queueItem.getJobId(), queueItem.getBuildId());
if (sscProjectConfiguration == null || !sscProjectConfiguration.isValid()) {
logger.error(configurer.octaneConfiguration.getLocationForLog() + "cannot retrieve SSC Project CFG.");
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "SSC project configurations is missing or not valid, skipping processing for " + queueItem.getJobId() + " #" + queueItem.getBuildId());
return null;
}
SSCHandler sscHandler = new SSCHandler(queueItem, sscProjectConfiguration, this.restService.obtainSSCRestClient());
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "retrieve issues from SSC");
List<Issues.Issue> issuesFromSecurityTool = getIssuesFromSSC(sscHandler, queueItem);
if (issuesFromSecurityTool == null) {
return null;
}
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "retrieve octane remote ids");
List<String> octaneExistsIssuesIdsList = getRemoteIdsOfExistIssuesFromOctane(queueItem, sscProjectConfiguration.getRemoteTag());
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "done retrieveing octane remote ids");
PackSSCIssuesToSendToOctane packSSCIssuesToSendToOctane = new PackSSCIssuesToSendToOctane();
packSSCIssuesToSendToOctane.setConsiderMissing(queueItem.getBaselineDate() != null);
packSSCIssuesToSendToOctane.setOctaneIssues(octaneExistsIssuesIdsList);
packSSCIssuesToSendToOctane.setRemoteTag(sscProjectConfiguration.getRemoteTag());
packSSCIssuesToSendToOctane.setSscHandler(sscHandler);
packSSCIssuesToSendToOctane.setSscIssues(issuesFromSecurityTool);
return packSSCIssuesToSendToOctane.packToOctaneIssues();
}
Aggregations