use of com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration in project sechub by mercedes-benz.
the class NessusProductExecutorTest method prepareInfraScanWithThreeURIs.
private void prepareInfraScanWithThreeURIs() throws URISyntaxException, SecHubExecutionException {
SecHubInfrastructureScanConfiguration webscan = mock(SecHubInfrastructureScanConfiguration.class);
when(config.getInfraScan()).thenReturn(Optional.of(webscan));
List<URI> uris = new ArrayList<>();
uris.add(URI_1);
uris.add(URI_2);
uris.add(URI_3);
when(webscan.getUris()).thenReturn(uris);
}
use of com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration in project sechub by mercedes-benz.
the class NessusProductExecutorTest method nessus_resolves_ip_from_infrascan.
@Test
public void nessus_resolves_ip_from_infrascan() throws Exception {
/* prepare */
when(executorConfig.getProductIdentifier()).thenReturn(ProductIdentifier.NESSUS);
SecHubInfrastructureScanConfiguration infraScan = mock(SecHubInfrastructureScanConfiguration.class);
List<InetAddress> expectedIPList = new ArrayList<>();
when(infraScan.getIps()).thenReturn(expectedIPList);
when(config.getInfraScan()).thenReturn(Optional.of(infraScan));
/* execute */
List<InetAddress> result = executorToTest.resolveInetAdressForTarget(config);
/* test */
assertEquals(expectedIPList, result);
}
use of com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration in project sechub by mercedes-benz.
the class AbstractInfrastructureScanProductExecutor method resolveURIsForTarget.
@Override
protected List<URI> resolveURIsForTarget(SecHubConfiguration config) {
/* assert INFRASCAN configuration available */
Optional<SecHubInfrastructureScanConfiguration> infraScan = config.getInfraScan();
if (!infraScan.isPresent()) {
throw new IllegalStateException("At this state there must be a infrascan setup!");
}
/* Fetch URI */
SecHubInfrastructureScanConfiguration infraScanConfiguration = infraScan.get();
List<URI> uris = infraScanConfiguration.getUris();
if (uris == null) {
throw new IllegalStateException("At this state URIs must be set - validation failed!");
}
return uris;
}
Aggregations