use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult 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;
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult 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());
}
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult 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());
}
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult in project sechub by mercedes-benz.
the class FalsePositivesScenario3IntTest method REST_API_direct_unmark_falsepositives_of_only_existing_medium_will_result_in_report_without_defined__And_trafficlight_changes_from_gren_to_yellow.
@Test
public void REST_API_direct_unmark_falsepositives_of_only_existing_medium_will_result_in_report_without_defined__And_trafficlight_changes_from_gren_to_yellow() throws Exception {
/* @formatter:off */
/**
********
*/
/* prepare */
/**
********
*/
IntegrationTestJSONLocation location = IntegrationTestJSONLocation.CLIENT_JSON_SOURCESCAN_YELLOW_ZERO_WAIT;
ExecutionResult result = as(USER_1).withSecHubClient().startSynchronScanFor(project, location);
UUID jobUUID = result.getSechubJobUUID();
as(USER_1).startFalsePositiveDefinition(project).add(1, jobUUID).markAsFalsePositive();
// create scan + fetch report again (check filtering of false positive works as a precondition */
ExecutionResult result2 = as(USER_1).withSecHubClient().startSynchronScanFor(project, location);
assertReportUnordered(result2).finding().id(1).name("Absolute Path Traversal").isNotContained().hasTrafficLight(TrafficLight.GREEN);
/**
********
*/
/* execute */
/**
********
*/
as(USER_1).startFalsePositiveDefinition(project).add(1, jobUUID).unmarkFalsePositive();
/**
*****
*/
/* test */
/**
*****
*/
// create scan + fetch report again
ExecutionResult result3 = as(USER_1).withSecHubClient().startSynchronScanFor(project, location);
assertReportUnordered(result3).finding().id(1).name("Absolute Path Traversal").isContained().hasTrafficLight(TrafficLight.YELLOW);
/* @formatter:on */
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult in project sechub by mercedes-benz.
the class FalsePositivesScenario3IntTest method with_sechubclient_fetch_fp_config_when_one_entry_added.
@Test
public void with_sechubclient_fetch_fp_config_when_one_entry_added() throws Exception {
/* @formatter:off */
/**
********
*/
/* prepare */
/**
********
*/
IntegrationTestJSONLocation location = IntegrationTestJSONLocation.CLIENT_JSON_SOURCESCAN_YELLOW_ZERO_WAIT;
ExecutionResult result = as(USER_1).withSecHubClient().startSynchronScanFor(project, location);
assertReportUnordered(result).finding().id(1).name("Absolute Path Traversal").isContained().hasTrafficLight(TrafficLight.YELLOW);
UUID jobUUID = result.getSechubJobUUID();
as(USER_1).startFalsePositiveDefinition(project).add(1, jobUUID).markAsFalsePositive();
/**
********
*/
/* execute */
/**
********
*/
ProjectFalsePositivesDefinition configuration = as(USER_1).withSecHubClient().getFalsePositiveConfigurationOfProject(project, location);
/**
*****
*/
/* test */
/**
*****
*/
assertTrue(configuration.isContaining(1, jobUUID));
/* @formatter:on */
}
Aggregations