use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.
the class ThresholdsSteps method createScanRequest.
private ScanRequest createScanRequest(boolean isGitHub) {
ScanRequest scanRequest = new ScanRequest();
BugTracker.Type issueTruckerType;
Map<String, String> additionalMetadata = new HashMap<>();
additionalMetadata.put(STATUSES_URL_KEY, PULL_REQUEST_STATUSES_URL);
if (isGitHub) {
issueTruckerType = BugTracker.Type.GITHUBPULL;
scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
scanRequest.setRepoType(ScanRequest.Repository.GITHUB);
} else {
issueTruckerType = BugTracker.Type.ADOPULL;
additionalMetadata.put("status_id", Integer.toString(1));
additionalMetadata.put("ado_thread_id", Integer.toString(0));
scanRequest.setRepoType(ScanRequest.Repository.ADO);
scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
scanResultsToInject.setProjectId(Integer.toString(0));
}
BugTracker issueTracker = BugTracker.builder().type(issueTruckerType).build();
scanRequest.setBugTracker(issueTracker);
scanRequest.setProduct(ScanRequest.Product.CX);
scanRequest.setAdditionalMetadata(additionalMetadata);
return scanRequest;
}
use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.
the class ThresholdsSteps method processScanResultsInCxFlow.
private void processScanResultsInCxFlow(boolean isGitHub) {
try {
ScanRequest scanRequest = createScanRequest(isGitHub);
CompletableFuture<ScanResults> task = resultsService.processScanResultsAsync(scanRequest, 0, 0, null, null);
task.get(1, TimeUnit.MINUTES);
} catch (MachinaException | InterruptedException | ExecutionException | TimeoutException e) {
String message = "Error processing scan results.";
log.error(message, e);
Assert.fail(message);
Thread.currentThread().interrupt();
}
}
use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.
the class CxConfigBugTrackerSteps method sendPullRequestWebhookEvent.
@When("pull request webhook arrives")
public void sendPullRequestWebhookEvent() {
assertFlowPropertiesBugTracker("Json");
ArgumentCaptor<ScanRequest> ac = ArgumentCaptor.forClass(ScanRequest.class);
FlowService flowServiceMock = Mockito.mock(FlowService.class);
gitHubControllerSpy = new GitHubController(gitHubProperties, flowProperties, jiraProperties, flowServiceMock, helperService, gitHubService, gitHubAppAuthService, filterFactory, configOverrider, scmConfigOverrider, gitAuthUrlGenerator);
gitHubControllerSpy = spy(gitHubControllerSpy);
initGitHubControllerSpy();
buildPullRequest();
verify(flowServiceMock, times(1)).initiateAutomation(ac.capture());
request = ac.getValue();
}
use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.
the class AstRemoteRepoScanSteps method getBasicScanRequest.
private ScanRequest getBasicScanRequest(String branch, String gitUrl, boolean isPublicRepo, String projectName) {
String gitAuthUrl;
if (isPublicRepo) {
gitAuthUrl = gitUrl;
} else {
gitAuthUrl = gitAuthUrlGenerator.addCredToUrl(ScanRequest.Repository.GITHUB, gitUrl, gitHubProperties.getToken());
}
ScanRequest result = ScanRequest.builder().project(projectName).repoUrlWithAuth(gitAuthUrl).branch(branch).repoType(ScanRequest.Repository.GITHUB).build();
scaConfigOverrider.initScaConfig(result);
return result;
}
use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.
the class IastCliSteps method runningIastService.
@SneakyThrows
@When("running iast service {}")
public void runningIastService(String scanTag) {
scanTag = removeQuotes(scanTag);
try {
BugTracker.Type bugType = BugTracker.Type.GITHUBCOMMIT;
String assignee = "test_user";
BugTracker bt = BugTracker.builder().type(bugType).assignee(assignee).build();
ScanRequest request = ScanRequest.builder().bugTracker(bt).build();
iastService.stopScanAndCreateIssue(request, scanTag);
} catch (IastThresholdsSeverityException e) {
// that is ok. Just Thresholds Severity
}
}
Aggregations