use of com.checkmarx.sdk.config.RestClientConfig in project cx-flow by checkmarx-ltd.
the class SCAScanner method cxParseResults.
@Override
protected void cxParseResults(ScanRequest scanRequest, File file) throws ExitThrowable {
RestClientConfig restClientConfig;
IScanClientHelper iScanClientHelper;
try {
ScanParams sdkScanParams = ScanParams.builder().projectName(scanRequest.getProject()).scaConfig(scanRequest.getScaConfig()).filterConfiguration(scanRequest.getFilter()).build();
restClientConfig = scaScannerClient.getScanConfig(sdkScanParams);
iScanClientHelper = new ScaClientHelper(restClientConfig, log, scaProperties);
ScanResults results = iScanClientHelper.getReportContent(file, scanRequest.getFilter());
resultsService.processResults(scanRequest, results, scanDetails);
if (flowProperties.isBreakBuild() && results != null && results.getXIssues() != null && !results.getXIssues().isEmpty()) {
log.error(ERROR_BREAK_MSG);
exit(ExitCode.BUILD_INTERRUPTED);
}
} catch (MachinaException | CheckmarxException e) {
log.error("Error occurred while processing results file", e);
exit(3);
}
}
use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class ClientTypeResolverTest method checkThatExceptionIsThrown.
private static void checkThatExceptionIsThrown(String url) {
ClientTypeResolver resolver = new ClientTypeResolver(new RestClientConfig());
try {
resolver.determineClientType(url);
Assert.fail("Expected exception, but didn't get any.");
} catch (Exception e) {
Assert.assertTrue("Unexpected exception type.", e instanceof ScannerRuntimeException);
Assert.assertTrue("Exception message is empty.", StringUtils.isNotEmpty(e.getMessage()));
log.info("Got an expected exception");
}
}
use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class ScaTest method initScaConfig.
protected RestClientConfig initScaConfig(String repoUrlProp, boolean useOnPremAuthentication) throws MalformedURLException {
RestClientConfig config = initScaConfig(useOnPremAuthentication);
config.getScaConfig().setSourceLocationType(SourceLocationType.REMOTE_REPOSITORY);
RemoteRepositoryInfo repoInfo = new RemoteRepositoryInfo();
URL repoUrl = new URL(repoUrlProp);
repoInfo.setUrl(repoUrl);
repoInfo.setUsername(githubProperties.getToken());
config.getScaConfig().setRemoteRepositoryInfo(repoInfo);
return config;
}
use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class ScaTest method testMissingResultsCase.
/**
* Make sure that SCA results are null in different expected cases.
*/
private void testMissingResultsCase(String projectName) {
log.info("Checking that scaResults are null for the {} project", projectName);
RestClientConfig config = initScaConfig(false);
config.setProjectName(projectName);
AstScaResults latestResults = getLatestResults(config);
Assert.assertNotNull("scanResults must not be null.", latestResults);
Assert.assertNull("scaResults must be null.", latestResults.getScaResults());
}
use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class ScaTest method getLatestScanResults_existingResults.
@Test
public void getLatestScanResults_existingResults() {
RestClientConfig config = initScaConfig(false);
AstScaResults latestResults = getLatestResults(config);
verifyScanResults(latestResults);
}
Aggregations