use of com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo in project sechub by mercedes-benz.
the class ProductResultRepositoryDBTest method findAllProductResults_is_executable_and_returns_pds_webscan_result_for_pds_webscan_and_netsparker.
@Test
public void findAllProductResults_is_executable_and_returns_pds_webscan_result_for_pds_webscan_and_netsparker() throws Exception {
/* prepare */
UUID secHubJobUUID = UUID.randomUUID();
ProductResult result1 = new ProductResult(secHubJobUUID, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.PDS_WEBSCAN), "result");
entityManager.persistAndFlush(result1);
/* execute */
List<ProductResult> results = repositoryToTest.findAllProductResults(secHubJobUUID, NETSPARKER, PDS_WEBSCAN);
/* test */
assertNotNull(results);
assertEquals(1, results.size());
assertEquals(result1, results.iterator().next());
}
use of com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo in project sechub by mercedes-benz.
the class ProductResultRepositoryDBTest method findProduct_results_is_executable_and_returns_empty_result_for_netsparker.
@Test
public void findProduct_results_is_executable_and_returns_empty_result_for_netsparker() throws Exception {
/* prepare */
UUID secHubJobUUID = UUID.randomUUID();
ProductResult result1 = new ProductResult(secHubJobUUID, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.PDS_WEBSCAN), "result");
entityManager.persistAndFlush(result1);
/* execute */
List<ProductResult> results = repositoryToTest.findAllProductResults(secHubJobUUID, NETSPARKER);
/* test */
assertNotNull(results);
assertTrue(results.isEmpty());
}
use of com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo in project sechub by mercedes-benz.
the class ProductResultRepositoryDBTest method findProduct_results_is_executable_and_returns_pds_webscan_result_for_pds_webscan.
@Test
public void findProduct_results_is_executable_and_returns_pds_webscan_result_for_pds_webscan() throws Exception {
/* prepare */
UUID secHubJobUUID = UUID.randomUUID();
ProductResult result1 = new ProductResult(secHubJobUUID, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.PDS_WEBSCAN), "result");
entityManager.persistAndFlush(result1);
/* execute */
List<ProductResult> results = repositoryToTest.findAllProductResults(secHubJobUUID, PDS_WEBSCAN);
/* test */
assertNotNull(results);
assertEquals(1, results.size());
assertEquals(result1, results.iterator().next());
}
use of com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo in project sechub by mercedes-benz.
the class ProductResultRepositoryDBTest method given_3_stored_product_results_2_for_project1_1_for_project2_a_delete_all_for_project1_does_only_delete_project1_parts.
@Test
public void given_3_stored_product_results_2_for_project1_1_for_project2_a_delete_all_for_project1_does_only_delete_project1_parts() throws Exception {
/* prepare */
UUID job1_project1 = UUID.randomUUID();
UUID job2_project2 = UUID.randomUUID();
UUID job3_project1 = UUID.randomUUID();
ProductResult result1 = new ProductResult(job1_project1, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.SERECO), "result1");
ProductResult result2 = new ProductResult(job2_project2, "project2", new WithoutProductExecutorConfigInfo(ProductIdentifier.SERECO), "result2");
ProductResult result3 = new ProductResult(job3_project1, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.SERECO), "result3");
repositoryToTest.save(result1);
repositoryToTest.save(result2);
repositoryToTest.save(result3);
/* check preconditions */
assertEquals(3, repositoryToTest.count());
assertNotNull(repositoryToTest.findById(job2_project2));
/* execute */
repositoryToTest.deleteAllResultsForProject("project1");
/* test */
assertEquals(1, repositoryToTest.count());
assertNotNull(repositoryToTest.findById(job2_project2));
}
use of com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo in project sechub by mercedes-benz.
the class IntegrationTestScanRestController method changeScanResults.
@RequestMapping(path = APIConstants.API_ANONYMOUS + "integrationtest/project/{projectId}/job/{sechubJobUUID}/scan/productresult/{productIdentifier}", method = RequestMethod.PUT, produces = { MediaType.APPLICATION_JSON_VALUE })
public void changeScanResults(@RequestBody String body, @PathVariable("projectId") String projectId, @PathVariable("sechubJobUUID") UUID sechubJobUUID, @PathVariable("productIdentifier") ProductIdentifier productIdentifier) {
List<ProductResult> originResults = productResultService.fetchAllResultsForJob(sechubJobUUID);
ProductResult result = null;
for (ProductResult originProductResult : originResults) {
if (productIdentifier.equals(originProductResult.getProductIdentifier())) {
result = originProductResult;
break;
}
}
ProductResult resultToPersist = null;
if (result != null) {
resultToPersist = result;
} else {
// We do not know which executor this has been done - it's a new one, so we
// create just a new configuration info without UUID
WithoutProductExecutorConfigInfo info = new WithoutProductExecutorConfigInfo(productIdentifier);
resultToPersist = new ProductResult(sechubJobUUID, projectId, info, body);
}
resultToPersist.setResult(body);
productResultRepository.save(resultToPersist);
}
Aggregations