use of com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner in project synopsys-detect by blackducksoftware.
the class RapidModeTests method anyProjectWithRapidResultsInBlackDuck.
SharedDockerTestRunner anyProjectWithRapidResultsInBlackDuck(String testId, NameVersion projectNameVersion) throws IOException, IntegrationException {
try (DetectDockerTestRunner runner = new DetectDockerTestRunner(testId, "gradle-simple:1.0.0")) {
runner.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("SimpleGradle.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackduckAssertions = blackDuckTestConnection.projectVersionAssertions(projectNameVersion);
blackduckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(runner);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackduckAssertions);
// All that is needed for a BOM in black duck.
commandBuilder.tools(DetectTool.DETECTOR);
return new SharedDockerTestRunner(runner, blackDuckTestConnection, blackduckAssertions, commandBuilder);
}
}
use of com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner in project synopsys-detect by blackducksoftware.
the class RapidModeTests method rapidModeSmokeTest.
@Test
void rapidModeSmokeTest() throws IOException, IntegrationException {
SharedDockerTestRunner test = anyProjectWithRapidResultsInBlackDuck("rapid-mode-smoke-test", new NameVersion("rapid-mode", "smoke-test"));
// Ensuring regardless of the source or working directory being chosen, this test still produces a risk report in the same location.
test.command.property(DetectProperties.DETECT_BLACKDUCK_SCAN_MODE, "RAPID");
DockerAssertions dockerAssertions = test.run();
dockerAssertions.logContains("Critical and blocking policy violations for");
dockerAssertions.logContains("* Components: 0");
dockerAssertions.successfulOperation("Generate Rapid Json File");
}
use of com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner in project synopsys-detect by blackducksoftware.
the class RiskReportTests method riskReportNotCreatedInWorkingDir.
@Test
void riskReportNotCreatedInWorkingDir() throws IOException, InterruptedException, IntegrationException {
SharedDockerTestRunner test = anyProjectWithRiskReportResultsInBlackDuck("risk-report-does-not-use-working-directory", new NameVersion("risk-reports", "default-not-working-directory"));
test.runner.withWorkingDirectory("/opt/random");
test.command.property(DetectProperties.DETECT_SOURCE_PATH, "/opt/project/src");
test.command.property(DetectProperties.DETECT_RISK_REPORT_PDF, "true");
DockerAssertions dockerAssertions = test.run();
dockerAssertions.resultProducedAtLocation("/opt/project/src/risk_reports_default_not_working_directory_BlackDuck_RiskReport.pdf");
}
use of com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner in project synopsys-detect by blackducksoftware.
the class RiskReportTests method riskReportSmokeTest.
@Test
void riskReportSmokeTest() throws IOException, InterruptedException, IntegrationException {
SharedDockerTestRunner test = anyProjectWithRiskReportResultsInBlackDuck("risk-report-smoke-test", new NameVersion("risk-reports", "smoke-test"));
// Ensuring regardless of the source or working directory being chosen, this test still produces a risk report in the same location.
test.runner.withWorkingDirectory("/opt/project/src");
test.command.property(DetectProperties.DETECT_SOURCE_PATH, "/opt/project/src");
test.command.property(DetectProperties.DETECT_RISK_REPORT_PDF, "true");
DockerAssertions dockerAssertions = test.run();
dockerAssertions.resultProducedAtLocation("/opt/project/src/risk_reports_smoke_test_BlackDuck_RiskReport.pdf");
}
use of com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner in project synopsys-detect by blackducksoftware.
the class RiskReportTests method anyProjectWithRiskReportResultsInBlackDuck.
// create any bom for a risk report
SharedDockerTestRunner anyProjectWithRiskReportResultsInBlackDuck(String testId, NameVersion projectNameVersion) throws IOException, IntegrationException {
try (DetectDockerTestRunner runner = new DetectDockerTestRunner(testId, "gradle-simple:1.0.0")) {
runner.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("SimpleGradle.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackduckAssertions = blackDuckTestConnection.projectVersionAssertions(projectNameVersion);
blackduckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(runner);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackduckAssertions);
// All that is needed for a BOM in black duck.
commandBuilder.tools(DetectTool.DETECTOR);
return new SharedDockerTestRunner(runner, blackDuckTestConnection, blackduckAssertions, commandBuilder);
}
}
Aggregations