Search in sources :

Example 1 with ImpactAnalysisBatchOutput

use of com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput in project synopsys-detect by blackducksoftware.

the class ImpactAnalysisUploadOperation method uploadImpactAnalysis.

public CodeLocationCreationData<ImpactAnalysisBatchOutput> uploadImpactAnalysis(Path impactAnalysisPath, NameVersion projectNameVersion, String codeLocationName) throws IntegrationException {
    ImpactAnalysis impactAnalysis = new ImpactAnalysis(impactAnalysisPath, projectNameVersion.getName(), projectNameVersion.getVersion(), codeLocationName);
    CodeLocationCreationData<ImpactAnalysisBatchOutput> codeLocationCreationData = impactAnalysisUploadService.uploadImpactAnalysis(impactAnalysis);
    ImpactAnalysisBatchOutput impactAnalysisBatchOutput = codeLocationCreationData.getOutput();
    impactAnalysisBatchOutput.throwExceptionForError(logger);
    return codeLocationCreationData;
}
Also used : ImpactAnalysis(com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysis) ImpactAnalysisBatchOutput(com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput)

Example 2 with ImpactAnalysisBatchOutput

use of com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput 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());
}
Also used : Path(java.nio.file.Path) NameVersion(com.synopsys.integration.util.NameVersion) BlackDuckServicesFactory(com.synopsys.integration.blackduck.service.BlackDuckServicesFactory) ImpactAnalysisUploadService(com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisUploadService) NoThreadExecutorService(com.synopsys.integration.util.NoThreadExecutorService) ImpactAnalysisBatchRunner(com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchRunner) ImpactAnalysisBatchOutput(com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput) BlackDuckTestConnection(com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with ImpactAnalysisBatchOutput

use of com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput in project synopsys-detect by blackducksoftware.

the class IntelligentModeStepRunner method runImpactAnalysisOnline.

public void runImpactAnalysisOnline(NameVersion projectNameVersion, ProjectVersionWrapper projectVersionWrapper, CodeLocationAccumulator codeLocationAccumulator, BlackDuckServicesFactory blackDuckServicesFactory) throws OperationException {
    String impactAnalysisName = operationFactory.generateImpactAnalysisCodeLocationName(projectNameVersion);
    Path impactFile = operationFactory.generateImpactAnalysisFile(impactAnalysisName);
    CodeLocationCreationData<ImpactAnalysisBatchOutput> uploadData = operationFactory.uploadImpactAnalysisFile(impactFile, projectNameVersion, impactAnalysisName, blackDuckServicesFactory);
    operationFactory.mapImpactAnalysisCodeLocations(impactFile, uploadData, projectVersionWrapper, blackDuckServicesFactory);
    /* TODO: There is currently no mechanism within Black Duck for checking the completion status of an Impact Analysis code location. Waiting should happen here when such a mechanism exists. See HUB-25142. JM - 08/2020 */
    codeLocationAccumulator.addNonWaitableCodeLocation(uploadData.getOutput().getSuccessfulCodeLocationNames());
}
Also used : Path(java.nio.file.Path) ImpactAnalysisBatchOutput(com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput)

Aggregations

ImpactAnalysisBatchOutput (com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchOutput)3 Path (java.nio.file.Path)2 BlackDuckServicesFactory (com.synopsys.integration.blackduck.service.BlackDuckServicesFactory)1 BlackDuckTestConnection (com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection)1 ImpactAnalysis (com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysis)1 ImpactAnalysisBatchRunner (com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisBatchRunner)1 ImpactAnalysisUploadService (com.synopsys.integration.detect.tool.impactanalysis.service.ImpactAnalysisUploadService)1 NameVersion (com.synopsys.integration.util.NameVersion)1 NoThreadExecutorService (com.synopsys.integration.util.NoThreadExecutorService)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1