Search in sources :

Example 6 with DetectDockerTestRunner

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

the class ProjectInspectorTests method dotnetProjectInspector.

@Test
void dotnetProjectInspector() throws IOException {
    try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-dotnet-project-inspector", "detect-dotnet-five:1.0.1")) {
        test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Dotnet5.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.NUGET.toString());
        DockerAssertions dockerAssertions = test.run(commandBuilder);
        dockerAssertions.successfulDetectorType("NUGET");
        dockerAssertions.atLeastOneBdioFile();
        dockerAssertions.logContains("NuGet 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 7 with DetectDockerTestRunner

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

the class ProjectInspectorTests method mavenProjectInspectorLegacyIsTheDefault.

@Test
void mavenProjectInspectorLegacyIsTheDefault() throws IOException, InterruptedException {
    try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-maven-project-inspector-legacy", "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());
        DockerAssertions dockerAssertions = test.run(commandBuilder);
        dockerAssertions.successfulDetectorType("MAVEN");
        dockerAssertions.atLeastOneBdioFile();
        dockerAssertions.logDoesNotContain("Maven Project Inspector");
        dockerAssertions.logContains("Maven Pom Parse");
    }
}
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 8 with DetectDockerTestRunner

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

the class Dotnet5Test method detectUsesDotnet5.

@Test
void detectUsesDotnet5() throws IOException {
    try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-dotnet-five", "detect-dotnet-five:1.0.1")) {
        test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Dotnet5.dockerfile"));
        DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
        commandBuilder.property(DetectProperties.DETECT_TOOLS, "DETECTOR");
        commandBuilder.property(DetectProperties.BLACKDUCK_OFFLINE_MODE, "true");
        DockerAssertions dockerAssertions = test.run(commandBuilder);
        dockerAssertions.successfulDetectorType("NUGET");
        dockerAssertions.atLeastOneBdioFile();
        // Verify we are using the EXTERNAL artifactory to download the inspector.
        dockerAssertions.logContainsPattern("https://sig-repo.synopsys.com/.*bds-integrations-release/com/synopsys/integration/detect-nuget-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 9 with DetectDockerTestRunner

use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner 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 10 with DetectDockerTestRunner

use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner 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)

Aggregations

DetectCommandBuilder (com.synopsys.integration.detect.battery.docker.util.DetectCommandBuilder)17 DetectDockerTestRunner (com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner)17 DockerAssertions (com.synopsys.integration.detect.battery.docker.util.DockerAssertions)15 Test (org.junit.jupiter.api.Test)15 SharedDockerTestRunner (com.synopsys.integration.detect.battery.docker.util.SharedDockerTestRunner)2 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