use of com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection in project synopsys-detect by blackducksoftware.
the class RiskReportServiceTestIT method createReportPdfFileTest.
@Test
@ExtendWith(TempDirectory.class)
public void createReportPdfFileTest(@TempDirectory.TempDir Path folderForReport) throws IntegrationException {
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
ReportService reportService = blackDuckTestConnection.createReportService();
ProjectVersionWrapper projectVersionWrapper = blackDuckTestConnection.projectVersionAssertions(PROJECT_NAME, PROJECT_VERSION_NAME).retrieveProjectVersionWrapper();
File folder = folderForReport.toFile();
File pdfFile = reportService.createReportPdfFile(folder, projectVersionWrapper.getProjectView(), projectVersionWrapper.getProjectVersionView());
Assertions.assertNotNull(pdfFile);
Assertions.assertTrue(pdfFile.exists());
}
use of com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection in project synopsys-detect by blackducksoftware.
the class RiskReportServiceTestIT method createNoticesReportFileTest.
@Test
@ExtendWith(TempDirectory.class)
public void createNoticesReportFileTest(@TempDirectory.TempDir Path folderForReport) throws IntegrationException, InterruptedException {
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
ReportService reportService = blackDuckTestConnection.createReportService();
ProjectVersionWrapper projectVersionWrapper = blackDuckTestConnection.projectVersionAssertions(PROJECT_NAME, PROJECT_VERSION_NAME).retrieveProjectVersionWrapper();
File noticeReportFile = reportService.createNoticesReportFile(folderForReport.toFile(), projectVersionWrapper.getProjectView(), projectVersionWrapper.getProjectVersionView());
Assertions.assertNotNull(noticeReportFile);
Assertions.assertTrue(noticeReportFile.exists());
}
use of com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection 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());
}
use of com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection in project synopsys-detect by blackducksoftware.
the class RiskReportServiceTestIT method createProjectFirst.
@BeforeAll
public static void createProjectFirst() throws IntegrationException {
String testPhase = ProjectVersionPhaseType.DEVELOPMENT.name();
String testDistribution = ProjectVersionDistributionType.OPENSOURCE.name();
ProjectSyncModel projectSyncModel = new ProjectSyncModel(PROJECT_NAME, PROJECT_VERSION_NAME);
projectSyncModel.setPhase(ProjectVersionPhaseType.valueOf(testPhase));
projectSyncModel.setDistribution(ProjectVersionDistributionType.valueOf(testDistribution));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
blackDuckTestConnection.createProjectService().syncProjectAndVersion(projectSyncModel);
}
use of com.synopsys.integration.detect.battery.docker.integration.BlackDuckTestConnection in project synopsys-detect by blackducksoftware.
the class RiskReportServiceTestIT method createReportFilesManually.
@Test
@Disabled
public void createReportFilesManually() throws IntegrationException, InterruptedException {
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
ReportService reportService = blackDuckTestConnection.createReportService();
// fill these values in with your particulars
final String projectName = "docker.pkg.github.com_maja-nord_java-eap-app_java-eap-app";
final String projectVersionName = "latest";
final String localPathForPdfReport = "/Users/ekerwin/Documents/working/riskreport_pdf";
final String localPathForNoticesReport = "/Users/ekerwin/Documents/working/notices";
ProjectVersionWrapper projectVersionWrapper = blackDuckTestConnection.projectVersionAssertions(PROJECT_NAME, PROJECT_VERSION_NAME).retrieveProjectVersionWrapper();
File pdfReportFolder = new File(localPathForPdfReport);
File noticesReportFolder = new File(localPathForNoticesReport);
pdfReportFolder.mkdirs();
noticesReportFolder.mkdirs();
reportService.createReportPdfFile(pdfReportFolder, projectVersionWrapper.getProjectView(), projectVersionWrapper.getProjectVersionView());
reportService.createNoticesReportFile(noticesReportFolder, projectVersionWrapper.getProjectView(), projectVersionWrapper.getProjectVersionView());
}
Aggregations