use of com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver in project sechub by mercedes-benz.
the class NessusProductExecutorTest method before.
@Before
public void before() throws Exception {
context = mock(SecHubExecutionContext.class);
config = mock(SecHubConfiguration.class);
target1 = new Target(URI_1, TargetType.INTERNET);
target2 = new Target(URI_2, TargetType.INTERNET);
target3 = new Target(URI_3, TargetType.INTERNET);
targetResolver = mock(TargetResolver.class);
when(targetResolver.resolveTarget(URI_1)).thenReturn(target1);
when(targetResolver.resolveTarget(URI_2)).thenReturn(target2);
when(targetResolver.resolveTarget(URI_3)).thenReturn(target3);
nessusAdapter = mock(NessusAdapter.class);
executorContext = mock(ProductExecutorContext.class);
executorConfig = mock(ProductExecutorConfig.class);
ProductResult productResult = mock(ProductResult.class);
when(executorContext.getExecutorConfig()).thenReturn(executorConfig);
when(executorContext.getCurrentProductResult()).thenReturn(productResult);
installSetup = mock(NessusInstallSetup.class);
when(installSetup.getBaseURL(any())).thenReturn("baseURL");
when(installSetup.getUserId(any())).thenReturn("user");
when(installSetup.getPassword(any())).thenReturn("password");
when(installSetup.isAbleToScan(TargetType.INTRANET)).thenReturn(false);
when(context.getConfiguration()).thenReturn(config);
when(context.getSechubJobUUID()).thenReturn(UUID.randomUUID());
executorToTest = new TestNessusProductExecutor();
executorToTest.installSetup = installSetup;
executorToTest.nessusAdapter = nessusAdapter;
}
use of com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver in project sechub by mercedes-benz.
the class AbstractInstallSetupProductExecutorTest method before.
@Before
public void before() throws Exception {
urisForTarget = new ArrayList<>();
inetAdressesForTarget = new ArrayList<>();
context = mock(SecHubExecutionContext.class);
executorContext = mock(ProductExecutorContext.class);
target1 = new Target(URI_1, TargetType.INTERNET);
target2 = new Target(URI_2, TargetType.INTRANET);
target3 = new Target(URI_3, TargetType.INTERNET);
target4 = new Target(IP_ADRESS1, TargetType.INTRANET);
targetResolver = mock(TargetResolver.class);
when(targetResolver.resolveTarget(URI_1)).thenReturn(target1);
when(targetResolver.resolveTarget(URI_2)).thenReturn(target2);
when(targetResolver.resolveTarget(URI_3)).thenReturn(target3);
when(targetResolver.resolveTarget(IP_ADRESS1)).thenReturn(target4);
when(context.getSechubJobUUID()).thenReturn(UUID.randomUUID());
installSetup = mock(InstallSetup.class);
executorToTest = new TestInstallSetupProductExecutor();
executorToTest.targetResolver = targetResolver;
}
use of com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver in project sechub by mercedes-benz.
the class NetsparkerProductExecutorTest method before.
@Before
public void before() throws Exception {
context = mock(SecHubExecutionContext.class);
config = mock(SecHubConfiguration.class);
executorContext = mock(ProductExecutorContext.class);
target1 = new Target(URI_1_INTERNET, TargetType.INTERNET);
target2 = new Target(URI_2_INTERNET, TargetType.INTERNET);
target3 = new Target(URI_3_INTERNET, TargetType.INTERNET);
targetResolver = mock(TargetResolver.class);
when(targetResolver.resolveTarget(URI_1_INTERNET)).thenReturn(target1);
when(targetResolver.resolveTarget(URI_2_INTERNET)).thenReturn(target2);
when(targetResolver.resolveTarget(URI_3_INTERNET)).thenReturn(target3);
netsparkerAdapter = mock(NetsparkerAdapter.class);
when(context.getConfiguration()).thenReturn(config);
UUID pseudoJobUUID = UUID.randomUUID();
when(context.getSechubJobUUID()).thenReturn(pseudoJobUUID);
when(executorContext.getCurrentProductResult()).thenReturn(new ProductResult(pseudoJobUUID, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.NETSPARKER), "resullt1"));
executorToTest = new TestNetsparkerProductExecutor();
executorToTest.netsparkerAdapter = netsparkerAdapter;
installSetup = mock(NetsparkerInstallSetup.class);
when(installSetup.getBaseURL()).thenReturn("http://www.example.com/netsparker");
when(installSetup.getUserId()).thenReturn("user");
when(installSetup.getPassword()).thenReturn("apitoken1");
when(installSetup.getNetsparkerLicenseId()).thenReturn("license1");
executorToTest.installSetup = installSetup;
}
Aggregations