use of com.blackducksoftware.integration.hub.api.generated.view.ProjectVersionView in project hub-fortify-ssc-integration-service by blackducksoftware.
the class HubServicesTest method getProjectVersionWithInvalidVersionName.
@Test
public void getProjectVersionWithInvalidVersionName() {
System.out.println("Executing getProjectVersionWithInvalidVersionName");
ProjectVersionView projectVersionItem = null;
try {
projectVersionItem = hubServices.getProjectVersion(PROJECT_NAME, "3.10");
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IntegrationException e) {
// e.printStackTrace();
System.out.println("Error message::" + e.getMessage());
assertTrue(e.getMessage().contains("Could not find the version"));
}
assertNull(projectVersionItem);
}
use of com.blackducksoftware.integration.hub.api.generated.view.ProjectVersionView in project hub-fortify-ssc-integration-service by blackducksoftware.
the class VulnerabilityUtilTest method testRemoveDuplicates.
@Test
public void testRemoveDuplicates() {
System.out.println("Executing testRemoveDuplicates");
List<Vulnerability> vulnerabilities = new ArrayList<>();
try {
try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertyConstants.getBatchJobStatusFilePath()), "utf-8"))) {
writer.write("");
} catch (UnsupportedEncodingException e) {
// do nothing
} catch (FileNotFoundException e) {
// do nothing
} catch (IOException e) {
// do nothing
}
ProjectVersionView projectVersionItem1 = hubServices.getProjectVersion(HUB_PROJECT_NAME_1, HUB_PROJECT_VERSION_NAME_1);
ProjectVersionView projectVersionItem2 = hubServices.getProjectVersion(HUB_PROJECT_NAME_2, HUB_PROJECT_VERSION_NAME_2);
vulnerabilities.addAll(VulnerabilityUtil.transformMapping(hubServices.getVulnerabilityComponentViews(projectVersionItem1), HUB_PROJECT_NAME_1, HUB_PROJECT_VERSION_NAME_1, new Date(), propertyConstants));
vulnerabilities.addAll(VulnerabilityUtil.transformMapping(hubServices.getVulnerabilityComponentViews(projectVersionItem2), HUB_PROJECT_NAME_2, HUB_PROJECT_VERSION_NAME_2, new Date(), propertyConstants));
vulnerabilities = VulnerabilityUtil.removeDuplicates(vulnerabilities);
assertNotNull(vulnerabilities);
System.out.println("vulnerabilities count::" + vulnerabilities.size() + ", vulnerabilities::" + vulnerabilities);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IntegrationException e) {
e.printStackTrace();
}
}
Aggregations