Search in sources :

Example 1 with TargetResolver

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;
}
Also used : Target(com.mercedesbenz.sechub.domain.scan.Target) ProductResult(com.mercedesbenz.sechub.domain.scan.product.ProductResult) NessusAdapter(com.mercedesbenz.sechub.adapter.nessus.NessusAdapter) SecHubExecutionContext(com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext) SecHubConfiguration(com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration) ProductExecutorContext(com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext) ProductExecutorConfig(com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig) TargetResolver(com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver) Before(org.junit.Before)

Example 2 with TargetResolver

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;
}
Also used : Target(com.mercedesbenz.sechub.domain.scan.Target) SecHubExecutionContext(com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext) TargetResolver(com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver) InstallSetup(com.mercedesbenz.sechub.domain.scan.InstallSetup) Before(org.junit.Before)

Example 3 with 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;
}
Also used : NetsparkerAdapter(com.mercedesbenz.sechub.adapter.netsparker.NetsparkerAdapter) Target(com.mercedesbenz.sechub.domain.scan.Target) ProductResult(com.mercedesbenz.sechub.domain.scan.product.ProductResult) SecHubExecutionContext(com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext) SecHubConfiguration(com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration) ProductExecutorContext(com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext) UUID(java.util.UUID) TargetResolver(com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver) WithoutProductExecutorConfigInfo(com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo) Before(org.junit.Before)

Aggregations

Target (com.mercedesbenz.sechub.domain.scan.Target)3 TargetResolver (com.mercedesbenz.sechub.domain.scan.resolve.TargetResolver)3 SecHubExecutionContext (com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext)3 Before (org.junit.Before)3 ProductExecutorContext (com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext)2 ProductResult (com.mercedesbenz.sechub.domain.scan.product.ProductResult)2 SecHubConfiguration (com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration)2 NessusAdapter (com.mercedesbenz.sechub.adapter.nessus.NessusAdapter)1 NetsparkerAdapter (com.mercedesbenz.sechub.adapter.netsparker.NetsparkerAdapter)1 InstallSetup (com.mercedesbenz.sechub.domain.scan.InstallSetup)1 ProductExecutorConfig (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig)1 WithoutProductExecutorConfigInfo (com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo)1 UUID (java.util.UUID)1