use of com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration in project sechub by mercedes-benz.
the class AbstractProductExecutionService method runOnAllAvailableExecutors.
/**
* Executes product executors and stores results. If a result of an executor is
* <code>null</code> an error will be logged but
*
* @param executors
* @param context
* @param traceLogID
*/
protected void runOnAllAvailableExecutors(List<? extends ProductExecutor> executors, SecHubExecutionContext context, UUIDTraceLogID traceLogID) {
SecHubConfiguration configuration = context.getConfiguration();
requireNonNull(configuration, "Configuration must be set");
String projectId = configuration.getProjectId();
requireNonNull(projectId, "Project id must be set");
int countOfReportProductExecutor = 0;
ProductExecutor serecoProductExecutor = null;
for (ProductExecutor productExecutor : executors) {
if (context.isCanceledOrAbandonded()) {
return;
}
ProductIdentifier productIdentifier = productExecutor.getIdentifier();
int executorVersion = productExecutor.getVersion();
switch(productIdentifier) {
case SERECO:
serecoProductExecutor = productExecutor;
/* fall through */
default:
LOG.debug("search config for project={}, executor={}, version={}", projectId, productIdentifier, executorVersion);
List<ProductExecutorConfig> executorConfigurations = productExecutorConfigRepository.findExecutableConfigurationsForProject(projectId, productIdentifier, executorVersion);
if (executorConfigurations.isEmpty()) {
LOG.debug("no config found for project={} so skipping executor={}, version={}", projectId, productIdentifier, executorVersion);
continue;
}
for (ProductExecutorConfig executorConfiguration : executorConfigurations) {
runOnExecutorWithOneConfiguration(executorConfiguration, productExecutor, context, projectId, traceLogID);
ScanType scanType = productExecutor.getScanType();
if (ScanType.REPORT.equals(scanType)) {
countOfReportProductExecutor++;
}
}
}
}
if (serecoProductExecutor != null && countOfReportProductExecutor == 0) {
LOG.debug("no dedicated configuration for report execution was executed before, so fallback to sereco default behaviour");
runOnExecutorWithOneConfiguration(SERECO_FALLBACK, serecoProductExecutor, context, projectId, traceLogID);
}
}
use of com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration in project sechub by mercedes-benz.
the class ScanServiceTest method event_handling_FAILED_when_configuration_is_set_but_contains_no_projectId.
@Test
public void event_handling_FAILED_when_configuration_is_set_but_contains_no_projectId() {
/* prepare */
SecHubConfiguration configNoProjectId = prepareValidConfiguration();
configNoProjectId.setProjectId(null);
DomainMessage request = prepareRequest(configNoProjectId);
/* execute */
DomainMessageSynchronousResult result = simulateEventSend(request, serviceToTest);
/* test */
assertEquals(MessageID.SCAN_FAILED, result.getMessageId());
}
use of com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration in project sechub by mercedes-benz.
the class CheckmarxProductExecutorMockTest method createExecutionContextForPseudoCodeScan.
private SecHubExecutionContext createExecutionContextForPseudoCodeScan() {
SecHubExecutionContext context = mock(SecHubExecutionContext.class);
SecHubConfiguration config = new SecHubConfiguration();
config.setProjectId(PROJECT_EXAMPLE);
SecHubCodeScanConfiguration codeScan = new SecHubCodeScanConfiguration();
SecHubFileSystemConfiguration fileSystemConfig = new SecHubFileSystemConfiguration();
fileSystemConfig.getFolders().add(PATH_EXAMPLE1);
codeScan.setFileSystem(fileSystemConfig);
config.setCodeScan(codeScan);
when(context.getConfiguration()).thenReturn(config);
return context;
}
use of com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration in project sechub by mercedes-benz.
the class NessusProductExecutor method customize.
@Override
protected void customize(ProductExecutorData data) {
SecHubConfiguration secHubConfiguration = data.getSechubExecutionContext().getConfiguration();
data.setNetworkLocationProvider(new InfraScanNetworkLocationProvider(secHubConfiguration));
data.setNetworkTargetDataProvider(installSetup);
}
use of com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration in project sechub by mercedes-benz.
the class NetsparkerProductExecutor method customize.
@Override
protected void customize(ProductExecutorData data) {
SecHubConfiguration sechubConfiguration = data.getSechubExecutionContext().getConfiguration();
data.setNetworkLocationProvider(new WebScanNetworkLocationProvider(sechubConfiguration));
data.setNetworkTargetDataProvider(installSetup);
}
Aggregations