Search in sources :

Example 16 with DetectableEnvironment

use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.

the class BazelDetectableTest method testApplicable.

@Test
public void testApplicable() {
    DetectableEnvironment environment = MockDetectableEnvironment.empty();
    FileFinder fileFinder = Mockito.mock(FileFinder.class);
    Mockito.when(fileFinder.findFile(new File("."), "WORKSPACE")).thenReturn(new File("src/test/resources/functional/bazel/WORKSPACE"));
    BazelExtractor bazelExtractor = null;
    BazelResolver bazelResolver = null;
    BazelDetectableOptions bazelDetectableOptions = new BazelDetectableOptions("target", null, null);
    BazelDetectable detectable = new BazelDetectable(environment, fileFinder, bazelExtractor, bazelResolver, bazelDetectableOptions.getTargetName().orElse(null));
    assertTrue(detectable.applicable().getPassed());
}
Also used : BazelExtractor(com.synopsys.integration.detectable.detectables.bazel.BazelExtractor) BazelDetectableOptions(com.synopsys.integration.detectable.detectables.bazel.BazelDetectableOptions) BazelDetectable(com.synopsys.integration.detectable.detectables.bazel.BazelDetectable) BazelResolver(com.synopsys.integration.detectable.detectable.executable.resolver.BazelResolver) FileFinder(com.synopsys.integration.common.util.finder.FileFinder) File(java.io.File) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) MockDetectableEnvironment(com.synopsys.integration.detectable.util.MockDetectableEnvironment) Test(org.junit.jupiter.api.Test)

Example 17 with DetectableEnvironment

use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.

the class ClangDetectableTest method testApplicable.

@Test
public void testApplicable() {
    DetectableExecutableRunner executableRunner = null;
    List<ClangPackageManager> availablePackageManagers = new ArrayList<>(0);
    ClangExtractor clangExtractor = null;
    ClangPackageManagerRunner packageManagerRunner = null;
    ClangDetectableOptions options = new ClangDetectableOptions(false);
    DetectableEnvironment environment = MockDetectableEnvironment.empty();
    FileFinder fileFinder = MockFileFinder.withFileNamed(JSON_COMPILATION_DATABASE_FILENAME);
    ClangDetectable detectable = new ClangDetectable(environment, executableRunner, fileFinder, availablePackageManagers, clangExtractor, options, packageManagerRunner);
    assertTrue(detectable.applicable().getPassed());
}
Also used : ClangPackageManager(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManager) ClangExtractor(com.synopsys.integration.detectable.detectables.clang.ClangExtractor) DetectableExecutableRunner(com.synopsys.integration.detectable.detectable.executable.DetectableExecutableRunner) ClangPackageManagerRunner(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerRunner) ClangDetectable(com.synopsys.integration.detectable.detectables.clang.ClangDetectable) ArrayList(java.util.ArrayList) MockFileFinder(com.synopsys.integration.detectable.util.MockFileFinder) FileFinder(com.synopsys.integration.common.util.finder.FileFinder) ClangDetectableOptions(com.synopsys.integration.detectable.detectables.clang.ClangDetectableOptions) MockDetectableEnvironment(com.synopsys.integration.detectable.util.MockDetectableEnvironment) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) Test(org.junit.jupiter.api.Test)

Example 18 with DetectableEnvironment

use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.

the class DockerDetectableTest method testApplicable.

@Test
public void testApplicable() {
    DetectableEnvironment environment = null;
    DockerInspectorResolver dockerInspectorResolver = null;
    JavaResolver javaResolver = null;
    DockerResolver dockerResolver = null;
    DockerExtractor dockerExtractor = null;
    DockerDetectableOptions dockerDetectableOptions = Mockito.mock(DockerDetectableOptions.class);
    Mockito.when(dockerDetectableOptions.hasDockerImageOrTar()).thenReturn(Boolean.TRUE);
    DockerDetectable detectable = new DockerDetectable(environment, dockerInspectorResolver, javaResolver, dockerResolver, dockerExtractor, dockerDetectableOptions);
    DetectableResult result = detectable.applicable();
    assertTrue(result.getPassed() || result instanceof WrongOperatingSystemResult);
}
Also used : JavaResolver(com.synopsys.integration.detectable.detectable.executable.resolver.JavaResolver) WrongOperatingSystemResult(com.synopsys.integration.detectable.detectable.result.WrongOperatingSystemResult) DockerDetectable(com.synopsys.integration.detectable.detectables.docker.DockerDetectable) DetectableResult(com.synopsys.integration.detectable.detectable.result.DetectableResult) DockerExtractor(com.synopsys.integration.detectable.detectables.docker.DockerExtractor) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) DockerInspectorResolver(com.synopsys.integration.detectable.detectables.docker.DockerInspectorResolver) DockerResolver(com.synopsys.integration.detectable.detectable.executable.resolver.DockerResolver) DockerDetectableOptions(com.synopsys.integration.detectable.detectables.docker.DockerDetectableOptions) Test(org.junit.jupiter.api.Test)

Aggregations

DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)18 Test (org.junit.jupiter.api.Test)14 FileFinder (com.synopsys.integration.common.util.finder.FileFinder)11 MockDetectableEnvironment (com.synopsys.integration.detectable.util.MockDetectableEnvironment)9 MockFileFinder (com.synopsys.integration.detectable.util.MockFileFinder)8 File (java.io.File)6 DetectableResult (com.synopsys.integration.detectable.detectable.result.DetectableResult)5 NugetInspectorResolver (com.synopsys.integration.detectable.detectable.inspector.nuget.NugetInspectorResolver)3 NugetInspectorExtractor (com.synopsys.integration.detectable.detectables.nuget.NugetInspectorExtractor)3 NugetInspectorOptions (com.synopsys.integration.detectable.detectables.nuget.NugetInspectorOptions)3 DetectorEvaluation (com.synopsys.integration.detector.base.DetectorEvaluation)3 DetectorEvaluationTree (com.synopsys.integration.detector.base.DetectorEvaluationTree)3 DetectorResult (com.synopsys.integration.detector.result.DetectorResult)3 Detectable (com.synopsys.integration.detectable.Detectable)2 NugetSolutionDetectable (com.synopsys.integration.detectable.detectables.nuget.NugetSolutionDetectable)2 SimpleFileFinder (com.synopsys.integration.common.util.finder.SimpleFileFinder)1 DetectInfo (com.synopsys.integration.detect.configuration.DetectInfo)1 DetectUserFriendlyException (com.synopsys.integration.detect.configuration.DetectUserFriendlyException)1 DetectorToolResult (com.synopsys.integration.detect.tool.detector.DetectorToolResult)1 EventSystem (com.synopsys.integration.detect.workflow.event.EventSystem)1