use of com.synopsys.integration.detect.workflow.blackduck.report.service.ReportService 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.workflow.blackduck.report.service.ReportService 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.workflow.blackduck.report.service.ReportService in project synopsys-detect by blackducksoftware.
the class OperationFactory method creatReportService.
private ReportService creatReportService(BlackDuckRunData blackDuckRunData) throws OperationException {
return auditLog.namedInternal("Create Report Service", () -> {
BlackDuckServicesFactory blackDuckServicesFactory = blackDuckRunData.getBlackDuckServicesFactory();
Gson gson = blackDuckServicesFactory.getGson();
HttpUrl blackDuckUrl = blackDuckRunData.getBlackDuckServerConfig().getBlackDuckUrl();
BlackDuckApiClient blackDuckApiClient = blackDuckServicesFactory.getBlackDuckApiClient();
ApiDiscovery apiDiscovery = blackDuckServicesFactory.getApiDiscovery();
IntLogger reportServiceLogger = blackDuckServicesFactory.getLogger();
IntegrationEscapeUtil integrationEscapeUtil = blackDuckServicesFactory.createIntegrationEscapeUtil();
long reportServiceTimeout = detectConfigurationFactory.findTimeoutInSeconds() * 1000;
return new ReportService(gson, blackDuckUrl, blackDuckApiClient, apiDiscovery, reportServiceLogger, integrationEscapeUtil, reportServiceTimeout);
});
}
use of com.synopsys.integration.detect.workflow.blackduck.report.service.ReportService in project synopsys-detect by blackducksoftware.
the class BlackDuckTestConnection method createReportService.
public ReportService createReportService() {
HttpUrl blackDuckUrl = blackDuckServicesFactory.getBlackDuckHttpClient().getBlackDuckUrl();
IntegrationEscapeUtil integrationEscapeUtil = blackDuckServicesFactory.createIntegrationEscapeUtil();
long reportServiceTimeout = 120 * 1000;
return new ReportService(blackDuckServicesFactory.getGson(), blackDuckUrl, blackDuckServicesFactory.getBlackDuckApiClient(), blackDuckServicesFactory.getApiDiscovery(), new BufferedIntLogger(), integrationEscapeUtil, reportServiceTimeout);
}
use of com.synopsys.integration.detect.workflow.blackduck.report.service.ReportService in project synopsys-detect by blackducksoftware.
the class DetectOnDetectTest method riskReportPopulatedAtCustomPath.
@Test
public // Tests that a new project has an empty report, run detect to fill it, tests the report is filled, in a custom location
void riskReportPopulatedAtCustomPath() throws Exception {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-on-detect-riskreport-custom", "detect-7.1.0:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Detect-7.1.0.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
ReportService reportService = blackDuckTestConnection.createReportService();
BlackDuckAssertions blackDuckAssertions = blackDuckTestConnection.projectVersionAssertions("synopsys-detect-junit", "risk-report-custom");
ProjectVersionWrapper projectVersionWrapper = blackDuckAssertions.emptyOnBlackDuck();
String reportDirectoryImagePath = "/opt/report";
File reportDirectory = test.directories().createResultDirectory("report");
test.directories().withBinding(reportDirectory, reportDirectoryImagePath);
long initialFileLength = assertEmptyRiskReport(reportDirectory, projectVersionWrapper, reportService);
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(test);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackDuckAssertions.getProjectNameVersion());
commandBuilder.property(DetectProperties.DETECT_RISK_REPORT_PDF, "true");
commandBuilder.property(DetectProperties.DETECT_TIMEOUT, "1200");
commandBuilder.property(DetectProperties.DETECT_RISK_REPORT_PDF_PATH, reportDirectoryImagePath);
commandBuilder.tools(DetectTool.DETECTOR);
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.resultProducedAtLocation("/opt/report/synopsys_detect_junit_risk_report_custom_BlackDuck_RiskReport.pdf");
List<File> pdfFiles = getPdfFiles(reportDirectory);
assertEquals(1, pdfFiles.size());
long postLength = pdfFiles.get(0).length();
assertTrue(postLength > initialFileLength);
}
}
Aggregations