use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxService method getReportContentByScanId.
/**
* Retrieve the report by reportId, mapped to ScanResults DTO, applying filtering as requested
*/
public ScanResults getReportContentByScanId(Integer scanId, FilterConfiguration filter) throws CheckmarxException {
Integer reportId = createScanReport(scanId);
try {
waitForReportCreateOrFail(reportId);
Thread.sleep(1000);
} catch (InterruptedException e) {
log.error(ExceptionUtils.getStackTrace(e));
Thread.currentThread().interrupt();
throw new CheckmarxException(INTERRUPTED_EXCEPTION_MESSAGE);
}
return getReportContent(reportId, filter);
}
use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxService method getLatestScanResults.
/**
* Get the latest scan results by teamName and projectName with filtered results
*
* @param teamName
* @param projectName
* @param filters
* @return
* @throws CheckmarxException
*/
@Override
public ScanResults getLatestScanResults(String teamName, String projectName, FilterConfiguration filters) throws CheckmarxException {
String teamId = getTeamId(teamName);
Integer projectId = getProjectId(teamId, projectName);
Integer scanId = getLastScanId(projectId);
try {
Integer reportId = createScanReport(scanId);
waitForReportCreateOrFail(reportId);
Thread.sleep(cxProperties.getScanPolling());
return getReportContent(reportId, filters);
} catch (InterruptedException e) {
log.error(ExceptionUtils.getStackTrace(e));
Thread.currentThread().interrupt();
throw new CheckmarxException(INTERRUPTED_EXCEPTION_MESSAGE);
}
}
use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxServiceIT method getReportContent.
@Test
public void getReportContent() {
try {
List<Filter> filters = new ArrayList<>();
filters.add(new Filter(Filter.Type.SEVERITY, "High"));
FilterConfiguration filterConfiguration = FilterConfiguration.fromSimpleFilters(filters);
ScanResults results = service.getLatestScanResults(properties.getTeam(), "Riches", filterConfiguration);
assertNotNull(results);
} catch (CheckmarxException e) {
fail("Unexpected CheckmarxException");
}
}
use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxServiceIT method getScanSummary.
@Test
public void getScanSummary() {
try {
String teamId = service.getTeamId(properties.getTeam());
Integer projectId = service.getProjectId(teamId, "Riches");
CxScanSummary summary = service.getScanSummary(projectId);
assertNotNull(summary);
assertNotNull(summary.getStatisticsCalculationDate());
} catch (CheckmarxException e) {
fail("Unexpected CheckmarxException");
}
}
use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxServiceIT method getXmlReportContent.
@Test
public void getXmlReportContent() {
try {
CxXMLResultsType results = service.getLatestScanReport(properties.getTeam(), "Riches");
assertNotNull(results);
} catch (CheckmarxException e) {
fail("Unexpected CheckmarxException");
}
}
Aggregations