use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.
the class NugetSolutionDetectableTest method testApplicableForSolution.
@Test
public void testApplicableForSolution() {
NugetInspectorResolver nugetInspectorManager = null;
NugetInspectorExtractor nugetInspectorExtractor = null;
NugetInspectorOptions nugetInspectorOptions = null;
DetectableEnvironment environment = MockDetectableEnvironment.empty();
FileFinder fileFinder = MockFileFinder.withFileNamed("test.sln");
NugetSolutionDetectable detectable = new NugetSolutionDetectable(environment, fileFinder, nugetInspectorManager, nugetInspectorExtractor, nugetInspectorOptions);
assertTrue(detectable.applicable().getPassed());
}
use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.
the class ComposerLockDetectableTest method testApplicable.
@Test
public void testApplicable() {
ComposerLockExtractor composerLockExtractor = null;
DetectableEnvironment environment = MockDetectableEnvironment.empty();
FileFinder fileFinder = MockFileFinder.withFilesNamed("composer.lock", "composer.json");
ComposerLockDetectable detectable = new ComposerLockDetectable(environment, fileFinder, composerLockExtractor);
assertTrue(detectable.applicable().getPassed());
}
use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.
the class GemspecParseDetectableTest method testApplicable.
@Test
public void testApplicable() {
GemspecParseExtractor gemspecParseExtractor = null;
GemspecParseDetectableOptions gemspecParseDetectableOptions = null;
DetectableEnvironment environment = MockDetectableEnvironment.empty();
FileFinder fileFinder = MockFileFinder.withFileNamed("test.gemspec");
GemspecParseDetectable detectable = new GemspecParseDetectable(environment, fileFinder, gemspecParseExtractor);
assertTrue(detectable.applicable().getPassed());
}
use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.
the class DetectableTool method initializeAndCheckForApplicable.
public boolean initializeAndCheckForApplicable(File sourcePath) {
// TODO: Move docker/bazel out of detectable and drop this notion of a detctable tool. Will simplify this logic and make this unneccessary.
logger.trace("Starting a detectable tool.");
this.sourcePath = sourcePath;
DetectableEnvironment detectableEnvironment = new DetectableEnvironment(sourcePath);
detectable = detectableCreatable.createDetectable(detectableEnvironment);
DetectableResult applicable = detectable.applicable();
if (!applicable.getPassed()) {
logger.debug("Was not applicable.");
return false;
}
logger.debug("Applicable passed.");
return true;
}
use of com.synopsys.integration.detectable.DetectableEnvironment in project synopsys-detect by blackducksoftware.
the class FormattedOutputManagerTest method detectorOutputStatusDataTest.
@Test
public <T extends Detectable> void detectorOutputStatusDataTest() throws IllegalAccessException {
EventSystem eventSystem = new EventSystem();
FormattedOutputManager formattedOutputManager = new FormattedOutputManager(eventSystem);
DetectorRule rule = Mockito.mock(DetectorRule.class);
Mockito.when(rule.getDescriptiveName()).thenReturn("");
Mockito.when(rule.getName()).thenReturn("");
Mockito.when(rule.getDetectorType()).thenReturn(DetectorType.GO_MOD);
DetectorEvaluation detectorEvaluation = new DetectorEvaluation(rule);
ExecutableNotFoundDetectableResult result = new ExecutableNotFoundDetectableResult("go");
DetectorResult extractableResult = new DetectorResult(result.getPassed(), result.toDescription(), result.getClass(), Collections.emptyList(), Collections.emptyList());
detectorEvaluation.setExtractable(extractableResult);
detectorEvaluation.setApplicable(new DetectorResult(true, "", Collections.emptyList(), Collections.emptyList()));
detectorEvaluation.setSearchable(new DetectorResult(true, "", Collections.emptyList(), Collections.emptyList()));
detectorEvaluation.setDetectableEnvironment(new DetectableEnvironment(new File("")));
DetectorToolResult detectorToolResult = new DetectorToolResult(null, null, null, new HashSet<>(), new DetectorEvaluationTree(null, 0, null, Collections.singletonList(detectorEvaluation), new HashSet<>()), null);
eventSystem.publishEvent(Event.DetectorsComplete, detectorToolResult);
DetectInfo detectInfo = new DetectInfo("", null, "");
FormattedOutput formattedOutput = formattedOutputManager.createFormattedOutput(detectInfo);
FormattedDetectorOutput detectorOutput = formattedOutput.detectors.get(0);
Assertions.assertEquals("FAILURE", detectorOutput.status);
Assertions.assertEquals(DetectorStatusCode.EXECUTABLE_NOT_FOUND, detectorOutput.statusCode);
Assertions.assertEquals("No go executable was found.", detectorOutput.statusReason);
}
Aggregations