Search in sources :

Example 6 with ProductExecutorConfigSetupJobParameter

use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter in project sechub by mercedes-benz.

the class PDSProductExecutorMinimumConfigValidationTest method createConfigWithAllMandatoryParametersSetWith.

private ProductExecutorConfig createConfigWithAllMandatoryParametersSetWith(String value) {
    ProductExecutorConfig config = createConfigWithNoParametersSet();
    List<ProductExecutorConfigSetupJobParameter> params = config.getSetup().getJobParameters();
    for (SecHubProductExecutionPDSKeyProvider provider : SecHubProductExecutionPDSKeyProvider.values()) {
        SecHubProductExecutionPDSKey key = provider.getKey();
        if (key.isMandatory()) {
            params.add(new ProductExecutorConfigSetupJobParameter(key.getId(), value));
        }
    }
    for (PDSConfigDataKeyProvider provider : PDSConfigDataKeyProvider.values()) {
        ExecutionPDSKey key = provider.getKey();
        if (key.isMandatory()) {
            params.add(new ProductExecutorConfigSetupJobParameter(key.getId(), value));
        }
    }
    return config;
}
Also used : ProductExecutorConfigSetupJobParameter(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter) ProductExecutorConfig(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig) PDSConfigDataKeyProvider(com.mercedesbenz.sechub.commons.pds.PDSConfigDataKeyProvider) ExecutionPDSKey(com.mercedesbenz.sechub.commons.pds.ExecutionPDSKey)

Example 7 with ProductExecutorConfigSetupJobParameter

use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter in project sechub by mercedes-benz.

the class DefaultExecutorConfigSupportTest method before.

@Before
public void before() throws Exception {
    config = mock(ProductExecutorConfig.class);
    setup = mock(ProductExecutorConfigSetup.class);
    jobParameters = new ArrayList<>();
    jobParameters.add(new ProductExecutorConfigSetupJobParameter("key1", "value1"));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter("key2", "2"));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter("key3", "true"));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter("key4", "false"));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter("key5", "TRUE"));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter("key6", null));
    when(config.getSetup()).thenReturn(setup);
    credentialsInConfigSetup = new ProductExecutorConfigSetupCredentials();
    when(setup.getCredentials()).thenReturn(credentialsInConfigSetup);
    when(setup.getJobParameters()).thenReturn(jobParameters);
    systemEnvironment = mock(SystemEnvironment.class);
    supportToTest = new DefaultExecutorConfigSupport(config, systemEnvironment, null);
}
Also used : SystemEnvironment(com.mercedesbenz.sechub.sharedkernel.SystemEnvironment) ProductExecutorConfigSetupJobParameter(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter) ProductExecutorConfigSetupCredentials(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials) ProductExecutorConfig(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig) ProductExecutorConfigSetup(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup) Before(org.junit.Before)

Example 8 with ProductExecutorConfigSetupJobParameter

use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter in project sechub by mercedes-benz.

the class CheckmarxExecutorConfigSuppportTest method client_secret_returns_an_empty_string_default_is_returned.

@Test
public void client_secret_returns_an_empty_string_default_is_returned() {
    /* prepare */
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(CheckmarxExecutorConfigParameterKeys.CHECKMARX_CLIENT_SECRET, ""));
    supportToTest = CheckmarxExecutorConfigSuppport.createSupportAndAssertConfigValid(config, systemEnvironment);
    /* execute +test */
    assertEquals(CheckmarxConstants.DEFAULT_CLIENT_SECRET, supportToTest.getClientSecret());
}
Also used : ProductExecutorConfigSetupJobParameter(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter) Test(org.junit.Test)

Example 9 with ProductExecutorConfigSetupJobParameter

use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter in project sechub by mercedes-benz.

the class CheckmarxExecutorConfigSuppportTest method always_fullscan_enabled_false.

@Test
public void always_fullscan_enabled_false() {
    /* prepare */
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(CheckmarxExecutorConfigParameterKeys.CHECKMARX_FULLSCAN_ALWAYS, "false"));
    supportToTest = CheckmarxExecutorConfigSuppport.createSupportAndAssertConfigValid(config, systemEnvironment);
    /* test */
    assertEquals(false, supportToTest.isAlwaysFullScanEnabled());
}
Also used : ProductExecutorConfigSetupJobParameter(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter) Test(org.junit.Test)

Example 10 with ProductExecutorConfigSetupJobParameter

use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter in project sechub by mercedes-benz.

the class CheckmarxExecutorConfigSuppportTest method engine_configuration_name_returns_configured_value_when_parameter_available.

@Test
public void engine_configuration_name_returns_configured_value_when_parameter_available() {
    /* prepare */
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(CheckmarxExecutorConfigParameterKeys.CHECKMARX_ENGINE_CONFIGURATIONNAME, "test.engine"));
    supportToTest = CheckmarxExecutorConfigSuppport.createSupportAndAssertConfigValid(config, systemEnvironment);
    /* execute +test */
    assertEquals("test.engine", supportToTest.getEngineConfigurationName());
}
Also used : ProductExecutorConfigSetupJobParameter(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter) Test(org.junit.Test)

Aggregations

ProductExecutorConfigSetupJobParameter (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter)13 Test (org.junit.Test)6 ProductExecutorConfig (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig)5 ProductExecutorConfigSetup (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup)5 ProductExecutorConfigSetupCredentials (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials)3 SystemEnvironment (com.mercedesbenz.sechub.sharedkernel.SystemEnvironment)2 Before (org.junit.Before)2 ExecutionPDSKey (com.mercedesbenz.sechub.commons.pds.ExecutionPDSKey)1 PDSConfigDataKeyProvider (com.mercedesbenz.sechub.commons.pds.PDSConfigDataKeyProvider)1 PDSKey (com.mercedesbenz.sechub.commons.pds.PDSKey)1 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)1 MappingEntry (com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry)1 ArrayList (java.util.ArrayList)1