Accept legacy tachograph source kinds field
This commit is contained in:
parent
84922f6c44
commit
13a1ed238c
|
|
@ -1,5 +1,6 @@
|
|||
package at.procon.eventhub.processing.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
|
|
@ -15,6 +16,7 @@ public record UnifiedRuntimeProcessingApiRequest(
|
|||
String tenantKey,
|
||||
Set<UnifiedEventSourceFamily> sourceFamilies,
|
||||
UnifiedRuntimeEventBackend eventBackend,
|
||||
@JsonAlias("tachographSourceKinds")
|
||||
Set<String> sourceKinds,
|
||||
String driverKey,
|
||||
Set<String> driverKeys,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import at.procon.eventhub.dto.EventDetailsDto;
|
||||
import at.procon.eventhub.dto.DriverRefDto;
|
||||
|
|
@ -25,10 +26,6 @@ import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecu
|
|||
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionService;
|
||||
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionApiRequest;
|
||||
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingPlanDescriptorDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographDriverParityResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographParityCategoryComparisonDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographParityValidationResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographParityValidationService;
|
||||
import at.procon.eventhub.processing.model.UnifiedDiscoveredVehicleRef;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||
|
|
@ -38,6 +35,10 @@ import at.procon.eventhub.processing.model.RuntimeDriverTimeline;
|
|||
import at.procon.eventhub.processing.model.RuntimeVehicleUsageInterval;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDerivedProjectionService;
|
||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographDriverParityResultDto;
|
||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityCategoryComparisonDto;
|
||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationResultDto;
|
||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationService;
|
||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDriverTimelineService;
|
||||
import at.procon.eventhub.processing.service.UnifiedRuntimeEventAssemblyService;
|
||||
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
||||
|
|
@ -53,6 +54,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
|
@ -181,6 +183,48 @@ class UnifiedRuntimeProcessingControllerTest {
|
|||
.andExpect(jsonPath("$.vehicleUsageIntervals[0].intervalId").value("CVU-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void acceptsLegacyTachographSourceKindsField() throws Exception {
|
||||
UnifiedRuntimeEventAssemblyService eventAssemblyService = org.mockito.Mockito.mock(UnifiedRuntimeEventAssemblyService.class);
|
||||
UnifiedRuntimeDriverTimelineService timelineService = org.mockito.Mockito.mock(UnifiedRuntimeDriverTimelineService.class);
|
||||
UnifiedRuntimeDerivedProjectionService derivedProjectionService = org.mockito.Mockito.mock(UnifiedRuntimeDerivedProjectionService.class);
|
||||
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new UnifiedRuntimeProcessingController(eventAssemblyService, timelineService, derivedProjectionService))
|
||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
||||
.setControllerAdvice(new UnifiedRuntimeProcessingExceptionHandler())
|
||||
.build();
|
||||
|
||||
when(timelineService.loadDriverTimeline(any()))
|
||||
.thenReturn(new RuntimeDriverTimeline(
|
||||
"DRIVER_CARD",
|
||||
OffsetDateTime.parse("2026-05-01T08:00:00Z"),
|
||||
OffsetDateTime.parse("2026-05-01T10:00:00Z"),
|
||||
List.of(),
|
||||
List.of(),
|
||||
List.of(),
|
||||
List.of()
|
||||
));
|
||||
|
||||
mockMvc.perform(post("/api/eventhub/runtime-processing/driver-timeline")
|
||||
.contentType("application/json")
|
||||
.content("""
|
||||
{
|
||||
"tenantKey": "default",
|
||||
"sourceFamilies": ["TACHOGRAPH_DB"],
|
||||
"eventBackend": "SOURCE_DB",
|
||||
"tachographSourceKinds": ["DRIVER_CARD"],
|
||||
"driverSourceEntityId": "DRIVER:42",
|
||||
"occurredFrom": "2026-05-01T08:00:00Z",
|
||||
"occurredTo": "2026-05-01T10:00:00Z"
|
||||
}
|
||||
"""))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.sourceKind").value("DRIVER_CARD"));
|
||||
|
||||
ArgumentCaptor<UnifiedRuntimeProcessingRequest> requestCaptor = ArgumentCaptor.forClass(UnifiedRuntimeProcessingRequest.class);
|
||||
org.mockito.Mockito.verify(timelineService).loadDriverTimeline(requestCaptor.capture());
|
||||
assertThat(requestCaptor.getValue().sourceKinds()).containsExactly("DRIVER_CARD");
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadsDriverDerivedProjectionsViaRuntimeApi() throws Exception {
|
||||
UnifiedRuntimeEventAssemblyService eventAssemblyService = org.mockito.Mockito.mock(UnifiedRuntimeEventAssemblyService.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue