Search in sources :

Example 1 with SecHubClientExecutor

use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor in project sechub by mercedes-benz.

the class WithSecHubClient method getFalsePositiveConfigurationOfProject.

public ProjectFalsePositivesDefinition getFalsePositiveConfigurationOfProject(TestProject project, IntegrationTestJSONLocation location) {
    File sechubConfigFile = IntegrationTestFileSupport.getTestfileSupport().createFileFromResourcePath(location.getPath());
    SecHubClientExecutor executor = createExecutor();
    List<String> list = buildEnvironmentAndBehaviourCommands(project);
    ExecutionResult result = doExecute(ClientAction.GET_FALSE_POSITIVES, sechubConfigFile, executor, list, null);
    if (result.getExitCode() != 0) {
        fail("Not exit code 0 but:" + result.getExitCode() + " , last output line was:" + result.getLastOutputLine());
    }
    File file = result.getJSONFalsePositiveFile();
    String json = TestFileSupport.loadTextFile(file, "\n");
    return asUser.create(project, json);
}
Also used : SecHubClientExecutor(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) File(java.io.File)

Example 2 with SecHubClientExecutor

use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor in project sechub by mercedes-benz.

the class WithSecHubClient method createExecutor.

private SecHubClientExecutor createExecutor() {
    SecHubClientExecutor executor = new SecHubClientExecutor();
    executor.setOutputFolder(outputFolder);
    executor.setSechubClientBinaryPath(sechubClientBinaryPath);
    executor.setTrustAll(trustAll);
    return executor;
}
Also used : SecHubClientExecutor(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor)

Example 3 with SecHubClientExecutor

use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor in project sechub by mercedes-benz.

the class WithSecHubClient method startAsynchronScanFor.

public AssertAsyncResult startAsynchronScanFor(TestProject project, IntegrationTestJSONLocation location, Map<String, String> environmentVariables, ApiTokenStrategy apiTokenStrategy) {
    File sechubConfigFile = IntegrationTestFileSupport.getTestfileSupport().createFileFromResourcePath(location.getPath());
    SecHubClientExecutor executor = createExecutor();
    List<String> list = buildEnvironmentAndBehaviourCommands(project);
    ExecutionResult result = doExecute(ClientAction.START_ASYNC, apiTokenStrategy, sechubConfigFile, executor, list, environmentVariables);
    if (result.getExitCode() != 0) {
        fail("Not exit code 0 but:" + result.getExitCode() + " , last output line was:" + result.getLastOutputLine());
    }
    AssertAsyncResult asynchResult = new AssertAsyncResult();
    asynchResult.jobUUID = UUID.fromString(result.getLastOutputLine());
    asynchResult.configFile = sechubConfigFile;
    return asynchResult;
}
Also used : SecHubClientExecutor(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) File(java.io.File)

Example 4 with SecHubClientExecutor

use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor in project sechub by mercedes-benz.

the class WithSecHubClient method unmarkAsFalsePositive.

public void unmarkAsFalsePositive(TestProject project, IntegrationTestJSONLocation location, String pathToJSONFile) {
    File sechubConfigFile = IntegrationTestFileSupport.getTestfileSupport().createFileFromResourcePath(location.getPath());
    SecHubClientExecutor executor = createExecutor();
    List<String> list = buildEnvironmentAndBehaviourCommands(project);
    list.add("-file");
    list.add(pathToJSONFile);
    ExecutionResult result = doExecute(ClientAction.UNMARK_FALSE_POSITIVES, sechubConfigFile, executor, list, null);
    if (result.getExitCode() != 0) {
        fail("Not exit code 0 but:" + result.getExitCode() + " , last output line was:" + result.getLastOutputLine());
    }
}
Also used : SecHubClientExecutor(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) File(java.io.File)

Example 5 with SecHubClientExecutor

use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor in project sechub by mercedes-benz.

the class WithSecHubClient method markAsFalsePositive.

public void markAsFalsePositive(TestProject project, IntegrationTestJSONLocation location, String pathToJSONFile) {
    File sechubConfigFile = IntegrationTestFileSupport.getTestfileSupport().createFileFromResourcePath(location.getPath());
    SecHubClientExecutor executor = createExecutor();
    List<String> list = buildEnvironmentAndBehaviourCommands(project);
    list.add("-file");
    list.add(pathToJSONFile);
    ExecutionResult result = doExecute(ClientAction.MARK_FALSE_POSITIVES, sechubConfigFile, executor, list, null);
    if (result.getExitCode() != 0) {
        fail("Not exit code 0 but:" + result.getExitCode() + " , last output line was:" + result.getLastOutputLine());
    }
}
Also used : SecHubClientExecutor(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) File(java.io.File)

Aggregations

SecHubClientExecutor (com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor)6 ExecutionResult (com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult)4 File (java.io.File)4