Search in sources :

Example 1 with ExecutionPDSKey

use of com.mercedesbenz.sechub.commons.pds.ExecutionPDSKey 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 2 with ExecutionPDSKey

use of com.mercedesbenz.sechub.commons.pds.ExecutionPDSKey in project sechub by mercedes-benz.

the class PDSExecutionEnvironmentService method addJobParamDataWhenAccepted.

private void addJobParamDataWhenAccepted(PDSProductSetup productSetup, PDSExecutionParameterEntry jobParam, Map<String, String> map) {
    PDSProdutParameterSetup params = productSetup.getParameters();
    boolean acceptedParameter = false;
    boolean wellknown = false;
    for (PDSConfigDataKeyProvider provider : PDSConfigDataKeyProvider.values()) {
        ExecutionPDSKey key = provider.getKey();
        if (!key.getId().equals(jobParam.getKey())) {
            continue;
        }
        wellknown = true;
        acceptedParameter = key.isAvailableInsideScript();
        break;
    }
    acceptedParameter = acceptedParameter || isJobParameterAcceptedByPDSServerConfiguration(jobParam, params.getMandatory());
    acceptedParameter = acceptedParameter || isJobParameterAcceptedByPDSServerConfiguration(jobParam, params.getOptional());
    if (acceptedParameter) {
        map.put(converter.convertKeyToEnv(jobParam.getKey()), jobParam.getValue());
    } else {
        if (wellknown) {
            LOG.debug("Wellknown parameter found - but not available inside script: {}", jobParam.getKey());
        } else {
            LOG.warn("Ignored invalid job parameter key: {} for product id: {} !", jobParam.getKey(), productSetup.getId());
        }
    }
}
Also used : PDSConfigDataKeyProvider(com.mercedesbenz.sechub.commons.pds.PDSConfigDataKeyProvider) ExecutionPDSKey(com.mercedesbenz.sechub.commons.pds.ExecutionPDSKey) PDSProdutParameterSetup(com.mercedesbenz.sechub.pds.config.PDSProdutParameterSetup)

Aggregations

ExecutionPDSKey (com.mercedesbenz.sechub.commons.pds.ExecutionPDSKey)2 PDSConfigDataKeyProvider (com.mercedesbenz.sechub.commons.pds.PDSConfigDataKeyProvider)2 ProductExecutorConfig (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig)1 ProductExecutorConfigSetupJobParameter (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetupJobParameter)1 PDSProdutParameterSetup (com.mercedesbenz.sechub.pds.config.PDSProdutParameterSetup)1