use of com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder in project synopsys-detect by blackducksoftware.
the class ProjectInspectorTests method gradleProjectInspector.
@Test
void gradleProjectInspector() throws IOException, InterruptedException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-gradle-project-inspector", "gradle-simple:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("SimpleGradle.dockerfile"));
DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
commandBuilder.property(DetectProperties.DETECT_TOOLS, "DETECTOR");
commandBuilder.property(DetectProperties.BLACKDUCK_OFFLINE_MODE, "true");
commandBuilder.property(DetectProperties.DETECT_BUILDLESS, "true");
commandBuilder.property(DetectProperties.DETECT_INCLUDED_DETECTOR_TYPES, DetectorType.GRADLE.toString());
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.successfulDetectorType("GRADLE");
dockerAssertions.atLeastOneBdioFile();
dockerAssertions.logContains("Gradle Project Inspector");
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder in project synopsys-detect by blackducksoftware.
the class ProjectInspectorTests method mavenProjectInspector.
@Test
void mavenProjectInspector() throws IOException, InterruptedException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-maven-project-inspector", "maven-simple:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("SimpleMaven.dockerfile"));
DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
commandBuilder.property(DetectProperties.DETECT_TOOLS, "DETECTOR");
commandBuilder.property(DetectProperties.BLACKDUCK_OFFLINE_MODE, "true");
commandBuilder.property(DetectProperties.DETECT_BUILDLESS, "true");
commandBuilder.property(DetectProperties.DETECT_INCLUDED_DETECTOR_TYPES, DetectorType.MAVEN.toString());
commandBuilder.property(DetectProperties.DETECT_MAVEN_BUILDLESS_LEGACY_MODE, "false");
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.successfulDetectorType("MAVEN");
dockerAssertions.atLeastOneBdioFile();
dockerAssertions.logContains("Maven Project Inspector");
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder in project synopsys-detect by blackducksoftware.
the class SbtEncodingTest method sbtEncoding.
@Test
void sbtEncoding() throws IOException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-sbt-encoding", "detect-sbt-encoding:1.0.3")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("SbtEncoding.dockerfile"));
DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
commandBuilder.tools(DetectTool.DETECTOR);
commandBuilder.property(DetectProperties.DETECT_SBT_ARGUMENTS, "-Dsbt.log.noformat=true");
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.atLeastOneBdioFile();
dockerAssertions.projectVersion("sbt-simple-project_2.12", "1.0.0-SNAPSHOT");
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder in project synopsys-detect by blackducksoftware.
the class DetectOnAlertTest method detectOnAlert.
@Test
@Disabled
// currently adds a lot of time, for I expect little value. If useful, feel free to re-enable.
void detectOnAlert() throws IOException, IntegrationException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-on-alert", "alert-6.5.0:1.0.1")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Alert-6.5.0.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackduckAssertions = blackDuckTestConnection.projectVersionAssertions("blackduck-alert", "6.5.1-SNAPSHOT");
blackduckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(test);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.waitForResults();
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.projectVersion(blackduckAssertions.getProjectNameVersion());
blackduckAssertions.codeLocationCount(16);
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder in project synopsys-detect by blackducksoftware.
the class DetectOnDetectTest method testDryRunScanWithSnippetMatching.
@Test
@ExtendWith(TempDirectory.class)
public void testDryRunScanWithSnippetMatching(@TempDirectory.TempDir Path tempOutputDirectory) throws Exception {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-on-detect-dryrun", "detect-7.1.0:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Detect-7.1.0.dockerfile"));
String projectName = "synopsys-detect-junit";
String projectVersionName = "dryrun-scan";
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackDuckAssertions = blackDuckTestConnection.projectVersionAssertions(projectName, projectVersionName);
blackDuckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(test);
commandBuilder.projectNameVersion(blackDuckAssertions.getProjectNameVersion());
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.property(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_SNIPPET_MATCHING, "SNIPPET_MATCHING");
commandBuilder.property(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_DRY_RUN, "true");
DockerAssertions dockerAssertions = test.run(commandBuilder);
assertDirectoryStructureForOfflineScan(dockerAssertions.getOutputDirectory().toPath());
}
}
Aggregations