Search in sources :

Example 1 with ProductExecutorConfigSetupCredentials

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

the class CheckmarxProductExecutorMockTest method createCheckmarxSetupWithAllMandotoryPartsSet.

private ProductExecutorConfigSetup createCheckmarxSetupWithAllMandotoryPartsSet() {
    ProductExecutorConfigSetup setup = mock(ProductExecutorConfigSetup.class);
    ProductExecutorConfigSetupCredentials credentials = mock(ProductExecutorConfigSetupCredentials.class);
    when(setup.getCredentials()).thenReturn(credentials);
    when(credentials.getUser()).thenReturn("user");
    when(credentials.getPassword()).thenReturn("pwd");
    List<ProductExecutorConfigSetupJobParameter> jobParameters = new ArrayList<>();
    MappingData data = new MappingData();
    data.getEntries().add(new MappingEntry(".*", "teamId1", ""));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(MappingIdentifier.CHECKMARX_NEWPROJECT_TEAM_ID.getId(), data.toJSON()));
    when(setup.getJobParameters()).thenReturn(jobParameters);
    return setup;
}
Also used : MappingEntry(com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry) ProductExecutorConfigSetupCredentials(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials) ProductExecutorConfigSetupJobParameter(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter) ArrayList(java.util.ArrayList) MappingData(com.mercedesbenz.sechub.sharedkernel.mapping.MappingData) ProductExecutorConfigSetup(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup)

Example 2 with ProductExecutorConfigSetupCredentials

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

the class DefaultExecutorConfigSupport method getPasswordOrAPIToken.

public String getPasswordOrAPIToken() {
    ProductExecutorConfigSetupCredentials credentials = config.getSetup().getCredentials();
    String pwd = credentials.getPassword();
    return evaluateEnvironmentEntry(pwd);
}
Also used : ProductExecutorConfigSetupCredentials(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials)

Example 3 with ProductExecutorConfigSetupCredentials

use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials 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 4 with ProductExecutorConfigSetupCredentials

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

the class DefaultExecutorConfigSupport method getUser.

public String getUser() {
    ProductExecutorConfigSetupCredentials credentials = config.getSetup().getCredentials();
    String user = credentials.getUser();
    return evaluateEnvironmentEntry(user);
}
Also used : ProductExecutorConfigSetupCredentials(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials)

Example 5 with ProductExecutorConfigSetupCredentials

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

the class PDSExecutorConfigSuppportTest method before.

@Before
public void before() throws Exception {
    config = mock(ProductExecutorConfig.class);
    setup = mock(ProductExecutorConfigSetup.class);
    jobParameters = new ArrayList<>();
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(PDSConfigDataKeyProvider.PDS_CONFIG_PRODUCTIDENTIFIER.getKey().getId(), CONFIGURED_PDS_PRODUCT_IDENTIFIER));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(SecHubProductExecutionPDSKeyProvider.PDS_FORBIDS_TARGETTYPE_INTERNET.getKey().getId(), "true"));
    jobParameters.add(new ProductExecutorConfigSetupJobParameter(SecHubProductExecutionPDSKeyProvider.PDS_FORBIDS_TARGETTYPE_INTRANET.getKey().getId(), "false"));
    when(config.getSetup()).thenReturn(setup);
    credentialsInConfigSetup = new ProductExecutorConfigSetupCredentials();
    when(setup.getCredentials()).thenReturn(credentialsInConfigSetup);
    when(setup.getJobParameters()).thenReturn(jobParameters);
    systemEnvironment = mock(SystemEnvironment.class);
    supportToTest = PDSExecutorConfigSuppport.createSupportAndAssertConfigValid(config, systemEnvironment);
}
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)

Aggregations

ProductExecutorConfigSetupCredentials (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupCredentials)5 ProductExecutorConfigSetup (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup)3 ProductExecutorConfigSetupJobParameter (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter)3 ProductExecutorConfig (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig)2 SystemEnvironment (com.mercedesbenz.sechub.sharedkernel.SystemEnvironment)2 Before (org.junit.Before)2 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)1 MappingEntry (com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry)1 ArrayList (java.util.ArrayList)1