use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class ScanServiceTest method scanservice_does_NOT_execute_reportservice_when_webscan_throws_sechubexception.
@Test
public void scanservice_does_NOT_execute_reportservice_when_webscan_throws_sechubexception() throws Exception {
/* prepare */
DomainMessage request = prepareValidRequest();
doThrow(new SecHubExecutionException("ups...", new RuntimeException())).when(webScanProductExecutionService).executeProductsAndStoreResults(any());
/* execute */
DomainMessageSynchronousResult result = serviceToTest.receiveSynchronMessage(request);
/* test */
assertTrue(result.hasFailed());
verify(webScanProductExecutionService).executeProductsAndStoreResults(any());
verify(reportService, never()).createReport(any());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class ScanServiceTest method event_handling_FAILED_when_configuration_is_set_but_contains_no_projectId.
@Test
public void event_handling_FAILED_when_configuration_is_set_but_contains_no_projectId() {
/* prepare */
SecHubConfiguration configNoProjectId = prepareValidConfiguration();
configNoProjectId.setProjectId(null);
DomainMessage request = prepareRequest(configNoProjectId);
/* execute */
DomainMessageSynchronousResult result = simulateEventSend(request, serviceToTest);
/* test */
assertEquals(MessageID.SCAN_FAILED, result.getMessageId());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class ScanServiceTest method prepareRequest.
private DomainMessage prepareRequest(SecHubConfiguration configMin) {
DomainMessage request = new DomainMessage(MessageID.START_SCAN);
request.set(MessageDataKeys.SECHUB_UUID, UUID);
request.set(MessageDataKeys.SECHUB_CONFIG, configMin);
BatchJobMessage batchJobMessage = new BatchJobMessage();
batchJobMessage.setSecHubJobUUID(UUID);
batchJobMessage.setBatchJobId(42);
request.set(MessageDataKeys.BATCH_JOB_ID, batchJobMessage);
return request;
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class ProductResultService method sendJobResultsPurged.
@IsSendingAsyncMessage(MessageID.JOB_RESULTS_PURGED)
private void sendJobResultsPurged(UUID jobUUID) {
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.JOB_RESULTS_PURGED);
request.set(MessageDataKeys.SECHUB_UUID, jobUUID);
request.set(MessageDataKeys.ENVIRONMENT_BASE_URL, sechubEnvironment.getServerBaseUrl());
eventBus.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class ScheduleMessageHandlerTest method when_sending_message_id_PROJECT_DELETED_the_deleteAllProjectAccessService_is_called.
@Test
void when_sending_message_id_PROJECT_DELETED_the_deleteAllProjectAccessService_is_called() {
/* prepare */
DomainMessage request = new DomainMessage(MessageID.PROJECT_DELETED);
ProjectMessage content = new ProjectMessage();
content.setProjectId("projectId1");
request.set(MessageDataKeys.PROJECT_DELETE_DATA, content);
/* execute */
simulateEventSend(request, scheduleHandlerToTest);
/* test */
verify(scheduleHandlerToTest.deleteAllProjectAccessService).deleteAnyAccessDataForProject("projectId1");
}
Aggregations