use of com.mercedesbenz.sechub.commons.archive.ArchiveSupport in project sechub by mercedes-benz.
the class PDSFileUploadJobServiceTest method beforeEach.
@BeforeEach
void beforeEach() throws Exception {
tmpUploadPath = TestUtil.createTempDirectoryInBuildFolder("pds-upload");
jobUUID = UUID.randomUUID();
checksumService = mock(PDSFileChecksumSHA256Service.class);
workspaceService = mock(PDSWorkspaceService.class);
storageService = mock(PDSMultiStorageService.class);
configuration = mock(UploadSizeConfiguration.class);
when(configuration.getMaxUploadSizeInBytes()).thenReturn(2048L);
archiveSupportProvider = mock(PDSArchiveSupportProvider.class);
archiveSupport = mock(ArchiveSupport.class);
when(archiveSupportProvider.getArchiveSupport()).thenReturn(archiveSupport);
storage = mock(JobStorage.class);
when(storageService.getJobStorage(jobUUID)).thenReturn(storage);
when(workspaceService.getUploadFolder(jobUUID)).thenReturn(new File(tmpUploadPath.toFile(), jobUUID.toString()));
repository = mock(PDSJobRepository.class);
job = new PDSJob();
job.uUID = jobUUID;
Optional<PDSJob> jobOption = Optional.of(job);
when(repository.findById(jobUUID)).thenReturn(jobOption);
serviceToTest = new PDSFileUploadJobService();
serviceToTest.checksumSHA256Service = checksumService;
serviceToTest.workspaceService = workspaceService;
serviceToTest.repository = repository;
serviceToTest.storageService = storageService;
serviceToTest.archiveSupportProvider = archiveSupportProvider;
serviceToTest.configuration = configuration;
when(checksumService.hasCorrectChecksum(eq(ACCEPTED_CHECKSUM), any())).thenReturn(true);
when(checksumService.hasCorrectChecksum(eq(NOT_ACCEPTED_CHECKSUM), any())).thenReturn(false);
}
Aggregations