Search in sources :

Example 1 with ExecutionResult

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

the class SecHubExecutionScenarioSecHubClientIntTest method sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_green_when_config_is_extreme_big.

@Test
public void sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_green_when_config_is_extreme_big() {
    /* prepare */
    as(SUPER_ADMIN).assignUserToProject(USER_1, PROJECT_1);
    /* @formatter:off */
    assertUser(USER_1).doesExist().isAssignedToProject(PROJECT_1);
    /* execute */
    ExecutionResult result = as(USER_1).withSecHubClient().startSynchronScanFor(PROJECT_1, CLIENT_JSON_SOURCESCAN_GREEN_EXTREME_BIG);
    /* test */
    assertResult(result).isGreen().hasExitCode(0);
/* @formatter:on */
}
Also used : AssertExecutionResult(com.mercedesbenz.sechub.integrationtest.api.AssertExecutionResult) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) Test(org.junit.Test)

Example 2 with ExecutionResult

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

the class SecHubExecutionScenarioSecHubClientIntTest method sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_green.

@Test
public void sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_green() {
    /* prepare */
    as(SUPER_ADMIN).assignUserToProject(USER_1, PROJECT_1);
    /* @formatter:off */
    assertUser(USER_1).doesExist().isAssignedToProject(PROJECT_1);
    /* execute */
    ExecutionResult result = as(USER_1).withSecHubClient().startSynchronScanFor(PROJECT_1, CLIENT_JSON_SOURCESCAN_GREEN_ZERO_WAIT_BIG_CONFIGFILE);
    /* test */
    assertResult(result).isGreen().hasExitCode(0);
/* @formatter:on */
}
Also used : AssertExecutionResult(com.mercedesbenz.sechub.integrationtest.api.AssertExecutionResult) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) Test(org.junit.Test)

Example 3 with ExecutionResult

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

the class SecHubExecutionScenarioSecHubClientIntTest method sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_red.

@Test
public void sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_red() {
    /* @formatter:off */
    /* prepare */
    as(SUPER_ADMIN).assignUserToProject(USER_1, PROJECT_1);
    assertUser(USER_1).doesExist().isAssignedToProject(PROJECT_1);
    /* execute */
    ExecutionResult result = as(USER_1).withSecHubClient().startSynchronScanFor(PROJECT_1, CLIENT_JSON_WEBSCAN_RED_ZERO_WAIT);
    /* test */
    assertResult(result).isRed().hasExitCode(1);
/* @formatter:on */
}
Also used : AssertExecutionResult(com.mercedesbenz.sechub.integrationtest.api.AssertExecutionResult) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) Test(org.junit.Test)

Example 4 with ExecutionResult

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

the class SecHubExecutionScenarioSecHubClientIntTest method sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_yellow_stop_on_yellow_active_so_exit_code1.

@Test
public void sechub_client_is_able_to_handle_synchronous_and_result_has_trafficlight_yellow_stop_on_yellow_active_so_exit_code1() {
    /* prepare */
    as(SUPER_ADMIN).assignUserToProject(USER_1, PROJECT_1);
    /* @formatter:off */
    assertUser(USER_1).doesExist().isAssignedToProject(PROJECT_1);
    /* execute */
    ExecutionResult result = as(USER_1).withSecHubClient().enableStopOnYellow().startSynchronScanFor(PROJECT_1, CLIENT_JSON_SOURCESCAN_YELLOW_ZERO_WAIT);
    /* test */
    assertResult(result).isYellow().hasExitCode(1);
/* @formatter:on */
}
Also used : AssertExecutionResult(com.mercedesbenz.sechub.integrationtest.api.AssertExecutionResult) ExecutionResult(com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult) Test(org.junit.Test)

Example 5 with ExecutionResult

use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult 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)

Aggregations

ExecutionResult (com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult)31 Test (org.junit.Test)25 UUID (java.util.UUID)19 File (java.io.File)11 IntegrationTestJSONLocation (com.mercedesbenz.sechub.integrationtest.api.IntegrationTestJSONLocation)9 AssertFullScanData (com.mercedesbenz.sechub.integrationtest.api.AssertFullScanData)6 AssertExecutionResult (com.mercedesbenz.sechub.integrationtest.api.AssertExecutionResult)5 TestProject (com.mercedesbenz.sechub.integrationtest.api.TestProject)4 SecHubClientExecutor (com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor)4 AdapterMetaData (com.mercedesbenz.sechub.adapter.AdapterMetaData)3 ProjectFalsePositivesDefinition (com.mercedesbenz.sechub.integrationtest.api.AsUser.ProjectFalsePositivesDefinition)3 FullScanDataElement (com.mercedesbenz.sechub.integrationtest.api.AssertFullScanData.FullScanDataElement)3 JSonMessageHttpStatusExceptionTestValidator (com.mercedesbenz.sechub.integrationtest.api.JSonMessageHttpStatusExceptionTestValidator)1 TestUser (com.mercedesbenz.sechub.integrationtest.api.TestUser)1 WithSecHubClient (com.mercedesbenz.sechub.integrationtest.api.WithSecHubClient)1 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)1 MappingEntry (com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry)1 HashMap (java.util.HashMap)1