use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxLegacyService method createTeam.
void createTeam(String sessionId, String parentId, String teamName) throws CheckmarxException {
CreateNewTeam request = new CreateNewTeam(sessionId);
request.setNewTeamName(teamName);
request.setParentTeamID(parentId);
log.info("Creating team {} ({})", teamName, parentId);
// If shards are enabled then fetch the current shard info for override.
WebServiceTemplate wsInstance = ws;
if (properties.getEnableShardManager()) {
ShardSession shard = sessionTracker.getShardSession();
wsInstance = shard.getShardWs();
}
try {
CreateNewTeamResponse response = (CreateNewTeamResponse) wsInstance.marshalSendAndReceive(wsInstance.getDefaultUri(), request, new SoapActionCallback(CX_WS_CREATE_TEAM_URI));
if (!response.getCreateNewTeamResult().isIsSuccesfull()) {
log.error("Error occurred while creating Team {} with parentId {}", teamName, parentId);
throw new CheckmarxException("Error occurred during team creation");
}
} catch (NullPointerException e) {
log.error("Error occurred while creating Team {} with parentId {}", teamName, parentId);
throw new CheckmarxException("Error occurred during team creation");
}
}
use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxServiceIT method createScan.
@Test
public void createScan() {
log.info("Creating scan");
login();
try {
CxScanParams params = new CxScanParams().withSourceType(CxScanParams.Type.GIT).withGitUrl("https://github.com/Custodela/Riches.git").withBranch("refs/heads/master").withProjectName("CxSBSDK-IT");
// .withProjectName("Riches");
// String teamId = service.getTeamId(properties.getTeam());
Integer id = service.createScan(params, "Automated Comment");
assertNotNull(id);
assertTrue(id > 0);
} 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 getProject.
@Test
public void getProject() {
try {
String teamId = service.getTeamId(properties.getTeam());
Integer projectId = service.getProjectId(teamId, "Riches");
CxProject project = service.getProject(projectId);
assertNotNull(project);
assertNotEquals(Integer.valueOf(-1), project.getId());
} 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 getLastScanDate.
@Test
public void getLastScanDate() {
try {
String teamId = service.getTeamId(properties.getTeam());
Integer projectId = service.getProjectId(teamId, "Riches");
LocalDateTime dateTime = service.getLastScanDate(projectId);
assertNotNull(dateTime);
} 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 GoScanner method getScanStatusById.
public ScanStatus getScanStatusById(Integer scanId) throws CheckmarxException {
HttpEntity<?> httpEntity = new HttpEntity<>(authClient.createAuthHeaders());
try {
log.debug("Retrieving ScanStatus for Scan Id {}", scanId);
ResponseEntity<ScanStatus> response = restTemplate.exchange(cxGoProperties.getUrl().concat(SCAN_STATUS), HttpMethod.GET, httpEntity, ScanStatus.class, scanId);
return response.getBody();
} catch (HttpStatusCodeException e) {
log.error("Error occurred while retrieving the scan status for id {}.", scanId);
log.error(ExceptionUtils.getStackTrace(e));
throw new CheckmarxException("Error occurred while retrieving the scan status for id ".concat(Integer.toString(scanId)));
}
}
Aggregations