use of com.synopsys.integration.detect.workflow.result.DetectResult in project synopsys-detect by blackducksoftware.
the class DetectStatusLogger method logDetectResults.
private void logDetectResults(IntLogger logger, List<DetectResult> detectResults) {
if (!detectResults.isEmpty()) {
logger.info("======== Detect Result ========");
logger.info("");
for (DetectResult detectResult : detectResults) {
logger.info(detectResult.getResultMessage());
if (!detectResult.getResultSubMessages().isEmpty()) {
detectResult.getResultSubMessages().forEach(subMessage -> logger.info(String.format("\t%s", subMessage)));
}
}
logger.info("");
}
}
use of com.synopsys.integration.detect.workflow.result.DetectResult in project synopsys-detect by blackducksoftware.
the class DetectStatusLoggerTest method createResults.
private List<DetectResult> createResults() {
ArrayList<DetectResult> detectResults = new ArrayList<>();
DetectResult result = new BlackDuckBomDetectResult("https://example.com/api/projects/project_1");
detectResults.add(result);
result = new BlackDuckBomDetectResult("https://example.com/api/projects/project_2");
detectResults.add(result);
result = new AirGapDetectResult("./air_gap/directory");
detectResults.add(result);
result = new ReportDetectResult("report_1", "./report/1/report_file");
detectResults.add(result);
return detectResults;
}
use of com.synopsys.integration.detect.workflow.result.DetectResult in project synopsys-detect by blackducksoftware.
the class IntelligentModeStepRunner method publishPostResults.
private void publishPostResults(BdioResult bdioResult, ProjectVersionWrapper projectVersionWrapper, DetectToolFilter detectToolFilter) {
if ((!bdioResult.getUploadTargets().isEmpty() || detectToolFilter.shouldInclude(DetectTool.SIGNATURE_SCAN))) {
Optional<String> componentsLink = Optional.ofNullable(projectVersionWrapper).map(ProjectVersionWrapper::getProjectVersionView).flatMap(projectVersionView -> projectVersionView.getFirstLinkSafely(ProjectVersionView.COMPONENTS_LINK)).map(HttpUrl::string);
if (componentsLink.isPresent()) {
DetectResult detectResult = new BlackDuckBomDetectResult(componentsLink.get());
operationFactory.publishResult(detectResult);
}
}
}
use of com.synopsys.integration.detect.workflow.result.DetectResult in project synopsys-detect by blackducksoftware.
the class DetectStatusLoggerTest method testContent.
@Test
public void testContent() throws IOException {
File expectedOutputFile = new File("src/test/resources/workflow/status/expectedStatusLoggerOutput.txt");
String expectedOutput = FileUtils.readFileToString(expectedOutputFile, StandardCharsets.UTF_8);
BufferedIntLogger loggerActual = new BufferedIntLogger();
DetectStatusLogger statusLogger = new DetectStatusLogger();
List<Status> statusSummaries = createStatus();
List<DetectResult> detectResults = createResults();
List<DetectIssue> detectIssues = createIssues();
List<Operation> detectOperations = createOperations();
statusLogger.logDetectStatus(loggerActual, statusSummaries, detectResults, detectIssues, detectOperations, ExitCodeType.SUCCESS);
String actualOutput = loggerActual.getOutputString(LogLevel.INFO);
assertEquals(expectedOutput.trim().replaceAll("\r?\n", "\n"), actualOutput.trim().replaceAll("\r?\n", "\n"));
}
use of com.synopsys.integration.detect.workflow.result.DetectResult in project synopsys-detect by blackducksoftware.
the class DetectStatusLoggerTest method testDebugContent.
@Test
public void testDebugContent() throws IOException {
File expectedOutputFile = new File("src/test/resources/workflow/status/expectedDebugStatusLoggerOutput.txt");
String expectedOutput = FileUtils.readFileToString(expectedOutputFile, StandardCharsets.UTF_8);
BufferedIntLogger loggerActual = new BufferedIntLogger();
DetectStatusLogger statusLogger = new DetectStatusLogger();
List<Status> statusSummaries = createStatus();
List<DetectResult> detectResults = createResults();
List<DetectIssue> detectIssues = createIssues();
List<Operation> detectOperations = createOperations();
statusLogger.logDetectStatus(loggerActual, statusSummaries, detectResults, detectIssues, detectOperations, ExitCodeType.SUCCESS);
String actualOutput = loggerActual.getOutputString(LogLevel.DEBUG);
assertEquals(expectedOutput.trim().replaceAll("\r?\n", "\n"), actualOutput.trim().replaceAll("\r?\n", "\n"));
}
Aggregations