Search in sources :

Example 6 with RestClientConfig

use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ScaTest method scan_localDirUpload.

@Test
public void scan_localDirUpload() throws IOException, ScannerRuntimeException {
    RestClientConfig config = initScaConfig(false);
    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) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with RestClientConfig

use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class AstTest method scan_remotePublicRepo.

@Test
public void scan_remotePublicRepo() throws MalformedURLException {
    RestClientConfig config = getScanConfig();
    AstScanner scanner = getScanner();
    AstScaResults scanResults = scanner.scan(toSdkScanParams(config));
    validateFinalResults(scanResults);
}
Also used : AstScanner(com.checkmarx.sdk.service.scanner.AstScanner) AstScaResults(com.checkmarx.sdk.dto.AstScaResults) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig) Test(org.junit.Test) CommonClientTest(com.checkmarx.sdk.service.CommonClientTest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 8 with RestClientConfig

use of com.checkmarx.sdk.config.RestClientConfig in project cx-flow by checkmarx-ltd.

the class ScaCommonSteps method createRestClientConfig.

protected RestClientConfig createRestClientConfig(ScaProperties scaProperties, String projectName) {
    ScaConfig scaConfig = new ScaConfig();
    scaConfig.setTenant(scaProperties.getTenant());
    scaConfig.setApiUrl(scaProperties.getApiUrl());
    scaConfig.setUsername(scaProperties.getUsername());
    scaConfig.setPassword(scaProperties.getPassword());
    scaConfig.setAccessControlUrl(scaProperties.getAccessControlUrl());
    scaConfig.setRemoteRepositoryInfo(new RemoteRepositoryInfo());
    RestClientConfig restClientConfig = new RestClientConfig();
    restClientConfig.setScaConfig(scaConfig);
    restClientConfig.setProjectName(projectName);
    return restClientConfig;
}
Also used : RemoteRepositoryInfo(com.checkmarx.sdk.dto.RemoteRepositoryInfo) ScaConfig(com.checkmarx.sdk.dto.sca.ScaConfig) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig)

Example 9 with RestClientConfig

use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class AbstractScanner method scanWithNoWaitingToResults.

public void scanWithNoWaitingToResults(ScanParams scanParams) {
    validateScanParams(scanParams);
    RestClientConfig scanConfig = getScanConfig(scanParams);
    try {
        this.client = allocateClient(scanConfig);
        client.init();
        client.initiateScan();
    } finally {
        client.close();
    }
}
Also used : RestClientConfig(com.checkmarx.sdk.config.RestClientConfig)

Example 10 with RestClientConfig

use of com.checkmarx.sdk.config.RestClientConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class AbstractScanner method scan.

public AstScaResults scan(ScanParams scanParams) {
    validateScanParams(scanParams);
    RestClientConfig scanConfig = getScanConfig(scanParams);
    scanConfig.setProgressInterval(SCA_SCAN_INTERVAL_IN_SECONDS);
    ResultsBase scanResults = executeScan(scanConfig);
    AstScaResults results = toResults(scanResults);
    applyFilterToResults(results, scanParams);
    return results;
}
Also used : RestClientConfig(com.checkmarx.sdk.config.RestClientConfig)

Aggregations

RestClientConfig (com.checkmarx.sdk.config.RestClientConfig)19 AstScaResults (com.checkmarx.sdk.dto.AstScaResults)5 Test (org.junit.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 RemoteRepositoryInfo (com.checkmarx.sdk.dto.RemoteRepositoryInfo)3 ScaConfig (com.checkmarx.sdk.dto.sca.ScaConfig)3 AstConfig (com.checkmarx.sdk.config.AstConfig)2 ScannerRuntimeException (com.checkmarx.sdk.exception.ScannerRuntimeException)2 ClientTypeResolver (com.checkmarx.sdk.utils.scanner.client.ClientTypeResolver)2 IScanClientHelper (com.checkmarx.sdk.utils.scanner.client.IScanClientHelper)2 URL (java.net.URL)2 MachinaException (com.checkmarx.flow.exception.MachinaException)1 ScanResults (com.checkmarx.sdk.dto.ScanResults)1 ScanParams (com.checkmarx.sdk.dto.ast.ScanParams)1 ClientType (com.checkmarx.sdk.dto.sca.ClientType)1 CheckmarxException (com.checkmarx.sdk.exception.CheckmarxException)1 CommonClientTest (com.checkmarx.sdk.service.CommonClientTest)1 AstScanner (com.checkmarx.sdk.service.scanner.AstScanner)1 ScaClientHelper (com.checkmarx.sdk.utils.scanner.client.ScaClientHelper)1 Path (java.nio.file.Path)1