use of com.synopsys.integration.detectable.detectable.result.DetectableResult in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method testExtractionFailed.
@Test
public void testExtractionFailed() throws DetectableException, ExecutableFailedException {
Extraction extraction = createFailExtraction();
DetectableResult extractionResult = new PassedDetectableResult();
String projectBomTool = DetectorType.GO_MOD.name();
DetectorToolResult result = executeToolTest(extraction, extractionResult, projectBomTool);
assertFalse(result.getApplicableDetectorTypes().isEmpty());
assertTrue(result.getBomToolCodeLocations().isEmpty());
assertFalse(result.getBomToolProjectNameVersion().isPresent());
assertTrue(result.getCodeLocationMap().isEmpty());
assertTrue(result.getFailedDetectorTypes().isEmpty());
assertTrue(result.getRootDetectorEvaluationTree().isPresent());
}
use of com.synopsys.integration.detectable.detectable.result.DetectableResult in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method testSuccess.
@Test
public void testSuccess() throws DetectableException, ExecutableFailedException {
Extraction extraction = createSuccessExtraction();
DetectableResult extractionResult = new PassedDetectableResult();
String projectBomTool = DetectorType.GO_MOD.name();
DetectorToolResult result = executeToolTest(extraction, extractionResult, projectBomTool);
assertFalse(result.getApplicableDetectorTypes().isEmpty());
assertTrue(result.getBomToolCodeLocations().isEmpty());
assertTrue(result.getBomToolProjectNameVersion().isPresent());
assertTrue(result.getCodeLocationMap().isEmpty());
assertTrue(result.getFailedDetectorTypes().isEmpty());
assertTrue(result.getRootDetectorEvaluationTree().isPresent());
}
use of com.synopsys.integration.detectable.detectable.result.DetectableResult in project synopsys-detect by blackducksoftware.
the class DetectableFunctionalTest method run.
@Test
public void run() throws IOException, DetectableException, ExecutableFailedException, MissingExternalIdException, CycleDetectedException, ExecutableRunnerException, ParserConfigurationException, SAXException {
System.out.println(String.format("Function Test (%s) is using temp directory: %s", name, tempDirectory.toAbsolutePath().toString()));
setup();
DetectableEnvironment detectableEnvironment = new DetectableEnvironment(sourceDirectory.toFile());
Detectable detectable = create(detectableEnvironment);
DetectableResult applicable = detectable.applicable();
Assertions.assertTrue(applicable.getPassed(), String.format("Applicable should have passed but was: %s", applicable.toDescription()));
DetectableResult extractable = detectable.extractable();
Assertions.assertTrue(extractable.getPassed(), String.format("Extractable should have passed but was: %s", extractable.toDescription()));
ExtractionEnvironment extractionEnvironment = new ExtractionEnvironment(outputDirectory.toFile());
Extraction extraction = detectable.extract(extractionEnvironment);
Assertions.assertNotNull(extraction, "Detectable did not return an extraction!");
assertExtraction(extraction);
FileUtils.deleteDirectory(tempDirectory.toFile());
}
use of com.synopsys.integration.detectable.detectable.result.DetectableResult 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);
}
Aggregations