use of com.synopsys.integration.log.BufferedIntLogger in project synopsys-detect by blackducksoftware.
the class RapidScanResultAggregatorTest method testEmptyResults.
@Test
public void testEmptyResults() {
List<DeveloperScanComponentResultView> results = Collections.emptyList();
RapidScanResultAggregator aggregator = new RapidScanResultAggregator();
RapidScanAggregateResult aggregateResult = aggregator.aggregateData(results);
BufferedIntLogger logger = new BufferedIntLogger();
aggregateResult.logResult(logger);
RapidScanResultSummary summary = aggregateResult.getSummary();
assertEquals(0, summary.getPolicyErrorCount());
assertEquals(0, summary.getPolicyWarningCount());
assertEquals(0, summary.getSecurityErrorCount());
assertEquals(0, summary.getSecurityWarningCount());
assertEquals(0, summary.getLicenseErrorCount());
assertEquals(0, summary.getLicenseWarningCount());
assertFalse(logger.getOutputList(LogLevel.INFO).isEmpty());
}
use of com.synopsys.integration.log.BufferedIntLogger in project synopsys-detect by blackducksoftware.
the class BlackDuckTestConnection method fromEnvironment.
public static BlackDuckTestConnection fromEnvironment() {
Assertions.assertTrue(System.getenv().containsKey(BLACKDUCK_URL), "Integration tests require BLACKDUCK_URL is set in the environment");
Assertions.assertTrue(System.getenv().containsKey(BLACKDUCK_API_TOKEN), "Integration tests require BLACKDUCK_API_TOKEN is set in the environment");
String blackduckUrl = System.getenv().get(BLACKDUCK_URL);
String blackduckApiToken = System.getenv().get(BLACKDUCK_API_TOKEN);
BlackDuckServerConfigBuilder blackDuckServerConfigBuilder = BlackDuckServerConfig.newApiTokenBuilder();
blackDuckServerConfigBuilder.setProperties(System.getenv().entrySet());
blackDuckServerConfigBuilder.setUrl(blackduckUrl);
blackDuckServerConfigBuilder.setApiToken(blackduckApiToken);
blackDuckServerConfigBuilder.setTrustCert(trustCert);
blackDuckServerConfigBuilder.setTimeoutInSeconds(5 * 60);
BlackDuckServicesFactory blackDuckServicesFactory = blackDuckServerConfigBuilder.build().createBlackDuckServicesFactory(new BufferedIntLogger());
return new BlackDuckTestConnection(blackduckUrl, blackduckApiToken, blackDuckServicesFactory);
}
use of com.synopsys.integration.log.BufferedIntLogger in project synopsys-detect by blackducksoftware.
the class BlackDuckTestConnection method createReportService.
public ReportService createReportService() {
HttpUrl blackDuckUrl = blackDuckServicesFactory.getBlackDuckHttpClient().getBlackDuckUrl();
IntegrationEscapeUtil integrationEscapeUtil = blackDuckServicesFactory.createIntegrationEscapeUtil();
long reportServiceTimeout = 120 * 1000;
return new ReportService(blackDuckServicesFactory.getGson(), blackDuckUrl, blackDuckServicesFactory.getBlackDuckApiClient(), blackDuckServicesFactory.getApiDiscovery(), new BufferedIntLogger(), integrationEscapeUtil, reportServiceTimeout);
}
use of com.synopsys.integration.log.BufferedIntLogger in project synopsys-detect by blackducksoftware.
the class RapidScanResultAggregatorTest method testResults.
@Test
public void testResults() {
List<DeveloperScanComponentResultView> results = createResultList();
RapidScanResultAggregator aggregator = new RapidScanResultAggregator();
RapidScanAggregateResult aggregateResult = aggregator.aggregateData(results);
BufferedIntLogger logger = new BufferedIntLogger();
aggregateResult.logResult(logger);
RapidScanResultSummary summary = aggregateResult.getSummary();
assertEquals(1, summary.getPolicyErrorCount());
assertEquals(1, summary.getPolicyWarningCount());
assertEquals(1, summary.getSecurityErrorCount());
assertEquals(1, summary.getSecurityWarningCount());
assertEquals(1, summary.getLicenseErrorCount());
assertEquals(1, summary.getLicenseWarningCount());
assertFalse(logger.getOutputList(LogLevel.INFO).isEmpty());
}
use of com.synopsys.integration.log.BufferedIntLogger 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"));
}
Aggregations