use of com.mercedesbenz.sechub.domain.scan.log.ProjectScanLog in project sechub by mercedes-benz.
the class DownloadsFullScanDataForJobRestDocTest method before.
@Before
public void before() {
jobUUID = UUID.randomUUID();
FullScanData data = new FullScanData();
ScanData d = new ScanData();
d.productId = "productX";
d.result = "{ 'result':'OK'}";
d.metaData = "{}";
data.allScanData.add(d);
String config = "{}";
ProjectScanLog log = new ProjectScanLog("theProject", jobUUID, "spartakus", config);
data.allScanLogs.add(log);
when(fullScanDataService.getFullScanData(jobUUID)).thenReturn(data);
}
use of com.mercedesbenz.sechub.domain.scan.log.ProjectScanLog in project sechub by mercedes-benz.
the class FullScanDataToZipOutputSupportTest method createFullScanDataTwoProductsOneLogEntry.
private FullScanData createFullScanDataTwoProductsOneLogEntry() {
FullScanData fullScanData = new FullScanData();
ScanData data1 = new ScanData();
data1.productId = "product1";
data1.result = "{ 'result' : 'OK'}";
data1.metaData = "{ \"metadata\" : \"product1\" }";
ScanData data2 = new ScanData();
data2.productId = "product2";
data2.result = "<?xml version='1.0'>\n<result>NOT-OK</result>}";
data2.metaData = "{ \"metadata\" : \"product2\" }";
fullScanData.allScanData.add(data1);
fullScanData.allScanData.add(data2);
ProjectScanLog log1 = new ProjectScanLog("project1", sechubJobUUID, "executor1", "{'config':'heavy'}");
fullScanData.allScanLogs.add(log1);
return fullScanData;
}
use of com.mercedesbenz.sechub.domain.scan.log.ProjectScanLog in project sechub by mercedes-benz.
the class FullScanDataService method getFullScanData.
@UseCaseAdminDownloadsFullScanDataForJob(@Step(number = 2, name = "Collect all scan data"))
public FullScanData getFullScanData(UUID sechubJobUUID) {
assertion.assertIsValidJobUUID(sechubJobUUID);
LOG.debug("Start getting full scan data for {}", sechubJobUUID);
FullScanData data = new FullScanData();
data.sechubJobUUID = sechubJobUUID;
List<ProjectScanLog> logs = projectScanLogService.fetchLogsForJob(sechubJobUUID);
data.allScanLogs.addAll(logs);
List<ProductResult> results = productResultService.fetchAllResultsForJob(sechubJobUUID);
for (ProductResult result : results) {
ScanData scanData = new ScanData();
scanData.productId = result.getProductIdentifier().toString();
scanData.executorConfigUUID = result.getProductExecutorConfigUUID();
scanData.result = result.getResult();
scanData.metaData = result.getMetaData();
data.allScanData.add(scanData);
}
return data;
}
use of com.mercedesbenz.sechub.domain.scan.log.ProjectScanLog in project sechub by mercedes-benz.
the class FullScanDataToZipOutputSupport method writeScanData.
public void writeScanData(FullScanData data, OutputStream outputStream) throws IOException {
List<String> fileNamesAlreadyUsed = new ArrayList<>();
try (ZipOutputStream zippedOut = new ZipOutputStream(outputStream)) {
for (ProjectScanLog log : data.allScanLogs) {
writeStringAsZipFileEntry(zippedOut, log.toString(), "log_" + log.getUUID(), fileNamesAlreadyUsed);
}
for (ScanData scanData : data.allScanData) {
writeStringAsZipFileEntry(zippedOut, scanData.result, createFilenamePart(scanData), fileNamesAlreadyUsed);
String metaData = scanData.metaData;
if (metaData == null) {
metaData = "{ \"message\" : \"no meta data available\" }";
}
writeStringAsZipFileEntry(zippedOut, metaData, "metadata_" + createFilenamePart(scanData), fileNamesAlreadyUsed);
}
zippedOut.closeEntry();
zippedOut.finish();
}
}
Aggregations