use of com.blackducksoftware.integration.exception.IntegrationException in project hub-fortify-ssc-integration-service by blackducksoftware.
the class HubServices method getProjectVersion.
/**
* Get the Hub project version information
*
* @param projectName
* @param versionName
* @return
* @throws IllegalArgumentException
* @throws IntegrationException
*/
public ProjectVersionView getProjectVersion(final String projectName, final String projectVersionName) throws IllegalArgumentException, IntegrationException {
logger.info("Getting Hub project and project version info for::" + projectName + ", " + projectVersionName);
final ProjectService projectVersionRequestService = hubServicesFactory.createProjectService();
final ProjectVersionWrapper projectVersionWrapper = projectVersionRequestService.getProjectVersion(projectName, projectVersionName);
if (projectVersionWrapper != null && projectVersionWrapper.getProjectVersionView() != null) {
logger.debug("ProjectVersionView::" + projectVersionWrapper.getProjectVersionView().json);
return projectVersionWrapper.getProjectVersionView();
} else {
throw new IntegrationException("Project Version does not Exists!");
}
}
use of com.blackducksoftware.integration.exception.IntegrationException in project hub-fortify-ssc-integration-service by blackducksoftware.
the class MappingParser method createApplicationVersion.
/**
* Creates a new Application Version, updates the attributes and commits the application to mark it complete on the
* UI
*
* @param createRequest
* @return int - Application ID
* @throws IOException
* @throws IntegrationException
*/
private int createApplicationVersion(CreateApplicationRequest createRequest) throws IOException, IntegrationException {
int applicationId = 0;
applicationId = fortifyApplicationVersionApi.createApplicationVersion(createRequest);
try {
final List<UpdateFortifyApplicationAttributesRequest> updateAttributerequest = addCustomAttributes();
logger.info("updateAttributerequest::" + updateAttributerequest);
fortifyApplicationVersionApi.updateApplicationAttributes(applicationId, updateAttributerequest);
CommitFortifyApplicationRequest commitRequest = new CommitFortifyApplicationRequest(true);
fortifyApplicationVersionApi.commitApplicationVersion(applicationId, commitRequest);
} catch (IOException e) {
fortifyApplicationVersionApi.deleteApplicationVersion(applicationId);
throw new IOException(e);
} catch (IntegrationException e) {
fortifyApplicationVersionApi.deleteApplicationVersion(applicationId);
throw new IntegrationException(e);
}
return applicationId;
}
use of com.blackducksoftware.integration.exception.IntegrationException in project hub-fortify-ssc-integration-service by blackducksoftware.
the class HubServicesTest method getBomLastUpdatedAt.
@Test
public void getBomLastUpdatedAt() throws IllegalArgumentException, IntegrationException {
System.out.println("Executing getBomLastUpdatedAt");
ProjectVersionView projectVersionItem = null;
try {
projectVersionItem = hubServices.getProjectVersion(PROJECT_NAME, VERSION_NAME);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IntegrationException e) {
e.printStackTrace();
}
Date bomLastUpdatedAt = hubServices.getBomLastUpdatedAt(projectVersionItem);
System.out.println("bomLastUpdatedAt::" + bomLastUpdatedAt);
assertNotNull(bomLastUpdatedAt);
}
use of com.blackducksoftware.integration.exception.IntegrationException in project hub-fortify-ssc-integration-service by blackducksoftware.
the class HubServicesTest method getProjectVersionWithInvalidProjectName.
@Test
public void getProjectVersionWithInvalidProjectName() {
System.out.println("Executing getProjectVersionWithInvalidProjectName");
ProjectVersionView projectVersionItem = null;
try {
projectVersionItem = hubServices.getProjectVersion("Solr1", VERSION_NAME);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IntegrationException e) {
// e.printStackTrace();
System.out.println("Error message::" + e.getMessage());
assertTrue(e.getMessage().contains("This Project does not exist"));
}
assertNull(projectVersionItem);
}
use of com.blackducksoftware.integration.exception.IntegrationException 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);
}
Aggregations