use of com.synopsys.integration.blackduck.codelocation.upload.UploadOutput in project blackduck-common by blackducksoftware.
the class CodeLocationServiceTestIT method createAndUploadSimpleBdioObject.
private void createAndUploadSimpleBdioObject(List<String> codeLocationNames) throws IOException, IntegrationException {
UploadBatch uploadBatch = new UploadBatch();
for (String codeLocationName : codeLocationNames) {
File bdioFile = File.createTempFile("bdio", "jsonld");
bdioFile.deleteOnExit();
ProjectDependencyGraph dependencyGraph = new ProjectDependencyGraph(Dependency.FACTORY.createMavenDependency(GROUP, PROJECT_NAME, VERSION));
Dependency bdioTestDependency = Dependency.FACTORY.createMavenDependency(GROUP, COMPONENT_NAME, VERSION);
dependencyGraph.addChildrenToRoot(bdioTestDependency);
SimpleBdioDocument simpleBdioDocument = simpleBdioFactory.createPopulatedBdioDocument(codeLocationName, dependencyGraph);
simpleBdioFactory.writeSimpleBdioDocumentToFile(bdioFile, simpleBdioDocument);
uploadBatch.addUploadTarget(UploadTarget.createDefault(new NameVersion(PROJECT_NAME, VERSION), codeLocationName, bdioFile));
}
BdioUploadService bdioUploadService = blackDuckServices.blackDuckServicesFactory.createBdioUploadService();
BdioUploadCodeLocationCreationRequest uploadRequest = bdioUploadService.createUploadRequest(uploadBatch);
UploadBatchOutput uploadBatchOutput = bdioUploadService.uploadBdio(uploadRequest).getOutput();
for (UploadOutput uploadOutput : uploadBatchOutput) {
assertEquals(Result.SUCCESS, uploadOutput.getResult(), String.format("Upload result for %s was not successful", uploadOutput.getCodeLocationName()));
}
}
Aggregations