Search in sources :

Example 1 with SSCProjectConnector

use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCProjectConnector 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);
}
Also used : MockSSCRestClient(com.hp.octane.integrations.services.vulnerabilities.mocks.MockSSCRestClient) Issues(com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Issues) SSCProjectConnector(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCProjectConnector) SSCProjectConfiguration(com.hp.octane.integrations.dto.securityscans.SSCProjectConfiguration) Test(org.junit.Test)

Example 2 with SSCProjectConnector

use of com.hp.octane.integrations.services.vulnerabilities.ssc.SSCProjectConnector 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");
}
Also used : SSCRestClient(com.hp.octane.integrations.services.rest.SSCRestClient) SSCProjectConnector(com.hp.octane.integrations.services.vulnerabilities.ssc.SSCProjectConnector) SSCProjectConfiguration(com.hp.octane.integrations.dto.securityscans.SSCProjectConfiguration) Test(org.junit.Test)

Aggregations

SSCProjectConfiguration (com.hp.octane.integrations.dto.securityscans.SSCProjectConfiguration)2 SSCProjectConnector (com.hp.octane.integrations.services.vulnerabilities.ssc.SSCProjectConnector)2 Test (org.junit.Test)2 SSCRestClient (com.hp.octane.integrations.services.rest.SSCRestClient)1 MockSSCRestClient (com.hp.octane.integrations.services.vulnerabilities.mocks.MockSSCRestClient)1 Issues (com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Issues)1