use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup in project sechub by mercedes-benz.
the class PDSProductExecutorMinimumConfigValidationTest method createConfigWithNoParametersSet.
private ProductExecutorConfig createConfigWithNoParametersSet() {
ProductExecutorConfigSetup setup = new ProductExecutorConfigSetup();
ProductExecutorConfig config = new ProductExecutorConfig(ProductIdentifier.PDS_CODESCAN, 1, setup);
return config;
}
use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup in project sechub by mercedes-benz.
the class AbstractProductExecutionService method createFallbackExecutorConfigForSereco.
private static ProductExecutorConfig createFallbackExecutorConfigForSereco() {
ProductExecutorConfigSetup setup = new ProductExecutorConfigSetup();
ProductExecutorConfig executorConfiguration = new ProductExecutorConfig(ProductIdentifier.SERECO, 1, setup);
executorConfiguration.getSetup().setBaseURL("embedded");
return executorConfiguration;
}
use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup in project sechub by mercedes-benz.
the class CheckmarxProductExecutorMinimumConfigValidation method validate.
@Override
protected void validate(ValidationContext<ProductExecutorConfig> context) {
/* check not null... */
validateNotNull(context);
ProductExecutorConfig configToValidate = getObjectToValidate(context);
if (configToValidate == null) {
return;
}
ProductExecutorConfigSetup setup = configToValidate.getSetup();
validateNotNull(context, setup, "setup");
if (setup == null) {
return;
}
List<ProductExecutorConfigSetupJobParameter> jobParameters = setup.getJobParameters();
validateNotNull(context, jobParameters, "jobParameters");
if (jobParameters == null) {
return;
}
validateMandatoryPartsSet(context, jobParameters);
}
use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup in project sechub by mercedes-benz.
the class WebScanProductExecutionServiceImplTest method before.
@Before
public void before() throws Exception {
uri = new URI("https://www.example.org");
configuration = mock(SecHubConfiguration.class);
when(configuration.getProjectId()).thenReturn(PROJECT_ID1);
productExecutorContext = mock(ProductExecutorContext.class);
webconfiguration = mock(SecHubWebScanConfiguration.class);
context = mock(SecHubExecutionContext.class);
ProductResultRepository productResultRepository = mock(ProductResultRepository.class);
webscanner1 = mock(WebScanProductExecutor.class);
when(webscanner1.getIdentifier()).thenReturn(PRODUCT_IDENTIFIER_1);
when(webscanner1.getVersion()).thenReturn(1);
webscanner2 = mock(WebScanProductExecutor.class);
when(webscanner2.getIdentifier()).thenReturn(PRODUCT_IDENTIFIER_2);
when(webscanner2.getVersion()).thenReturn(2);
when(webconfiguration.getUri()).thenReturn(uri);
when(context.getConfiguration()).thenReturn(configuration);
List<WebScanProductExecutor> executors = new ArrayList<>();
executors.add(webscanner1);
executors.add(webscanner2);
productExecutorConfigRepository = mock(ProductExecutorConfigRepository.class);
/* simulate default profile1 */
when(productExecutorConfigRepository.findExecutableConfigurationsForProject(eq(PROJECT_ID1), eq(PRODUCT_IDENTIFIER_1), eq(1))).thenReturn(Arrays.asList(new ProductExecutorConfig(PRODUCT_IDENTIFIER_1, 1, new ProductExecutorConfigSetup())));
when(productExecutorConfigRepository.findExecutableConfigurationsForProject(eq(PROJECT_ID1), eq(PRODUCT_IDENTIFIER_2), eq(2))).thenReturn(Arrays.asList(new ProductExecutorConfig(PRODUCT_IDENTIFIER_2, 2, new ProductExecutorConfigSetup())));
serviceToTest = new WebScanProductExecutionServiceImpl(executors);
serviceToTest.productResultRepository = productResultRepository;
productExecutorContextFactory = mock(ProductExecutorContextFactory.class);
serviceToTest.productExecutorContextFactory = productExecutorContextFactory;
serviceToTest.productExecutorConfigRepository = productExecutorConfigRepository;
when(productExecutorContextFactory.create(any(), any(), any(), any())).thenReturn(productExecutorContext);
}
use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigSetup in project sechub by mercedes-benz.
the class InfrastructureScanProductExecutionServiceImplTest method before.
@Before
public void before() throws Exception {
infraScanProductExecutorConfigInfo = new WithoutProductExecutorConfigInfo(INFRASCANNER1_PRODUCT_IDENTIFIER);
uri = new URI("https://www.example.org");
configuration = mock(SecHubConfiguration.class);
when(configuration.getProjectId()).thenReturn(PROJECT_ID1);
productExecutorContext = mock(ProductExecutorContext.class);
infraconfig = mock(SecHubInfrastructureScanConfiguration.class);
context = mock(SecHubExecutionContext.class);
ProductResultRepository productResultRepository = mock(ProductResultRepository.class);
infrascanner1 = mock(InfrastructureScanProductExecutor.class, "infrascanner1");
when(infrascanner1.getIdentifier()).thenReturn(INFRASCANNER1_PRODUCT_IDENTIFIER);
when(infrascanner1.getVersion()).thenReturn(1);
infrascanner2 = mock(InfrastructureScanProductExecutor.class, "infrascanner2");
when(infrascanner2.getIdentifier()).thenReturn(INFRASCANNER2_PRODUCT_IDENTIFIER);
when(infrascanner2.getVersion()).thenReturn(2);
when(infraconfig.getUris()).thenReturn(Collections.singletonList(uri));
when(context.getConfiguration()).thenReturn(configuration);
List<InfrastructureScanProductExecutor> executors = new ArrayList<>();
executors.add(infrascanner1);
executors.add(infrascanner2);
productExecutorConfigRepository = mock(ProductExecutorConfigRepository.class);
/* simulate default profile1 */
when(productExecutorConfigRepository.findExecutableConfigurationsForProject(eq(PROJECT_ID1), eq(INFRASCANNER1_PRODUCT_IDENTIFIER), eq(1))).thenReturn(Arrays.asList(new ProductExecutorConfig(INFRASCANNER1_PRODUCT_IDENTIFIER, 1, new ProductExecutorConfigSetup())));
when(productExecutorConfigRepository.findExecutableConfigurationsForProject(eq(PROJECT_ID1), eq(INFRASCANNER2_PRODUCT_IDENTIFIER), eq(2))).thenReturn(Arrays.asList(new ProductExecutorConfig(INFRASCANNER2_PRODUCT_IDENTIFIER, 2, new ProductExecutorConfigSetup())));
serviceToTest = new InfrastructureScanProductExecutionServiceImpl(executors);
serviceToTest.productResultRepository = productResultRepository;
productExecutorContextFactory = mock(ProductExecutorContextFactory.class);
serviceToTest.productExecutorContextFactory = productExecutorContextFactory;
serviceToTest.productExecutorConfigRepository = productExecutorConfigRepository;
when(productExecutorContextFactory.create(any(), any(), any(), any())).thenReturn(productExecutorContext);
}
Aggregations