use of com.blackducksoftware.integration.hub.detect.detector.nuget.NugetInspectorExtractor in project hub-detect by blackducksoftware.
the class NugetSolutionExtractionDebugger method debug.
public void debug(LoggedDetectExtraction extraction, DetectRunInfo detectRunInfo, DetectConfiguration detectConfiguration) {
String id = extraction.extractionIdentifier;
try {
NugetInspectorPackager packager = new NugetInspectorPackager(new Gson(), new ExternalIdFactory());
DetectFileFinder detectFileFinder = new DetectFileFinder();
File extractionFolder = new File(detectRunInfo.getExtractionsFolder(), extraction.extractionIdentifier);
List<File> extractionFiles = Arrays.asList(extractionFolder.listFiles());
DetectFileFinder mock = Mockito.mock(DetectFileFinder.class);
Mockito.when(mock.findFiles(Mockito.any(), Mockito.any())).thenReturn(extractionFiles);
NugetInspectorExtractor nugetInspectorExtractor = new NugetInspectorExtractor(packager, mock, detectConfiguration);
NugetInspector inspector = Mockito.mock(NugetInspector.class);
Mockito.when(inspector.execute(Mockito.any(), Mockito.any())).thenReturn(new ExecutableOutput("", ""));
File mockTarget = Mockito.mock(File.class);
Mockito.when(mockTarget.toString()).thenReturn("mock/target");
File mockOutput = Mockito.mock(File.class);
Mockito.when(mockOutput.getCanonicalPath()).thenReturn("mock/output");
Mockito.when(mockOutput.toString()).thenReturn("mock/output");
Extraction newExtraction = nugetInspectorExtractor.extract(mockTarget, mockOutput, inspector, new ExtractionId(DetectorType.NUGET, id));
logger.info("We did it: " + newExtraction.result.toString());
} catch (Exception e) {
logger.info("We did not do it: " + e.toString());
throw new RuntimeException(e);
}
}
Aggregations