Search in sources :

Example 1 with StorageService

use of com.mercedesbenz.sechub.storage.core.StorageService in project sechub by mercedes-benz.

the class ScanServiceTest method before.

@Before
public void before() throws Exception {
    storageService = mock(StorageService.class);
    jobStorage = mock(JobStorage.class);
    scanProjectConfigService = mock(ScanProjectConfigService.class);
    scanJobRegistry = mock(ScanJobListener.class);
    monitorFactory = mock(ScanProgressMonitorFactory.class);
    ProgressMonitor monitor = mock(ProgressMonitor.class);
    when(monitor.getId()).thenReturn("monitor-test-id");
    when(storageService.getJobStorage(any(), any())).thenReturn(jobStorage);
    when(monitorFactory.createProgressMonitor(any())).thenReturn(monitor);
    webScanProductExecutionService = mock(WebScanProductExecutionService.class);
    codeScanProductExecutionService = mock(CodeScanProductExecutionService.class);
    infrastructureScanProductExecutionService = mock(InfrastructureScanProductExecutionService.class);
    scanLogService = mock(ProjectScanLogService.class);
    reportService = mock(CreateScanReportService.class);
    report = mock(ScanReport.class);
    when(report.getTrafficLightAsString()).thenReturn(TRAFFIC_LIGHT);
    when(reportService.createReport(any())).thenReturn(report);
    serviceToTest = new ScanService();
    serviceToTest.webScanProductExecutionService = webScanProductExecutionService;
    serviceToTest.infraScanProductExecutionService = infrastructureScanProductExecutionService;
    serviceToTest.codeScanProductExecutionService = codeScanProductExecutionService;
    serviceToTest.reportService = reportService;
    serviceToTest.storageService = storageService;
    serviceToTest.scanLogService = scanLogService;
    serviceToTest.scanProjectConfigService = scanProjectConfigService;
    serviceToTest.scanJobListener = scanJobRegistry;
    serviceToTest.monitorFactory = monitorFactory;
}
Also used : ScanReport(com.mercedesbenz.sechub.domain.scan.report.ScanReport) CodeScanProductExecutionService(com.mercedesbenz.sechub.domain.scan.product.CodeScanProductExecutionService) StorageService(com.mercedesbenz.sechub.storage.core.StorageService) ProgressMonitor(com.mercedesbenz.sechub.sharedkernel.ProgressMonitor) ProjectScanLogService(com.mercedesbenz.sechub.domain.scan.log.ProjectScanLogService) ScanProjectConfigService(com.mercedesbenz.sechub.domain.scan.project.ScanProjectConfigService) InfrastructureScanProductExecutionService(com.mercedesbenz.sechub.domain.scan.product.InfrastructureScanProductExecutionService) WebScanProductExecutionService(com.mercedesbenz.sechub.domain.scan.product.WebScanProductExecutionService) JobStorage(com.mercedesbenz.sechub.storage.core.JobStorage) CreateScanReportService(com.mercedesbenz.sechub.domain.scan.report.CreateScanReportService) Before(org.junit.Before)

Example 2 with StorageService

use of com.mercedesbenz.sechub.storage.core.StorageService in project sechub by mercedes-benz.

the class SchedulerBinariesUploadServiceTest method beforeEach.

@BeforeEach
void beforeEach() {
    randomUuid = UUID.randomUUID();
    checksumService = mock(ChecksumSHA256Service.class);
    storageService = mock(StorageService.class);
    assertService = mock(ScheduleAssertService.class);
    storage = mock(JobStorage.class);
    httpRequest = mock(HttpServletRequest.class);
    configuration = mock(SchedulerBinariesUploadConfiguration.class);
    ScheduleSecHubJob job = new ScheduleSecHubJob();
    when(assertService.assertJob(PROJECT1, randomUuid)).thenReturn(job);
    when(storageService.getJobStorage(PROJECT1, randomUuid)).thenReturn(storage);
    /* attach at service to test */
    serviceToTest = new SchedulerBinariesUploadService();
    serviceToTest.checksumSHA256Service = checksumService;
    serviceToTest.storageService = storageService;
    serviceToTest.assertService = assertService;
    serviceToTest.configuration = configuration;
    serviceToTest.logSanitizer = mock(LogSanitizer.class);
    serviceToTest.assertion = mock(UserInputAssertion.class);
    serviceToTest.auditLogService = mock(AuditLogService.class);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ChecksumSHA256Service(com.mercedesbenz.sechub.sharedkernel.util.ChecksumSHA256Service) AuditLogService(com.mercedesbenz.sechub.sharedkernel.logging.AuditLogService) LogSanitizer(com.mercedesbenz.sechub.sharedkernel.logging.LogSanitizer) UserInputAssertion(com.mercedesbenz.sechub.sharedkernel.validation.UserInputAssertion) JobStorage(com.mercedesbenz.sechub.storage.core.JobStorage) ScheduleSecHubJob(com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob) StorageService(com.mercedesbenz.sechub.storage.core.StorageService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

JobStorage (com.mercedesbenz.sechub.storage.core.JobStorage)2 StorageService (com.mercedesbenz.sechub.storage.core.StorageService)2 ProjectScanLogService (com.mercedesbenz.sechub.domain.scan.log.ProjectScanLogService)1 CodeScanProductExecutionService (com.mercedesbenz.sechub.domain.scan.product.CodeScanProductExecutionService)1 InfrastructureScanProductExecutionService (com.mercedesbenz.sechub.domain.scan.product.InfrastructureScanProductExecutionService)1 WebScanProductExecutionService (com.mercedesbenz.sechub.domain.scan.product.WebScanProductExecutionService)1 ScanProjectConfigService (com.mercedesbenz.sechub.domain.scan.project.ScanProjectConfigService)1 CreateScanReportService (com.mercedesbenz.sechub.domain.scan.report.CreateScanReportService)1 ScanReport (com.mercedesbenz.sechub.domain.scan.report.ScanReport)1 ScheduleSecHubJob (com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob)1 ProgressMonitor (com.mercedesbenz.sechub.sharedkernel.ProgressMonitor)1 AuditLogService (com.mercedesbenz.sechub.sharedkernel.logging.AuditLogService)1 LogSanitizer (com.mercedesbenz.sechub.sharedkernel.logging.LogSanitizer)1 ChecksumSHA256Service (com.mercedesbenz.sechub.sharedkernel.util.ChecksumSHA256Service)1 UserInputAssertion (com.mercedesbenz.sechub.sharedkernel.validation.UserInputAssertion)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Before (org.junit.Before)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1