use of com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisUploadService in project synopsys-detect by blackducksoftware.
the class ImpactAnalysisTestIT method testImpactAnalysisForDetect.
@Test
public void testImpactAnalysisForDetect() throws IOException, IntegrationException {
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
NameVersion projectNameVersion = new NameVersion("synopsys-detect-junit", "impact-analysis");
BlackDuckServicesFactory blackDuckServicesFactory = blackDuckTestConnection.getBlackDuckServicesFactory();
File toScan = new File("./");
Path outputDirectory = outputDirAsPath.toPath();
ImpactAnalysisNamingOperation impactAnalysisNamingOperation = new ImpactAnalysisNamingOperation(codeLocationNameManager);
String impactAnalysisCodeLocationName = impactAnalysisNamingOperation.createCodeLocationName(toScan, projectNameVersion);
GenerateImpactAnalysisOperation generateImpactAnalysisOperation = new GenerateImpactAnalysisOperation();
Path impactAnalysisFile = generateImpactAnalysisOperation.generateImpactAnalysis(toScan, impactAnalysisCodeLocationName, outputDirectory);
ImpactAnalysisBatchRunner impactAnalysisBatchRunner = new ImpactAnalysisBatchRunner(logger, blackDuckServicesFactory.getBlackDuckApiClient(), blackDuckServicesFactory.getApiDiscovery(), new NoThreadExecutorService(), blackDuckServicesFactory.getGson());
ImpactAnalysisUploadService impactAnalysisUploadService = new ImpactAnalysisUploadService(impactAnalysisBatchRunner, blackDuckServicesFactory.createCodeLocationCreationService());
ImpactAnalysisUploadOperation impactAnalysisUploadOperation = new ImpactAnalysisUploadOperation(impactAnalysisUploadService);
CodeLocationCreationData<ImpactAnalysisBatchOutput> creationData = impactAnalysisUploadOperation.uploadImpactAnalysis(impactAnalysisFile, projectNameVersion, impactAnalysisCodeLocationName);
assertEquals(1, creationData.getOutput().getOutputs().size());
assertEquals(Result.SUCCESS, creationData.getOutput().getOutputs().get(0).getResult());
}
Aggregations