Search in sources :

Example 6 with AstScaResults

use of com.checkmarx.sdk.dto.AstScaResults in project cx-flow by checkmarx-ltd.

the class AbstractASTScanner method scan.

@Override
public ScanResults scan(ScanRequest scanRequest) {
    ScanResults result = null;
    log.info("--------------------- Initiating new {} scan ---------------------", scanType);
    ScanParams sdkScanParams = toSdkScanParams(scanRequest);
    AstScaResults internalResults = new AstScaResults(new SCAResults(), new ASTResults());
    try {
        bugTrackerEventTrigger.triggerScanStartedEvent(scanRequest);
        internalResults = client.scan(sdkScanParams);
        logRequest(scanRequest, internalResults, OperationResult.successful());
        result = toScanResults(internalResults);
    } catch (Exception e) {
        treatError(scanRequest, internalResults, e);
    }
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) AstScaResults(com.checkmarx.sdk.dto.AstScaResults) ASTResults(com.checkmarx.sdk.dto.ast.ASTResults) SCAResults(com.checkmarx.sdk.dto.sca.SCAResults) MalformedURLException(java.net.MalformedURLException) MachinaRuntimeException(com.checkmarx.flow.exception.MachinaRuntimeException)

Example 7 with AstScaResults

use of com.checkmarx.sdk.dto.AstScaResults in project cx-flow by checkmarx-ltd.

the class AbstractASTScanner method getLatestScanResults.

@Override
public ScanResults getLatestScanResults(ScanRequest request) {
    ScanParams sdkScanParams = ScanParams.builder().projectName(request.getProject()).scaConfig(request.getScaConfig()).filterConfiguration(request.getFilter()).build();
    setScannerSpecificProperties(request, sdkScanParams);
    AstScaResults internalResults = client.getLatestScanResults(sdkScanParams);
    return toScanResults(internalResults);
}
Also used : ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) AstScaResults(com.checkmarx.sdk.dto.AstScaResults)

Example 8 with AstScaResults

use of com.checkmarx.sdk.dto.AstScaResults in project cx-flow by checkmarx-ltd.

the class AbstractASTScanner method actualScan.

private ScanResults actualScan(ScanRequest scanRequest, String path) {
    ScanResults result = null;
    log.info("--------------------- Initiating new {} scan ---------------------", scanType);
    AstScaResults internalResults = new AstScaResults(new SCAResults(), new ASTResults());
    try {
        ScanParams sdkScanParams = toSdkScanParams(scanRequest, path);
        internalResults = client.scan(sdkScanParams);
        logRequest(scanRequest, internalResults, OperationResult.successful());
        result = toScanResults(internalResults);
    } catch (Exception e) {
        treatError(scanRequest, internalResults, e);
    }
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) AstScaResults(com.checkmarx.sdk.dto.AstScaResults) ASTResults(com.checkmarx.sdk.dto.ast.ASTResults) SCAResults(com.checkmarx.sdk.dto.sca.SCAResults) MalformedURLException(java.net.MalformedURLException) MachinaRuntimeException(com.checkmarx.flow.exception.MachinaRuntimeException)

Example 9 with AstScaResults

use of com.checkmarx.sdk.dto.AstScaResults in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ScaTest method runScan.

protected AstScaResults runScan(RestClientConfig config) {
    ScaScanner scanner = getScanner();
    AstScaResults results = scanner.scan(getScanParams(config));
    return results;
}
Also used : ScaScanner(com.checkmarx.sdk.service.scanner.ScaScanner) AstScaResults(com.checkmarx.sdk.dto.AstScaResults)

Example 10 with AstScaResults

use of com.checkmarx.sdk.dto.AstScaResults in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ScaTest method localDirScan.

private void localDirScan(RestClientConfig config) throws MalformedURLException {
    config.getScaConfig().setSourceLocationType(SourceLocationType.LOCAL_DIRECTORY);
    Path sourcesDir = null;
    try {
        sourcesDir = extractTestProjectFromResources();
        config.setSourceDir(sourcesDir.toString());
        AstScaResults scanResults = runScan(config);
        verifyScanResults(scanResults);
    } finally {
        deleteDir(sourcesDir);
    }
}
Also used : Path(java.nio.file.Path) AstScaResults(com.checkmarx.sdk.dto.AstScaResults)

Aggregations

AstScaResults (com.checkmarx.sdk.dto.AstScaResults)11 RestClientConfig (com.checkmarx.sdk.config.RestClientConfig)5 ScanParams (com.checkmarx.sdk.dto.ast.ScanParams)3 SCAResults (com.checkmarx.sdk.dto.sca.SCAResults)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 MachinaRuntimeException (com.checkmarx.flow.exception.MachinaRuntimeException)2 ScanResults (com.checkmarx.sdk.dto.ScanResults)2 ASTResults (com.checkmarx.sdk.dto.ast.ASTResults)2 MalformedURLException (java.net.MalformedURLException)2 Path (java.nio.file.Path)2 CommonClientTest (com.checkmarx.sdk.service.CommonClientTest)1 AstScanner (com.checkmarx.sdk.service.scanner.AstScanner)1 ScaScanner (com.checkmarx.sdk.service.scanner.ScaScanner)1