use of com.synopsys.integration.blackduck.codelocation.upload.UploadOutput in project blackduck-common by blackducksoftware.
the class UploadBatchRunner method uploadTargets.
private UploadBatchOutput uploadTargets(UploadBatch uploadBatch) throws BlackDuckIntegrationException {
List<UploadOutput> uploadOutputs = new ArrayList<>();
try {
List<UploadCallable> callables = createCallables(uploadBatch);
List<Future<UploadOutput>> submitted = new ArrayList<>();
for (UploadCallable callable : callables) {
submitted.add(executorService.submit(callable));
}
for (Future<UploadOutput> future : submitted) {
UploadOutput uploadOutput = future.get();
uploadOutputs.add(uploadOutput);
}
} catch (Exception e) {
throw new BlackDuckIntegrationException(String.format("Encountered a problem uploading a file: %s", e.getMessage()), e);
}
return new UploadBatchOutput(uploadOutputs);
}
use of com.synopsys.integration.blackduck.codelocation.upload.UploadOutput in project synopsys-detect by blackducksoftware.
the class BdioUploadOperation method checkForUploadFailure.
private void checkForUploadFailure(CodeLocationCreationData<UploadBatchOutput> response) throws DetectUserFriendlyException {
for (UploadOutput uploadOutput : response.getOutput()) {
if (uploadOutput.getResult() == Result.FAILURE) {
logger.error(String.format("Failed to upload code location: %s", uploadOutput.getCodeLocationName()));
logger.error(String.format("Reason: %s", uploadOutput.getErrorMessage().orElse("Unknown reason.")));
throw new DetectUserFriendlyException("An error occurred uploading a bdio file.", uploadOutput.getException().orElse(null), ExitCodeType.FAILURE_BLACKDUCK_FEATURE_ERROR);
}
}
}
use of com.synopsys.integration.blackduck.codelocation.upload.UploadOutput in project blackduck-common by blackducksoftware.
the class IntelligentPersistenceBatchRunner method uploadTargets.
private UploadBatchOutput uploadTargets(UploadBatch uploadBatch, long timeout) throws BlackDuckIntegrationException {
List<UploadOutput> uploadOutputs = new ArrayList<>();
try {
List<IntelligentPersistenceCallable> callables = createCallables(uploadBatch, timeout);
List<Future<UploadOutput>> submitted = new ArrayList<>();
for (IntelligentPersistenceCallable callable : callables) {
submitted.add(executorService.submit(callable));
}
for (Future<UploadOutput> future : submitted) {
UploadOutput uploadOutput = future.get();
uploadOutputs.add(uploadOutput);
}
} catch (Exception e) {
throw new BlackDuckIntegrationException(String.format("Encountered a problem uploading a file: %s", e.getMessage()), e);
}
return new UploadBatchOutput(uploadOutputs);
}
use of com.synopsys.integration.blackduck.codelocation.upload.UploadOutput in project blackduck-common by blackducksoftware.
the class UploadBdio2BatchRunner method uploadTargets.
private UploadBatchOutput uploadTargets(UploadBatch uploadBatch) throws BlackDuckIntegrationException {
List<UploadOutput> uploadOutputs = new ArrayList<>();
try {
List<UploadBdio2Callable> callables = createCallables(uploadBatch);
List<Future<UploadOutput>> submitted = new ArrayList<>();
for (UploadBdio2Callable callable : callables) {
submitted.add(executorService.submit(callable));
}
for (Future<UploadOutput> future : submitted) {
UploadOutput uploadOutput = future.get();
uploadOutputs.add(uploadOutput);
}
} catch (Exception e) {
throw new BlackDuckIntegrationException(String.format("Encountered a problem uploading a file: %s", e.getMessage()), e);
}
return new UploadBatchOutput(uploadOutputs);
}
use of com.synopsys.integration.blackduck.codelocation.upload.UploadOutput in project blackduck-common by blackducksoftware.
the class ComprehensiveCookbookTestIT method testPolicyStatusFromBdioImport.
@Test
public void testPolicyStatusFromBdioImport() throws Exception {
String projectName = "ek_mtglist";
String projectVersionName = "0.0.1";
String codeLocationName = "ek_mtglist Black Duck I/O Export";
String policyRuleName = "Test Rule for comprehensive policy status/bdio";
String componentName = "Apache POI";
String componentVersion = "3.9";
String groupId = "org.apache.poi";
String artifact = "poi";
CheckPolicyData checkPolicyData = new CheckPolicyData(projectName, projectVersionName, codeLocationName, policyRuleName, componentName, componentVersion, groupId, artifact);
BlackDuckServices blackDuckServices = new BlackDuckServices(intHttpClientTestHelper);
setupPolicyCheck(blackDuckServices, checkPolicyData);
UserView currentUser = blackDuckServices.userService.findCurrentUser();
Date userStartDate = blackDuckServices.notificationService.getLatestUserNotificationDate(currentUser);
Date systemStartDate = blackDuckServices.notificationService.getLatestNotificationDate();
// import the bdio
File file = intHttpClientTestHelper.getFile("bdio/mtglist_bdio.jsonld");
UploadBatch uploadBatch = new UploadBatch(UploadTarget.createDefault(new NameVersion(projectName, projectVersionName), codeLocationName, file));
BdioUploadService bdioUploadService = blackDuckServices.blackDuckServicesFactory.createBdioUploadService();
UploadBatchOutput uploadBatchOutput = bdioUploadService.uploadBdioAndWait(uploadBatch, 15 * 60);
for (UploadOutput uploadOutput : uploadBatchOutput) {
assertEquals(Result.SUCCESS, uploadOutput.getResult());
}
VerifyNotifications.verify(currentUser, blackDuckServices.blackDuckRegistrationService, blackDuckServices.notificationService, userStartDate, systemStartDate);
completePolicyCheck(blackDuckServices, checkPolicyData);
}
Aggregations