Search in sources :

Example 11 with DockerAssertions

use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions in project synopsys-detect by blackducksoftware.

the class ImpactTest method impactOutputPath.

@Test
void impactOutputPath() throws IOException {
    try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-impact-output-path-test", "detect-impact-test:1.0.0")) {
        test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Impact.dockerfile"));
        DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
        commandBuilder.property(DetectProperties.DETECT_TOOLS, "IMPACT_ANALYSIS");
        commandBuilder.property(DetectProperties.DETECT_IMPACT_ANALYSIS_ENABLED, "true");
        commandBuilder.property(DetectProperties.DETECT_IMPACT_ANALYSIS_OUTPUT_PATH, "/tmp");
        DockerAssertions dockerAssertions = test.run(commandBuilder);
        dockerAssertions.logContains("Vulnerability Impact Analysis generated report at /tmp/external-method-uses.bdmu");
    }
}
Also used : DockerAssertions(com.synopsys.integration.detect.battery.docker.util.DockerAssertions) DetectCommandBuilder(com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder) DetectDockerTestRunner(com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner) Test(org.junit.jupiter.api.Test)

Example 12 with DockerAssertions

use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions in project synopsys-detect by blackducksoftware.

the class ImpactTest method offlineImpact.

@Test
void offlineImpact() throws IOException {
    try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-impact-test", "detect-impact-test:1.0.0")) {
        test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Impact.dockerfile"));
        DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
        commandBuilder.property(DetectProperties.DETECT_TOOLS, "IMPACT_ANALYSIS");
        commandBuilder.property(DetectProperties.DETECT_IMPACT_ANALYSIS_ENABLED, "true");
        DockerAssertions dockerAssertions = test.run(commandBuilder);
        dockerAssertions.successfulTool("IMPACT_ANALYSIS");
        dockerAssertions.logContainsPattern("Vulnerability Impact Analysis generated report at /opt/results/output/runs/.*/impact-analysis/external-method-uses.bdmu");
        dockerAssertions.successfulOperation("Generate Impact Analysis File");
    }
}
Also used : DockerAssertions(com.synopsys.integration.detect.battery.docker.util.DockerAssertions) DetectCommandBuilder(com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder) DetectDockerTestRunner(com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner) Test(org.junit.jupiter.api.Test)

Example 13 with DockerAssertions

use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions 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");
    }
}
Also used : DockerAssertions(com.synopsys.integration.detect.battery.docker.util.DockerAssertions) DetectCommandBuilder(com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder) DetectDockerTestRunner(com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner) Test(org.junit.jupiter.api.Test)

Example 14 with DockerAssertions

use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions 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");
    }
}
Also used : DockerAssertions(com.synopsys.integration.detect.battery.docker.util.DockerAssertions) DetectCommandBuilder(com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder) DetectDockerTestRunner(com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner) Test(org.junit.jupiter.api.Test)

Example 15 with DockerAssertions

use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions 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");
    }
}
Also used : DockerAssertions(com.synopsys.integration.detect.battery.docker.util.DockerAssertions) DetectCommandBuilder(com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder) DetectDockerTestRunner(com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner) Test(org.junit.jupiter.api.Test)

Aggregations

DockerAssertions (com.synopsys.integration.detect.battery.docker.util.DockerAssertions)19 Test (org.junit.jupiter.api.Test)19 DetectCommandBuilder (com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder)15 DetectDockerTestRunner (com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner)15 SharedDockerTestRunner (com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner)4 NameVersion (com.synopsys.integration.util.NameVersion)4 ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)1 ReportService (com.synopsys.integration.detect.workflow.blackduck.report.service.ReportService)1 File (java.io.File)1 Disabled (org.junit.jupiter.api.Disabled)1 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)1