use of com.synopsys.integration.detect.workflow.file.DirectoryOptions in project synopsys-detect by blackducksoftware.
the class DetectConfigurationFactory method createDirectoryOptions.
public DirectoryOptions createDirectoryOptions() throws IOException {
Path sourcePath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_SOURCE_PATH);
Path outputPath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_OUTPUT_PATH);
Path bdioPath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_BDIO_OUTPUT_PATH);
Path scanPath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_SCAN_OUTPUT_PATH);
Path toolsOutputPath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_TOOLS_OUTPUT_PATH);
Path impactOutputPath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_IMPACT_ANALYSIS_OUTPUT_PATH);
return new DirectoryOptions(sourcePath, outputPath, bdioPath, scanPath, toolsOutputPath, impactOutputPath);
}
use of com.synopsys.integration.detect.workflow.file.DirectoryOptions in project synopsys-detect by blackducksoftware.
the class FontLoaderTestIT method createTempDirectory.
@BeforeEach
public void createTempDirectory() throws Exception {
fontDirectory = Files.createTempDirectory("junit_test_font_loader").toFile();
PropertyConfiguration propertyConfiguration = new PropertyConfiguration(Collections.emptyList());
Gson gson = new Gson();
DetectConfigurationFactory detectConfigurationFactory = new DetectConfigurationFactory(new DetectPropertyConfiguration(propertyConfiguration, new SimplePathResolver()), gson);
ConnectionFactory connectionFactory = new ConnectionFactory(detectConfigurationFactory.createConnectionDetails());
ArtifactResolver artifactResolver = new ArtifactResolver(connectionFactory, gson);
InstalledToolManager installedToolManager = new InstalledToolManager();
InstalledToolLocator installedToolLocator = new InstalledToolLocator(Paths.get(""), new Gson());
DetectFontInstaller installer = new DetectFontInstaller(artifactResolver, installedToolManager, installedToolLocator);
DirectoryOptions directoryOptions = new DirectoryOptions(null, null, null, null, fontDirectory.toPath(), null);
DirectoryManager directoryManager = new DirectoryManager(directoryOptions, DetectRunId.createDefault());
detectFontLocator = new OnlineDetectFontLocator(installer, directoryManager);
}
use of com.synopsys.integration.detect.workflow.file.DirectoryOptions in project synopsys-detect by blackducksoftware.
the class RapidModeGenerateJsonOperationTest method test.
@Test
void test(@TempDir Path tempPath) throws IOException, DetectUserFriendlyException {
Gson gson = Mockito.mock(Gson.class);
File tempDir = tempPath.toFile();
File scanDir = new File(tempDir, "scan");
DirectoryOptions directoryOptions = new DirectoryOptions(null, null, null, scanDir.toPath(), null, null);
DetectRunId detectRunId = new DetectRunId("testId");
DirectoryManager directoryManager = new DirectoryManager(directoryOptions, detectRunId);
RapidModeGenerateJsonOperation op = new RapidModeGenerateJsonOperation(gson, directoryManager);
NameVersion projectNameVersion = new NameVersion("testName", "testVersion");
List<DeveloperScanComponentResultView> results = new LinkedList<>();
DeveloperScanComponentResultView resultView = Mockito.mock(DeveloperScanComponentResultView.class);
results.add(resultView);
String mockedResultsJsonString = "mocked json string for results";
Mockito.when(gson.toJson(results)).thenReturn(mockedResultsJsonString);
File generatedFile = op.generateJsonFile(projectNameVersion, results);
String expectedFilename = String.format("%s_%s_BlackDuck_DeveloperMode_Result.json", projectNameVersion.getName(), projectNameVersion.getVersion());
String expectedPath = new File(scanDir, expectedFilename).getAbsolutePath();
assertEquals(expectedPath, generatedFile.getAbsolutePath());
String generatedString = FileUtils.readFileToString(generatedFile);
assertEquals(mockedResultsJsonString, generatedString);
}
Aggregations