use of com.mercedesbenz.sechub.sharedkernel.util.ChecksumSHA256Service in project sechub by mercedes-benz.
the class FileUploadSizeScenario2IntTest method handleBigUpload.
private void handleBigUpload(boolean tooBig) throws FileNotFoundException, IOException {
/* prepare */
checksumSHA256Service = new ChecksumSHA256Service();
as(SUPER_ADMIN).assignUserToProject(USER_1, PROJECT_1);
UUID jobUUID = assertUser(USER_1).doesExist().isAssignedToProject(PROJECT_1).canCreateWebScan(PROJECT_1);
File largeFile = createZipFileContainingMegabytes(tooBig);
/* test */
if (tooBig) {
expected.expect(NotAcceptable.class);
expected.expectMessage("File upload maximum reached. Please reduce your upload file size.");
} else {
/* nothing - means expected no exception at all!*/
}
/* execute */
try (InputStream inputStream = new FileInputStream(largeFile)) {
as(USER_1).upload(PROJECT_1, jobUUID, largeFile, checksumSHA256Service.createChecksum(inputStream));
}
/* @formatter:on */
}
Aggregations