use of com.synopsys.integration.common.util.finder.FileFinder in project synopsys-detect by blackducksoftware.
the class NugetProjectDetectableTest method testApplicableForRproj.
@Test
public void testApplicableForRproj() {
NugetInspectorOptions nugetInspectorOptions = null;
NugetInspectorResolver nugetInspectorResolver = null;
NugetInspectorExtractor nugetInspectorExtractor = null;
DetectableEnvironment environment = MockDetectableEnvironment.empty();
FileFinder fileFinder = MockFileFinder.withFileNamed("example.rproj");
NugetProjectDetectable detectable = new NugetProjectDetectable(environment, fileFinder, nugetInspectorOptions, nugetInspectorResolver, nugetInspectorExtractor);
assertTrue(detectable.applicable().getPassed());
}
use of com.synopsys.integration.common.util.finder.FileFinder in project synopsys-detect by blackducksoftware.
the class NugetSolutionDetectableTest method notApplicableForPodfile.
@Test
public void notApplicableForPodfile() {
NugetInspectorResolver nugetInspectorManager = null;
NugetInspectorExtractor nugetInspectorExtractor = null;
NugetInspectorOptions nugetInspectorOptions = null;
DetectableEnvironment environment = MockDetectableEnvironment.empty();
FileFinder fileFinder = MockFileFinder.withFileNamed("podfile.lock");
NugetSolutionDetectable detectable = new NugetSolutionDetectable(environment, fileFinder, nugetInspectorManager, nugetInspectorExtractor, nugetInspectorOptions);
assertFalse(detectable.applicable().getPassed());
}
use of com.synopsys.integration.common.util.finder.FileFinder 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());
}
use of com.synopsys.integration.common.util.finder.FileFinder 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());
}
use of com.synopsys.integration.common.util.finder.FileFinder in project synopsys-detect by blackducksoftware.
the class DockerExtractorTest method testGetImageIdentifierFromOutputDirectoryIfImageIdPresent.
@Test
@DisabledOnOs(WINDOWS)
public void testGetImageIdentifierFromOutputDirectoryIfImageIdPresent() throws URISyntaxException {
String testString = "test";
String imageIdArgument = "--docker.image.id=";
String imageName = "ubuntu:latest";
File outputDirectoryWithPopulatedResultsFile = new File(DockerExtractorTest.class.getClassLoader().getSystemResource("detectables/functional/docker/unit/outputDirectoryWithPopulatedResultsFile").toURI());
File outputDirectoryWithNonPopulatedResultsFile = new File(DockerExtractorTest.class.getClassLoader().getSystemResource("detectables/functional/docker/unit/outputDirectoryWithNonPopulatedResultsFile").toURI());
DetectableExecutableRunner executableRunner = Mockito.mock(DetectableExecutableRunner.class);
FileFinder fileFinder = Mockito.mock(FileFinder.class);
Mockito.when(fileFinder.findFile(outputDirectoryWithPopulatedResultsFile, DockerExtractor.RESULTS_FILENAME_PATTERN)).thenReturn(new File(outputDirectoryWithPopulatedResultsFile, "results.json"));
Mockito.when(fileFinder.findFile(outputDirectoryWithNonPopulatedResultsFile, DockerExtractor.RESULTS_FILENAME_PATTERN)).thenReturn(new File(outputDirectoryWithNonPopulatedResultsFile, "results.json"));
DockerExtractor dockerExtractor = getMockDockerExtractor(executableRunner, fileFinder);
assertEquals(imageName, dockerExtractor.getImageIdentifierFromOutputDirectoryIfImageIdPresent(outputDirectoryWithPopulatedResultsFile, testString, ImageIdentifierType.IMAGE_ID));
assertEquals(testString, dockerExtractor.getImageIdentifierFromOutputDirectoryIfImageIdPresent(outputDirectoryWithPopulatedResultsFile, testString, ImageIdentifierType.IMAGE_NAME));
assertEquals(testString, dockerExtractor.getImageIdentifierFromOutputDirectoryIfImageIdPresent(outputDirectoryWithNonPopulatedResultsFile, testString, ImageIdentifierType.IMAGE_ID));
}
Aggregations