Remove legacy tachograph runtime wrappers
This commit is contained in:
parent
93d59100ad
commit
1d64bd92c7
|
|
@ -2,7 +2,6 @@ package at.procon.eventhub.processing.api;
|
||||||
|
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeTachographEsperScopeResultDto;
|
|
||||||
import at.procon.eventhub.processing.eventprocessing.RuntimeEventProcessingService;
|
import at.procon.eventhub.processing.eventprocessing.RuntimeEventProcessingService;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||||
|
|
@ -19,10 +18,6 @@ import at.procon.eventhub.processing.model.UnifiedRuntimeEventBundle;
|
||||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDerivedProjectionService;
|
import at.procon.eventhub.processing.service.UnifiedRuntimeDerivedProjectionService;
|
||||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDriverTimelineService;
|
import at.procon.eventhub.processing.service.UnifiedRuntimeDriverTimelineService;
|
||||||
import at.procon.eventhub.processing.service.UnifiedRuntimeEventAssemblyService;
|
import at.procon.eventhub.processing.service.UnifiedRuntimeEventAssemblyService;
|
||||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
|
||||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationApiRequest;
|
|
||||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationResultDto;
|
|
||||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
@ -39,10 +34,8 @@ public class UnifiedRuntimeProcessingController {
|
||||||
private final UnifiedRuntimeEventAssemblyService eventAssemblyService;
|
private final UnifiedRuntimeEventAssemblyService eventAssemblyService;
|
||||||
private final UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService;
|
private final UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService;
|
||||||
private final UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService;
|
private final UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService;
|
||||||
private final RuntimeDriverWorkingTimeScopeProcessingService tachographEsperScopeProcessingService;
|
|
||||||
private final RuntimeEventProcessingService runtimeEventProcessingService;
|
private final RuntimeEventProcessingService runtimeEventProcessingService;
|
||||||
private final RuntimeProcessingExecutionService runtimeProcessingExecutionService;
|
private final RuntimeProcessingExecutionService runtimeProcessingExecutionService;
|
||||||
private final RuntimeTachographParityValidationService tachographParityValidationService;
|
|
||||||
private final RuntimeMixedSourceEvidenceValidationService mixedSourceEvidenceValidationService;
|
private final RuntimeMixedSourceEvidenceValidationService mixedSourceEvidenceValidationService;
|
||||||
|
|
||||||
public UnifiedRuntimeProcessingController(
|
public UnifiedRuntimeProcessingController(
|
||||||
|
|
@ -50,18 +43,16 @@ public class UnifiedRuntimeProcessingController {
|
||||||
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
||||||
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService
|
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService
|
||||||
) {
|
) {
|
||||||
this(eventAssemblyService, runtimeDriverTimelineService, runtimeDerivedProjectionService, null, null, null, null, null);
|
this(eventAssemblyService, runtimeDriverTimelineService, runtimeDerivedProjectionService, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnifiedRuntimeProcessingController(
|
public UnifiedRuntimeProcessingController(
|
||||||
UnifiedRuntimeEventAssemblyService eventAssemblyService,
|
UnifiedRuntimeEventAssemblyService eventAssemblyService,
|
||||||
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
||||||
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService,
|
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService,
|
||||||
RuntimeDriverWorkingTimeScopeProcessingService tachographEsperScopeProcessingService,
|
|
||||||
RuntimeEventProcessingService runtimeEventProcessingService
|
RuntimeEventProcessingService runtimeEventProcessingService
|
||||||
) {
|
) {
|
||||||
this(eventAssemblyService, runtimeDriverTimelineService, runtimeDerivedProjectionService,
|
this(eventAssemblyService, runtimeDriverTimelineService, runtimeDerivedProjectionService, runtimeEventProcessingService, null, null);
|
||||||
tachographEsperScopeProcessingService, runtimeEventProcessingService, null, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -69,35 +60,18 @@ public class UnifiedRuntimeProcessingController {
|
||||||
UnifiedRuntimeEventAssemblyService eventAssemblyService,
|
UnifiedRuntimeEventAssemblyService eventAssemblyService,
|
||||||
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
||||||
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService,
|
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService,
|
||||||
RuntimeDriverWorkingTimeScopeProcessingService tachographEsperScopeProcessingService,
|
|
||||||
RuntimeEventProcessingService runtimeEventProcessingService,
|
RuntimeEventProcessingService runtimeEventProcessingService,
|
||||||
RuntimeTachographParityValidationService tachographParityValidationService,
|
|
||||||
RuntimeMixedSourceEvidenceValidationService mixedSourceEvidenceValidationService,
|
RuntimeMixedSourceEvidenceValidationService mixedSourceEvidenceValidationService,
|
||||||
RuntimeProcessingExecutionService runtimeProcessingExecutionService
|
RuntimeProcessingExecutionService runtimeProcessingExecutionService
|
||||||
) {
|
) {
|
||||||
this.eventAssemblyService = eventAssemblyService;
|
this.eventAssemblyService = eventAssemblyService;
|
||||||
this.runtimeDriverTimelineService = runtimeDriverTimelineService;
|
this.runtimeDriverTimelineService = runtimeDriverTimelineService;
|
||||||
this.runtimeDerivedProjectionService = runtimeDerivedProjectionService;
|
this.runtimeDerivedProjectionService = runtimeDerivedProjectionService;
|
||||||
this.tachographEsperScopeProcessingService = tachographEsperScopeProcessingService;
|
|
||||||
this.runtimeEventProcessingService = runtimeEventProcessingService;
|
this.runtimeEventProcessingService = runtimeEventProcessingService;
|
||||||
this.runtimeProcessingExecutionService = runtimeProcessingExecutionService;
|
this.runtimeProcessingExecutionService = runtimeProcessingExecutionService;
|
||||||
this.tachographParityValidationService = tachographParityValidationService;
|
|
||||||
this.mixedSourceEvidenceValidationService = mixedSourceEvidenceValidationService;
|
this.mixedSourceEvidenceValidationService = mixedSourceEvidenceValidationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnifiedRuntimeProcessingController(
|
|
||||||
UnifiedRuntimeEventAssemblyService eventAssemblyService,
|
|
||||||
UnifiedRuntimeDriverTimelineService runtimeDriverTimelineService,
|
|
||||||
UnifiedRuntimeDerivedProjectionService runtimeDerivedProjectionService,
|
|
||||||
RuntimeDriverWorkingTimeScopeProcessingService tachographEsperScopeProcessingService,
|
|
||||||
RuntimeEventProcessingService runtimeEventProcessingService,
|
|
||||||
RuntimeTachographParityValidationService tachographParityValidationService
|
|
||||||
) {
|
|
||||||
this(eventAssemblyService, runtimeDriverTimelineService, runtimeDerivedProjectionService,
|
|
||||||
tachographEsperScopeProcessingService, runtimeEventProcessingService,
|
|
||||||
tachographParityValidationService, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/driver-events")
|
@PostMapping("/driver-events")
|
||||||
public ResponseEntity<UnifiedRuntimeEventBundle> loadDriverEvents(
|
public ResponseEntity<UnifiedRuntimeEventBundle> loadDriverEvents(
|
||||||
@RequestBody UnifiedRuntimeProcessingApiRequest request
|
@RequestBody UnifiedRuntimeProcessingApiRequest request
|
||||||
|
|
@ -157,17 +131,6 @@ public class UnifiedRuntimeProcessingController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/event-processing/validation/tachograph-parity")
|
|
||||||
public ResponseEntity<RuntimeTachographParityValidationResultDto> validateTachographParity(
|
|
||||||
@RequestBody RuntimeTachographParityValidationApiRequest request
|
|
||||||
) {
|
|
||||||
if (tachographParityValidationService == null) {
|
|
||||||
throw new IllegalStateException("Runtime tachograph parity validation service is not configured.");
|
|
||||||
}
|
|
||||||
return ResponseEntity.ok(tachographParityValidationService.validate(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/event-processing/validation/mixed-source-evidence")
|
@PostMapping("/event-processing/validation/mixed-source-evidence")
|
||||||
public ResponseEntity<RuntimeMixedSourceEvidenceValidationResultDto> validateMixedSourceEvidence(
|
public ResponseEntity<RuntimeMixedSourceEvidenceValidationResultDto> validateMixedSourceEvidence(
|
||||||
@RequestBody RuntimeMixedSourceEvidenceValidationApiRequest request
|
@RequestBody RuntimeMixedSourceEvidenceValidationApiRequest request
|
||||||
|
|
@ -177,22 +140,4 @@ public class UnifiedRuntimeProcessingController {
|
||||||
}
|
}
|
||||||
return ResponseEntity.ok(mixedSourceEvidenceValidationService.validate(request));
|
return ResponseEntity.ok(mixedSourceEvidenceValidationService.validate(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/tachograph/esper-processing")
|
|
||||||
public ResponseEntity<UnifiedRuntimeTachographEsperScopeResultDto> runTachographEsperProcessing(
|
|
||||||
@RequestBody UnifiedRuntimeProcessingApiRequest request
|
|
||||||
) {
|
|
||||||
if (runtimeEventProcessingService != null) {
|
|
||||||
RuntimeEventProcessingResultDto genericResult = runtimeEventProcessingService.process(
|
|
||||||
RuntimeEventProcessingApiRequest.tachographDriverEsper(request)
|
|
||||||
);
|
|
||||||
return ResponseEntity.ok(UnifiedRuntimeTachographEsperScopeResultDto.fromGenericRuntimeEventProcessingResult(genericResult));
|
|
||||||
}
|
|
||||||
if (tachographEsperScopeProcessingService == null) {
|
|
||||||
throw new IllegalStateException("Tachograph Esper scope processing service is not configured.");
|
|
||||||
}
|
|
||||||
return ResponseEntity.ok(UnifiedRuntimeTachographEsperScopeResultDto.fromDriverWorkingTime(
|
|
||||||
tachographEsperScopeProcessingService.processScope(request)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
package at.procon.eventhub.processing.dto;
|
|
||||||
|
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
|
||||||
import at.procon.eventhub.processing.model.UnifiedDiscoveredVehicleRef;
|
|
||||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public record UnifiedRuntimeTachographEsperScopeResultDto(
|
|
||||||
UnifiedRuntimeProcessingRequest request,
|
|
||||||
int inputEventCount,
|
|
||||||
int selectedDriverCount,
|
|
||||||
int discoveredVehicleCount,
|
|
||||||
List<UnifiedDiscoveredVehicleRef> discoveredVehicles,
|
|
||||||
Map<String, UnifiedRuntimeDerivedProjectionResultDto> driverResults,
|
|
||||||
Map<String, RuntimeDriverPartitionDebugDto> partitionDebugByDriver,
|
|
||||||
List<String> notes,
|
|
||||||
List<String> warnings
|
|
||||||
) {
|
|
||||||
public UnifiedRuntimeTachographEsperScopeResultDto {
|
|
||||||
discoveredVehicles = discoveredVehicles == null ? List.of() : List.copyOf(discoveredVehicles);
|
|
||||||
driverResults = driverResults == null ? Map.of() : Collections.unmodifiableMap(new LinkedHashMap<>(driverResults));
|
|
||||||
partitionDebugByDriver = partitionDebugByDriver == null ? Map.of() : Collections.unmodifiableMap(new LinkedHashMap<>(partitionDebugByDriver));
|
|
||||||
notes = notes == null ? List.of() : List.copyOf(notes);
|
|
||||||
warnings = warnings == null ? List.of() : List.copyOf(warnings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UnifiedRuntimeTachographEsperScopeResultDto fromDriverWorkingTime(
|
|
||||||
UnifiedRuntimeDriverWorkingTimeScopeResultDto result
|
|
||||||
) {
|
|
||||||
if (result == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new UnifiedRuntimeTachographEsperScopeResultDto(
|
|
||||||
result.request(),
|
|
||||||
result.inputEventCount(),
|
|
||||||
result.selectedDriverCount(),
|
|
||||||
result.discoveredVehicleCount(),
|
|
||||||
result.discoveredVehicles(),
|
|
||||||
result.driverResults(),
|
|
||||||
result.partitionDebugByDriver(),
|
|
||||||
result.notes(),
|
|
||||||
result.warnings()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UnifiedRuntimeTachographEsperScopeResultDto fromGenericRuntimeEventProcessingResult(
|
|
||||||
RuntimeEventProcessingResultDto genericResult
|
|
||||||
) {
|
|
||||||
if (genericResult == null) {
|
|
||||||
throw new IllegalArgumentException("genericResult must not be null");
|
|
||||||
}
|
|
||||||
LinkedHashMap<String, UnifiedRuntimeDerivedProjectionResultDto> driverResults = new LinkedHashMap<>();
|
|
||||||
for (Map.Entry<String, RuntimeEventProcessingPartitionResultDto> entry : genericResult.partitionResults().entrySet()) {
|
|
||||||
Object value = entry.getValue().result();
|
|
||||||
if (value instanceof UnifiedRuntimeDerivedProjectionResultDto projectionResult) {
|
|
||||||
driverResults.put(entry.getKey(), projectionResult);
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Cannot convert generic partition result for key "
|
|
||||||
+ entry.getKey() + " to UnifiedRuntimeDerivedProjectionResultDto: "
|
|
||||||
+ (value == null ? "null" : value.getClass().getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new UnifiedRuntimeTachographEsperScopeResultDto(
|
|
||||||
genericResult.request(),
|
|
||||||
genericResult.inputEventCount(),
|
|
||||||
genericResult.selectedPartitionCount(),
|
|
||||||
genericResult.discoveredVehicleCount(),
|
|
||||||
genericResult.discoveredVehicles(),
|
|
||||||
driverResults,
|
|
||||||
extractPartitionDebug(genericResult),
|
|
||||||
genericResult.notes(),
|
|
||||||
genericResult.warnings()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Map<String, RuntimeDriverPartitionDebugDto> extractPartitionDebug(
|
|
||||||
RuntimeEventProcessingResultDto genericResult
|
|
||||||
) {
|
|
||||||
LinkedHashMap<String, RuntimeDriverPartitionDebugDto> debugByDriver = new LinkedHashMap<>();
|
|
||||||
for (Map.Entry<String, RuntimeEventProcessingPartitionResultDto> entry : genericResult.partitionResults().entrySet()) {
|
|
||||||
Object debug = entry.getValue().metadata().get("partitionDebug");
|
|
||||||
if (debug instanceof RuntimeDriverPartitionDebugDto partitionDebug) {
|
|
||||||
debugByDriver.put(entry.getKey(), partitionDebug);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return debugByDriver;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package at.procon.eventhub.processing.eventprocessing.dto;
|
package at.procon.eventhub.processing.eventprocessing.dto;
|
||||||
|
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
||||||
|
import at.procon.eventhub.processing.eventprocessing.plan.DriverWorkingTimeRuntimeProcessingPlan;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -27,9 +28,9 @@ public record RuntimeEventProcessingApiRequest(
|
||||||
: Collections.unmodifiableMap(new LinkedHashMap<>(parameters));
|
: Collections.unmodifiableMap(new LinkedHashMap<>(parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RuntimeEventProcessingApiRequest tachographDriverEsper(UnifiedRuntimeProcessingApiRequest scope) {
|
public static RuntimeEventProcessingApiRequest driverWorkingTime(UnifiedRuntimeProcessingApiRequest scope) {
|
||||||
return new RuntimeEventProcessingApiRequest(
|
return new RuntimeEventProcessingApiRequest(
|
||||||
"tachograph-driver-esper-v1",
|
DriverWorkingTimeRuntimeProcessingPlan.PLAN_KEY,
|
||||||
scope,
|
scope,
|
||||||
new RuntimeEventPartitioningApiRequest(
|
new RuntimeEventPartitioningApiRequest(
|
||||||
at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy.DRIVER,
|
at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import org.springframework.stereotype.Component;
|
||||||
public class DriverWorkingTimeRuntimeProcessingPlan implements RuntimeProcessingPlan {
|
public class DriverWorkingTimeRuntimeProcessingPlan implements RuntimeProcessingPlan {
|
||||||
|
|
||||||
public static final String PLAN_KEY = "driver-working-time-v1";
|
public static final String PLAN_KEY = "driver-working-time-v1";
|
||||||
public static final String LEGACY_PROFILE_ALIAS = "tachograph-driver-esper-v1";
|
|
||||||
|
|
||||||
private final RuntimeProcessingPipelineExecutor pipelineExecutor;
|
private final RuntimeProcessingPipelineExecutor pipelineExecutor;
|
||||||
private final boolean includeRuntimeEventAssemblyModule;
|
private final boolean includeRuntimeEventAssemblyModule;
|
||||||
|
|
@ -76,7 +75,7 @@ public class DriverWorkingTimeRuntimeProcessingPlan implements RuntimeProcessing
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> aliases() {
|
public Set<String> aliases() {
|
||||||
return Set.of(LEGACY_PROFILE_ALIAS);
|
return Set.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,28 @@
|
||||||
package at.procon.eventhub.tachographfilesession.processing.profile;
|
package at.procon.eventhub.processing.eventprocessing.profile;
|
||||||
|
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||||
|
import at.procon.eventhub.processing.eventprocessing.plan.DriverWorkingTimeRuntimeProcessingPlan;
|
||||||
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionApiRequest;
|
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionApiRequest;
|
||||||
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionResultDto;
|
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.plan.DriverWorkingTimeRuntimeProcessingPlan;
|
|
||||||
import at.procon.eventhub.processing.eventprocessing.profile.RuntimeEventProcessingProfile;
|
|
||||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class TachographDriverEsperRuntimeEventProcessingProfile implements RuntimeEventProcessingProfile {
|
public class DriverWorkingTimeRuntimeEventProcessingProfile implements RuntimeEventProcessingProfile {
|
||||||
|
|
||||||
/**
|
public static final String PROFILE_KEY = DriverWorkingTimeRuntimeProcessingPlan.PLAN_KEY;
|
||||||
* Legacy compatibility key. New clients should use processingPlanKey=driver-working-time-v1
|
|
||||||
* via /api/eventhub/runtime-processing/executions.
|
|
||||||
*/
|
|
||||||
public static final String PROFILE_KEY = DriverWorkingTimeRuntimeProcessingPlan.LEGACY_PROFILE_ALIAS;
|
|
||||||
|
|
||||||
private final DriverWorkingTimeRuntimeProcessingPlan plan;
|
private final DriverWorkingTimeRuntimeProcessingPlan plan;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public TachographDriverEsperRuntimeEventProcessingProfile(DriverWorkingTimeRuntimeProcessingPlan plan) {
|
public DriverWorkingTimeRuntimeEventProcessingProfile(DriverWorkingTimeRuntimeProcessingPlan plan) {
|
||||||
this.plan = plan;
|
this.plan = plan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TachographDriverEsperRuntimeEventProcessingProfile(RuntimeDriverWorkingTimeScopeProcessingService scopeProcessingService) {
|
|
||||||
this(new DriverWorkingTimeRuntimeProcessingPlan(scopeProcessingService));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String profileKey() {
|
public String profileKey() {
|
||||||
return PROFILE_KEY;
|
return PROFILE_KEY;
|
||||||
|
|
@ -45,14 +35,13 @@ public class TachographDriverEsperRuntimeEventProcessingProfile implements Runti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String displayName() {
|
public String displayName() {
|
||||||
return "Tachograph Driver Esper Processing";
|
return plan.displayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String description() {
|
public String description() {
|
||||||
return "Compatibility adapter for legacy profileKey=" + PROFILE_KEY
|
return "Compatibility runtime-event-processing adapter for processingPlanKey="
|
||||||
+ ". New clients should use processingPlanKey=" + plan.processingPlanKey() + ". "
|
+ plan.processingPlanKey() + ". " + plan.description();
|
||||||
+ plan.description();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package at.procon.eventhub.tachographfilesession.processing.plan;
|
|
||||||
|
|
||||||
import at.procon.eventhub.processing.eventprocessing.plan.DriverWorkingTimeRuntimeProcessingPlan;
|
|
||||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Compatibility adapter. Use {@link DriverWorkingTimeRuntimeProcessingPlan}.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = false)
|
|
||||||
public class TachographDriverWorkingTimeRuntimeProcessingPlan extends DriverWorkingTimeRuntimeProcessingPlan {
|
|
||||||
|
|
||||||
public TachographDriverWorkingTimeRuntimeProcessingPlan(
|
|
||||||
RuntimeDriverWorkingTimeScopeProcessingService driverWorkingTimeScopeProcessingService
|
|
||||||
) {
|
|
||||||
super(driverWorkingTimeScopeProcessingService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
|
||||||
|
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeDriverWorkingTimeScopeResultDto;
|
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeTachographEsperScopeResultDto;
|
|
||||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Compatibility adapter. Use {@link RuntimeDriverWorkingTimeScopeProcessingService};
|
|
||||||
* tachograph files/databases are only one possible source for the common driver working-time runtime plan.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = false)
|
|
||||||
public class UnifiedRuntimeTachographEsperScopeProcessingService {
|
|
||||||
|
|
||||||
private final RuntimeDriverWorkingTimeScopeProcessingService delegate;
|
|
||||||
|
|
||||||
public UnifiedRuntimeTachographEsperScopeProcessingService(
|
|
||||||
RuntimeDriverWorkingTimeScopeProcessingService delegate
|
|
||||||
) {
|
|
||||||
this.delegate = delegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnifiedRuntimeTachographEsperScopeResultDto processScope(UnifiedRuntimeProcessingApiRequest apiRequest) {
|
|
||||||
return toLegacy(delegate.processScope(apiRequest));
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnifiedRuntimeTachographEsperScopeResultDto processScope(
|
|
||||||
UnifiedRuntimeProcessingApiRequest apiRequest,
|
|
||||||
boolean includePartitionDebug
|
|
||||||
) {
|
|
||||||
return toLegacy(delegate.processScope(apiRequest, includePartitionDebug));
|
|
||||||
}
|
|
||||||
|
|
||||||
private UnifiedRuntimeTachographEsperScopeResultDto toLegacy(
|
|
||||||
UnifiedRuntimeDriverWorkingTimeScopeResultDto result
|
|
||||||
) {
|
|
||||||
return new UnifiedRuntimeTachographEsperScopeResultDto(
|
|
||||||
result.request(),
|
|
||||||
result.inputEventCount(),
|
|
||||||
result.selectedDriverCount(),
|
|
||||||
result.discoveredVehicleCount(),
|
|
||||||
result.discoveredVehicles(),
|
|
||||||
result.driverResults(),
|
|
||||||
result.partitionDebugByDriver(),
|
|
||||||
result.notes(),
|
|
||||||
result.warnings()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -9,7 +9,7 @@ import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingA
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
import at.procon.eventhub.processing.eventprocessing.profile.DriverWorkingTimeRuntimeEventProcessingProfile;
|
||||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||||
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
||||||
|
|
@ -85,13 +85,13 @@ public class RuntimeTachographParityValidationService {
|
||||||
: "DIFFERENT";
|
: "DIFFERENT";
|
||||||
List<String> notes = new ArrayList<>(runtimeResult.notes());
|
List<String> notes = new ArrayList<>(runtimeResult.notes());
|
||||||
notes.add("Validation compares the legacy tachograph file-session esper-events path with the generic runtime event-processing profile '"
|
notes.add("Validation compares the legacy tachograph file-session esper-events path with the generic runtime event-processing profile '"
|
||||||
+ TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY + "'.");
|
+ DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY + "'.");
|
||||||
if (sessionIds.size() > 1) {
|
if (sessionIds.size() > 1) {
|
||||||
notes.add("For multiple sessions, file-session reference counts are summed per driver. Runtime processing may intentionally merge or deduplicate intervals across session boundaries, so category differences need domain review.");
|
notes.add("For multiple sessions, file-session reference counts are summed per driver. Runtime processing may intentionally merge or deduplicate intervals across session boundaries, so category differences need domain review.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RuntimeTachographParityValidationResultDto(
|
return new RuntimeTachographParityValidationResultDto(
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY,
|
DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY,
|
||||||
status,
|
status,
|
||||||
sessionIds,
|
sessionIds,
|
||||||
driverResults.size(),
|
driverResults.size(),
|
||||||
|
|
@ -207,7 +207,7 @@ public class RuntimeTachographParityValidationService {
|
||||||
parameters.put("vehicleEvidencePaddingMinutes", request.vehicleExpansionPaddingMinutesOrDefault());
|
parameters.put("vehicleEvidencePaddingMinutes", request.vehicleExpansionPaddingMinutesOrDefault());
|
||||||
parameters.put("includePartitionDebug", request.includeDebugOrDefault());
|
parameters.put("includePartitionDebug", request.includeDebugOrDefault());
|
||||||
return new RuntimeEventProcessingApiRequest(
|
return new RuntimeEventProcessingApiRequest(
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY,
|
DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY,
|
||||||
scope,
|
scope,
|
||||||
partitioning,
|
partitioning,
|
||||||
parameters
|
parameters
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,6 @@ import at.procon.eventhub.processing.model.RuntimeDriverTimeline;
|
||||||
import at.procon.eventhub.processing.model.RuntimeVehicleUsageInterval;
|
import at.procon.eventhub.processing.model.RuntimeVehicleUsageInterval;
|
||||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDerivedProjectionService;
|
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.UnifiedRuntimeDriverTimelineService;
|
||||||
import at.procon.eventhub.processing.service.UnifiedRuntimeEventAssemblyService;
|
import at.procon.eventhub.processing.service.UnifiedRuntimeEventAssemblyService;
|
||||||
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
||||||
|
|
@ -328,8 +324,6 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
derivedProjectionService,
|
derivedProjectionService,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
null,
|
|
||||||
executionService
|
executionService
|
||||||
))
|
))
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
||||||
|
|
@ -339,7 +333,7 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
when(executionService.listPlans())
|
when(executionService.listPlans())
|
||||||
.thenReturn(List.of(new RuntimeProcessingPlanDescriptorDto(
|
.thenReturn(List.of(new RuntimeProcessingPlanDescriptorDto(
|
||||||
"driver-working-time-v1",
|
"driver-working-time-v1",
|
||||||
Set.of("tachograph-driver-esper-v1"),
|
Set.of(),
|
||||||
"Driver working-time processing",
|
"Driver working-time processing",
|
||||||
"Runs common runtime event processing modules.",
|
"Runs common runtime event processing modules.",
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
|
|
@ -351,8 +345,7 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
|
|
||||||
mockMvc.perform(get("/api/eventhub/runtime-processing/executions/plans"))
|
mockMvc.perform(get("/api/eventhub/runtime-processing/executions/plans"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$[0].processingPlanKey").value("driver-working-time-v1"))
|
.andExpect(jsonPath("$[0].processingPlanKey").value("driver-working-time-v1"));
|
||||||
.andExpect(jsonPath("$[0].aliases[0]").value("tachograph-driver-esper-v1"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -367,8 +360,6 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
derivedProjectionService,
|
derivedProjectionService,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
null,
|
|
||||||
executionService
|
executionService
|
||||||
))
|
))
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
||||||
|
|
@ -434,8 +425,6 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
derivedProjectionService,
|
derivedProjectionService,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
null,
|
|
||||||
executionService
|
executionService
|
||||||
))
|
))
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
||||||
|
|
@ -517,7 +506,6 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
eventAssemblyService,
|
eventAssemblyService,
|
||||||
timelineService,
|
timelineService,
|
||||||
derivedProjectionService,
|
derivedProjectionService,
|
||||||
null,
|
|
||||||
runtimeEventProcessingService
|
runtimeEventProcessingService
|
||||||
))
|
))
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
||||||
|
|
@ -526,9 +514,9 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
|
|
||||||
when(runtimeEventProcessingService.listProfiles())
|
when(runtimeEventProcessingService.listProfiles())
|
||||||
.thenReturn(List.of(new RuntimeEventProcessingProfileDescriptorDto(
|
.thenReturn(List.of(new RuntimeEventProcessingProfileDescriptorDto(
|
||||||
"tachograph-driver-esper-v1",
|
"driver-working-time-v1",
|
||||||
"Tachograph Driver Esper Processing",
|
"Driver working-time processing",
|
||||||
"Runs tachograph driver Esper processing over runtime event scopes.",
|
"Runs common runtime event processing modules.",
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
List.of(RuntimeEventPartitioningStrategy.DRIVER),
|
List.of(RuntimeEventPartitioningStrategy.DRIVER),
|
||||||
Set.of(),
|
Set.of(),
|
||||||
|
|
@ -537,8 +525,8 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
|
|
||||||
mockMvc.perform(get("/api/eventhub/runtime-processing/event-processing/profiles"))
|
mockMvc.perform(get("/api/eventhub/runtime-processing/event-processing/profiles"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$[0].profileKey").value("tachograph-driver-esper-v1"))
|
.andExpect(jsonPath("$[0].profileKey").value("driver-working-time-v1"))
|
||||||
.andExpect(jsonPath("$[0].displayName").value("Tachograph Driver Esper Processing"))
|
.andExpect(jsonPath("$[0].displayName").value("Driver working-time processing"))
|
||||||
.andExpect(jsonPath("$[0].defaultPartitioningStrategy").value("DRIVER"))
|
.andExpect(jsonPath("$[0].defaultPartitioningStrategy").value("DRIVER"))
|
||||||
.andExpect(jsonPath("$[0].supportedPartitioningStrategies[0]").value("DRIVER"))
|
.andExpect(jsonPath("$[0].supportedPartitioningStrategies[0]").value("DRIVER"))
|
||||||
.andExpect(jsonPath("$[0].optionalParameters[0]").exists());
|
.andExpect(jsonPath("$[0].optionalParameters[0]").exists());
|
||||||
|
|
@ -554,7 +542,6 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
eventAssemblyService,
|
eventAssemblyService,
|
||||||
timelineService,
|
timelineService,
|
||||||
derivedProjectionService,
|
derivedProjectionService,
|
||||||
null,
|
|
||||||
runtimeEventProcessingService
|
runtimeEventProcessingService
|
||||||
))
|
))
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
||||||
|
|
@ -572,7 +559,7 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
);
|
);
|
||||||
when(runtimeEventProcessingService.process(any()))
|
when(runtimeEventProcessingService.process(any()))
|
||||||
.thenReturn(new RuntimeEventProcessingResultDto(
|
.thenReturn(new RuntimeEventProcessingResultDto(
|
||||||
"tachograph-driver-esper-v1",
|
"driver-working-time-v1",
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
request,
|
request,
|
||||||
3,
|
3,
|
||||||
|
|
@ -588,7 +575,7 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.content("""
|
.content("""
|
||||||
{
|
{
|
||||||
"profileKey": "tachograph-driver-esper-v1",
|
"profileKey": "driver-working-time-v1",
|
||||||
"scope": {
|
"scope": {
|
||||||
"sessionId": "%s",
|
"sessionId": "%s",
|
||||||
"sourceFamilies": ["TACHOGRAPH_FILE_SESSION"],
|
"sourceFamilies": ["TACHOGRAPH_FILE_SESSION"],
|
||||||
|
|
@ -607,155 +594,12 @@ class UnifiedRuntimeProcessingControllerTest {
|
||||||
}
|
}
|
||||||
""".formatted(sessionId)))
|
""".formatted(sessionId)))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.profileKey").value("tachograph-driver-esper-v1"))
|
.andExpect(jsonPath("$.profileKey").value("driver-working-time-v1"))
|
||||||
.andExpect(jsonPath("$.partitioningStrategy").value("DRIVER"))
|
.andExpect(jsonPath("$.partitioningStrategy").value("DRIVER"))
|
||||||
.andExpect(jsonPath("$.inputEventCount").value(3))
|
.andExpect(jsonPath("$.inputEventCount").value(3))
|
||||||
.andExpect(jsonPath("$.discoveredVehicles[0].vin").value("VIN-1"));
|
.andExpect(jsonPath("$.discoveredVehicles[0].vin").value("VIN-1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void compatibilityTachographEndpointDelegatesThroughGenericProfileRuntimeApi() 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);
|
|
||||||
RuntimeEventProcessingService runtimeEventProcessingService = org.mockito.Mockito.mock(RuntimeEventProcessingService.class);
|
|
||||||
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new UnifiedRuntimeProcessingController(
|
|
||||||
eventAssemblyService,
|
|
||||||
timelineService,
|
|
||||||
derivedProjectionService,
|
|
||||||
null,
|
|
||||||
runtimeEventProcessingService
|
|
||||||
))
|
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
|
||||||
.setControllerAdvice(new UnifiedRuntimeProcessingExceptionHandler())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
UUID sessionId = UUID.randomUUID();
|
|
||||||
UnifiedRuntimeProcessingRequest request = UnifiedRuntimeProcessingRequest.forTachographFileSession(
|
|
||||||
sessionId,
|
|
||||||
"12:123",
|
|
||||||
OffsetDateTime.parse("2026-05-01T08:00:00Z"),
|
|
||||||
OffsetDateTime.parse("2026-05-01T10:00:00Z"),
|
|
||||||
true,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
UnifiedRuntimeDerivedProjectionResultDto driverResult = new UnifiedRuntimeDerivedProjectionResultDto(
|
|
||||||
request,
|
|
||||||
2,
|
|
||||||
1,
|
|
||||||
3,
|
|
||||||
5,
|
|
||||||
List.of(new UnifiedDiscoveredVehicleRef("VEH-1", "VIN-1", "12", "REG-1")),
|
|
||||||
null,
|
|
||||||
List.of("processed through generic profile")
|
|
||||||
);
|
|
||||||
when(runtimeEventProcessingService.process(any()))
|
|
||||||
.thenReturn(new RuntimeEventProcessingResultDto(
|
|
||||||
"tachograph-driver-esper-v1",
|
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
|
||||||
request,
|
|
||||||
5,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
List.of(new UnifiedDiscoveredVehicleRef("VEH-1", "VIN-1", "12", "REG-1")),
|
|
||||||
Map.of("12:123", new RuntimeEventProcessingPartitionResultDto(
|
|
||||||
"DRIVER",
|
|
||||||
"12:123",
|
|
||||||
"UnifiedRuntimeDerivedProjectionResultDto",
|
|
||||||
driverResult,
|
|
||||||
Map.of("mergedEventCount", 5)
|
|
||||||
)),
|
|
||||||
List.of("generic adapter"),
|
|
||||||
List.of()
|
|
||||||
));
|
|
||||||
|
|
||||||
mockMvc.perform(post("/api/eventhub/runtime-processing/tachograph/esper-processing")
|
|
||||||
.contentType("application/json")
|
|
||||||
.content("""
|
|
||||||
{
|
|
||||||
"sessionId": "%s",
|
|
||||||
"sourceFamilies": ["TACHOGRAPH_FILE_SESSION"],
|
|
||||||
"driverKey": "12:123",
|
|
||||||
"occurredFrom": "2026-05-01T08:00:00Z",
|
|
||||||
"occurredTo": "2026-05-01T10:00:00Z",
|
|
||||||
"expandVehicleEvents": true,
|
|
||||||
"significantDrivingMinutes": 3,
|
|
||||||
"minimumRestPeriodMinutes": 720
|
|
||||||
}
|
|
||||||
""".formatted(sessionId)))
|
|
||||||
.andExpect(status().isOk())
|
|
||||||
.andExpect(jsonPath("$.inputEventCount").value(5))
|
|
||||||
.andExpect(jsonPath("$.selectedDriverCount").value(1))
|
|
||||||
.andExpect(jsonPath("$.driverResults['12:123'].mergedEventCount").value(5))
|
|
||||||
.andExpect(jsonPath("$.notes[0]").value("generic adapter"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void validatesTachographParityViaRuntimeApi() 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);
|
|
||||||
RuntimeEventProcessingService runtimeEventProcessingService = org.mockito.Mockito.mock(RuntimeEventProcessingService.class);
|
|
||||||
RuntimeTachographParityValidationService parityValidationService = org.mockito.Mockito.mock(RuntimeTachographParityValidationService.class);
|
|
||||||
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new UnifiedRuntimeProcessingController(
|
|
||||||
eventAssemblyService,
|
|
||||||
timelineService,
|
|
||||||
derivedProjectionService,
|
|
||||||
null,
|
|
||||||
runtimeEventProcessingService,
|
|
||||||
parityValidationService
|
|
||||||
))
|
|
||||||
.setMessageConverters(new MappingJackson2HttpMessageConverter(objectMapper))
|
|
||||||
.setControllerAdvice(new UnifiedRuntimeProcessingExceptionHandler())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
UUID sessionId = UUID.randomUUID();
|
|
||||||
when(parityValidationService.validate(any()))
|
|
||||||
.thenReturn(new RuntimeTachographParityValidationResultDto(
|
|
||||||
"tachograph-driver-esper-v1",
|
|
||||||
"EQUAL",
|
|
||||||
List.of(sessionId),
|
|
||||||
1,
|
|
||||||
Map.of("12:123", new RuntimeTachographDriverParityResultDto(
|
|
||||||
"12:123",
|
|
||||||
"EQUAL",
|
|
||||||
"SINGLE_FILE_SESSION",
|
|
||||||
1,
|
|
||||||
true,
|
|
||||||
List.of(new RuntimeTachographParityCategoryComparisonDto(
|
|
||||||
"activityIntervals",
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
true
|
|
||||||
)),
|
|
||||||
List.of("validated"),
|
|
||||||
List.of()
|
|
||||||
)),
|
|
||||||
List.of("validation complete"),
|
|
||||||
List.of()
|
|
||||||
));
|
|
||||||
|
|
||||||
mockMvc.perform(post("/api/eventhub/runtime-processing/event-processing/validation/tachograph-parity")
|
|
||||||
.contentType("application/json")
|
|
||||||
.content("""
|
|
||||||
{
|
|
||||||
"sessionId": "%s",
|
|
||||||
"driverKey": "12:123",
|
|
||||||
"occurredFrom": "2026-05-01T08:00:00Z",
|
|
||||||
"occurredTo": "2026-05-01T10:00:00Z",
|
|
||||||
"includeDebug": true
|
|
||||||
}
|
|
||||||
""".formatted(sessionId)))
|
|
||||||
.andExpect(status().isOk())
|
|
||||||
.andExpect(jsonPath("$.profileKey").value("tachograph-driver-esper-v1"))
|
|
||||||
.andExpect(jsonPath("$.status").value("EQUAL"))
|
|
||||||
.andExpect(jsonPath("$.driverResults['12:123'].status").value("EQUAL"))
|
|
||||||
.andExpect(jsonPath("$.driverResults['12:123'].comparisons[0].category").value("activityIntervals"))
|
|
||||||
.andExpect(jsonPath("$.driverResults['12:123'].comparisons[0].equal").value(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void returnsBadRequestForInvalidRuntimeRequest() throws Exception {
|
void returnsBadRequestForInvalidRuntimeRequest() throws Exception {
|
||||||
UnifiedRuntimeEventAssemblyService eventAssemblyService = org.mockito.Mockito.mock(UnifiedRuntimeEventAssemblyService.class);
|
UnifiedRuntimeEventAssemblyService eventAssemblyService = org.mockito.Mockito.mock(UnifiedRuntimeEventAssemblyService.class);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
package at.procon.eventhub.processing.eventprocessing.profile;
|
package at.procon.eventhub.processing.eventprocessing.profile;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
||||||
|
|
@ -12,28 +8,29 @@ import at.procon.eventhub.processing.dto.UnifiedRuntimeDriverWorkingTimeScopeRes
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventPartitioningApiRequest;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventPartitioningApiRequest;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
||||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||||
|
import at.procon.eventhub.processing.eventprocessing.plan.DriverWorkingTimeRuntimeProcessingPlan;
|
||||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
|
||||||
|
|
||||||
class TachographDriverEsperRuntimeEventProcessingProfileTest {
|
class DriverWorkingTimeRuntimeEventProcessingProfileTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void exposesDiscoveryMetadata() {
|
void exposesDiscoveryMetadata() {
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile profile = new TachographDriverEsperRuntimeEventProcessingProfile(
|
DriverWorkingTimeRuntimeEventProcessingProfile profile = new DriverWorkingTimeRuntimeEventProcessingProfile(
|
||||||
|
new DriverWorkingTimeRuntimeProcessingPlan(
|
||||||
org.mockito.Mockito.mock(RuntimeDriverWorkingTimeScopeProcessingService.class)
|
org.mockito.Mockito.mock(RuntimeDriverWorkingTimeScopeProcessingService.class)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
assertThat(profile.profileKey()).isEqualTo("tachograph-driver-esper-v1");
|
assertThat(profile.profileKey()).isEqualTo("driver-working-time-v1");
|
||||||
assertThat(profile.displayName()).isEqualTo("Tachograph Driver Esper Processing");
|
assertThat(profile.displayName()).isEqualTo("Driver working-time processing");
|
||||||
assertThat(profile.defaultPartitioningStrategy()).isEqualTo(RuntimeEventPartitioningStrategy.DRIVER);
|
assertThat(profile.defaultPartitioningStrategy()).isEqualTo(RuntimeEventPartitioningStrategy.DRIVER);
|
||||||
assertThat(profile.supportedPartitioningStrategies()).containsExactly(RuntimeEventPartitioningStrategy.DRIVER);
|
assertThat(profile.supportedPartitioningStrategies()).containsExactly(RuntimeEventPartitioningStrategy.DRIVER);
|
||||||
assertThat(profile.optionalParameters()).containsExactlyInAnyOrder(
|
assertThat(profile.optionalParameters()).containsExactlyInAnyOrder(
|
||||||
|
|
@ -48,9 +45,11 @@ class TachographDriverEsperRuntimeEventProcessingProfileTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void delegatesToTachographScopeServiceAndMapsPartitionResults() {
|
void delegatesToDriverWorkingTimePlanAndMapsPartitionResults() {
|
||||||
RuntimeDriverWorkingTimeScopeProcessingService scopeService = org.mockito.Mockito.mock(RuntimeDriverWorkingTimeScopeProcessingService.class);
|
RuntimeDriverWorkingTimeScopeProcessingService scopeService = org.mockito.Mockito.mock(RuntimeDriverWorkingTimeScopeProcessingService.class);
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile profile = new TachographDriverEsperRuntimeEventProcessingProfile(scopeService);
|
DriverWorkingTimeRuntimeEventProcessingProfile profile = new DriverWorkingTimeRuntimeEventProcessingProfile(
|
||||||
|
new DriverWorkingTimeRuntimeProcessingPlan(scopeService)
|
||||||
|
);
|
||||||
|
|
||||||
UUID sessionId = UUID.randomUUID();
|
UUID sessionId = UUID.randomUUID();
|
||||||
UnifiedRuntimeProcessingApiRequest scope = new UnifiedRuntimeProcessingApiRequest(
|
UnifiedRuntimeProcessingApiRequest scope = new UnifiedRuntimeProcessingApiRequest(
|
||||||
|
|
@ -80,7 +79,7 @@ class TachographDriverEsperRuntimeEventProcessingProfileTest {
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
RuntimeEventProcessingApiRequest request = new RuntimeEventProcessingApiRequest(
|
RuntimeEventProcessingApiRequest request = new RuntimeEventProcessingApiRequest(
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY,
|
DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY,
|
||||||
scope,
|
scope,
|
||||||
new RuntimeEventPartitioningApiRequest(
|
new RuntimeEventPartitioningApiRequest(
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
|
|
@ -137,7 +136,7 @@ class TachographDriverEsperRuntimeEventProcessingProfileTest {
|
||||||
null,
|
null,
|
||||||
List.of("driver processed")
|
List.of("driver processed")
|
||||||
);
|
);
|
||||||
when(scopeService.processScope(any(), anyBoolean()))
|
org.mockito.Mockito.when(scopeService.processScope(org.mockito.ArgumentMatchers.any(), org.mockito.ArgumentMatchers.anyBoolean()))
|
||||||
.thenReturn(new UnifiedRuntimeDriverWorkingTimeScopeResultDto(
|
.thenReturn(new UnifiedRuntimeDriverWorkingTimeScopeResultDto(
|
||||||
processedRequest,
|
processedRequest,
|
||||||
5,
|
5,
|
||||||
|
|
@ -152,23 +151,10 @@ class TachographDriverEsperRuntimeEventProcessingProfileTest {
|
||||||
|
|
||||||
var result = profile.process(request);
|
var result = profile.process(request);
|
||||||
|
|
||||||
assertThat(result.profileKey()).isEqualTo(TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY);
|
assertThat(result.profileKey()).isEqualTo(DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY);
|
||||||
assertThat(result.partitioningStrategy()).isEqualTo(RuntimeEventPartitioningStrategy.DRIVER);
|
assertThat(result.partitioningStrategy()).isEqualTo(RuntimeEventPartitioningStrategy.DRIVER);
|
||||||
assertThat(result.partitionResults()).containsOnlyKeys("12:DRIVER-1");
|
assertThat(result.partitionResults()).containsOnlyKeys("12:DRIVER-1");
|
||||||
assertThat(result.partitionResults().get("12:DRIVER-1").partitionType()).isEqualTo("DRIVER");
|
assertThat(result.partitionResults().get("12:DRIVER-1").partitionType()).isEqualTo("DRIVER");
|
||||||
assertThat(result.partitionResults().get("12:DRIVER-1").result()).isSameAs(driverResult);
|
assertThat(result.partitionResults().get("12:DRIVER-1").result()).isSameAs(driverResult);
|
||||||
|
|
||||||
ArgumentCaptor<UnifiedRuntimeProcessingApiRequest> captor = ArgumentCaptor.forClass(UnifiedRuntimeProcessingApiRequest.class);
|
|
||||||
ArgumentCaptor<Boolean> debugCaptor = ArgumentCaptor.forClass(Boolean.class);
|
|
||||||
verify(scopeService).processScope(captor.capture(), debugCaptor.capture());
|
|
||||||
UnifiedRuntimeProcessingApiRequest delegated = captor.getValue();
|
|
||||||
assertThat(delegated.driverKeys()).containsExactly("12:DRIVER-1");
|
|
||||||
assertThat(delegated.significantDrivingMinutes()).isEqualTo(5);
|
|
||||||
assertThat(delegated.minimumRestPeriodMinutes()).isEqualTo(600);
|
|
||||||
assertThat(delegated.vehicleExpansionPaddingMinutes()).isEqualTo(20);
|
|
||||||
assertThat(delegated.expandVehicleEvents()).isTrue();
|
|
||||||
assertThat(delegated.includeActivityIntervals()).isTrue();
|
|
||||||
assertThat(delegated.includeDrivingIntervals()).isTrue();
|
|
||||||
assertThat(debugCaptor.getValue()).isTrue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@ import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingA
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
import at.procon.eventhub.processing.eventprocessing.profile.DriverWorkingTimeRuntimeEventProcessingProfile;
|
||||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
||||||
|
|
@ -58,7 +58,7 @@ class RuntimeMixedSourceEvidenceValidationServiceTest {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
when(processingService.process(any())).thenReturn(new RuntimeEventProcessingResultDto(
|
when(processingService.process(any())).thenReturn(new RuntimeEventProcessingResultDto(
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY,
|
DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY,
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
null,
|
null,
|
||||||
3,
|
3,
|
||||||
|
|
@ -78,7 +78,7 @@ class RuntimeMixedSourceEvidenceValidationServiceTest {
|
||||||
|
|
||||||
RuntimeMixedSourceEvidenceValidationResultDto result = service.validate(new RuntimeMixedSourceEvidenceValidationApiRequest(
|
RuntimeMixedSourceEvidenceValidationResultDto result = service.validate(new RuntimeMixedSourceEvidenceValidationApiRequest(
|
||||||
new RuntimeEventProcessingApiRequest(
|
new RuntimeEventProcessingApiRequest(
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY,
|
DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY,
|
||||||
new UnifiedRuntimeProcessingApiRequest(
|
new UnifiedRuntimeProcessingApiRequest(
|
||||||
null,
|
null,
|
||||||
List.of(),
|
List.of(),
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import at.procon.eventhub.processing.eventprocessing.RuntimeEventProcessingServi
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
import at.procon.eventhub.processing.eventprocessing.profile.DriverWorkingTimeRuntimeEventProcessingProfile;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationApiRequest;
|
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationApiRequest;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationResultDto;
|
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationResultDto;
|
||||||
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationService;
|
import at.procon.eventhub.tachographfilesession.processing.validation.RuntimeTachographParityValidationService;
|
||||||
|
|
@ -73,7 +73,7 @@ class RuntimeTachographParityValidationServiceTest {
|
||||||
);
|
);
|
||||||
when(runtimeEventProcessingService.process(any()))
|
when(runtimeEventProcessingService.process(any()))
|
||||||
.thenReturn(new RuntimeEventProcessingResultDto(
|
.thenReturn(new RuntimeEventProcessingResultDto(
|
||||||
TachographDriverEsperRuntimeEventProcessingProfile.PROFILE_KEY,
|
DriverWorkingTimeRuntimeEventProcessingProfile.PROFILE_KEY,
|
||||||
RuntimeEventPartitioningStrategy.DRIVER,
|
RuntimeEventPartitioningStrategy.DRIVER,
|
||||||
runtimeRequest,
|
runtimeRequest,
|
||||||
4,
|
4,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue