Refactor unified runtime tachograph dependencies
This commit is contained in:
parent
13a1ed238c
commit
93d59100ad
|
|
@ -30,7 +30,8 @@ public class EventHubProperties {
|
|||
|
||||
private final Batch batch = new Batch();
|
||||
private final Tachograph tachograph = new Tachograph();
|
||||
private final TachographFileSession tachographFileSession = new TachographFileSession();
|
||||
private final RuntimeProcessing runtimeProcessing = new RuntimeProcessing();
|
||||
private final TachographFileSession tachographFileSession = new TachographFileSession(runtimeProcessing);
|
||||
private final EsperPoc esperPoc = new EsperPoc();
|
||||
private final YellowFox yellowFox = new YellowFox();
|
||||
|
||||
|
|
@ -46,6 +47,10 @@ public class EventHubProperties {
|
|||
return tachographFileSession;
|
||||
}
|
||||
|
||||
public RuntimeProcessing getRuntimeProcessing() {
|
||||
return runtimeProcessing;
|
||||
}
|
||||
|
||||
public EsperPoc getEsperPoc() {
|
||||
return esperPoc;
|
||||
}
|
||||
|
|
@ -318,7 +323,15 @@ public class EventHubProperties {
|
|||
private int maxSessions = 100;
|
||||
private long maxFileSizeBytes = 20L * 1024L * 1024L;
|
||||
private final LegalRequirements legalRequirements = new LegalRequirements();
|
||||
private final Processing processing = new Processing();
|
||||
private final Processing processing;
|
||||
|
||||
public TachographFileSession() {
|
||||
this(new Processing());
|
||||
}
|
||||
|
||||
public TachographFileSession(Processing processing) {
|
||||
this.processing = processing == null ? new Processing() : processing;
|
||||
}
|
||||
|
||||
public Duration getTtl() {
|
||||
return ttl;
|
||||
|
|
@ -355,6 +368,9 @@ public class EventHubProperties {
|
|||
}
|
||||
}
|
||||
|
||||
public static class RuntimeProcessing extends Processing {
|
||||
}
|
||||
|
||||
public static class Processing {
|
||||
private TimelineInputMode timelineInputMode = TimelineInputMode.INTERVALS;
|
||||
private DrivingDerivedProjectionInputMode drivingDerivedProjectionInputMode = DrivingDerivedProjectionInputMode.INTERVALS;
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingPlanD
|
|||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeMixedSourceEvidenceValidationApiRequest;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeMixedSourceEvidenceValidationResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeMixedSourceEvidenceValidationService;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographParityValidationApiRequest;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographParityValidationResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.validation.RuntimeTachographParityValidationService;
|
||||
import at.procon.eventhub.processing.model.RuntimeDriverTimeline;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBundle;
|
||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDerivedProjectionService;
|
||||
import at.procon.eventhub.processing.service.UnifiedRuntimeDriverTimelineService;
|
||||
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.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ public class DriverWorkingTimeReusableProjectionBuilder {
|
|||
try {
|
||||
Configuration configuration = new Configuration();
|
||||
configurationSetup.accept(configuration);
|
||||
String runtimeUri = "eventhub-tachograph-reusable-projection-" + RUNTIME_COUNTER.incrementAndGet();
|
||||
String runtimeUri = "eventhub-driver-working-time-reusable-projection-" + RUNTIME_COUNTER.incrementAndGet();
|
||||
runtime = EPRuntimeProvider.getRuntime(runtimeUri, configuration);
|
||||
|
||||
CompilerArguments arguments = new CompilerArguments(configuration);
|
||||
|
|
@ -261,7 +261,7 @@ public class DriverWorkingTimeReusableProjectionBuilder {
|
|||
|
||||
sender.accept(runtime);
|
||||
} catch (EPCompileException | EPDeployException e) {
|
||||
throw new IllegalStateException("Cannot compile/deploy reusable tachograph projection EPL bundle", e);
|
||||
throw new IllegalStateException("Cannot compile/deploy reusable driver working-time projection EPL bundle", e);
|
||||
} finally {
|
||||
if (runtime != null) {
|
||||
runtime.destroy();
|
||||
|
|
@ -728,21 +728,21 @@ public class DriverWorkingTimeReusableProjectionBuilder {
|
|||
)
|
||||
.replace(
|
||||
"${REST_GEO_LOOKBACK_SECONDS}",
|
||||
Long.toString(Math.max(1, properties.getTachographFileSession().getProcessing().getRestCandidateGeoLookbackMinutes()) * 60L)
|
||||
Long.toString(Math.max(1, properties.getRuntimeProcessing().getRestCandidateGeoLookbackMinutes()) * 60L)
|
||||
)
|
||||
.replace(
|
||||
"${REST_GEO_LOOKAHEAD_SECONDS}",
|
||||
Long.toString(Math.max(1, properties.getTachographFileSession().getProcessing().getRestCandidateGeoLookaheadMinutes()) * 60L)
|
||||
Long.toString(Math.max(1, properties.getRuntimeProcessing().getRestCandidateGeoLookaheadMinutes()) * 60L)
|
||||
)
|
||||
.replace(
|
||||
"${REST_GEO_STATIONARY_MAX_METERS}",
|
||||
Integer.toString(Math.max(0, properties.getTachographFileSession().getProcessing().getRestCandidateGeoStationaryMaxMeters()))
|
||||
Integer.toString(Math.max(0, properties.getRuntimeProcessing().getRestCandidateGeoStationaryMaxMeters()))
|
||||
)
|
||||
.replace(
|
||||
"${REST_GEO_MINOR_MOVEMENT_MAX_METERS}",
|
||||
Integer.toString(Math.max(
|
||||
properties.getTachographFileSession().getProcessing().getRestCandidateGeoStationaryMaxMeters(),
|
||||
properties.getTachographFileSession().getProcessing().getRestCandidateGeoMinorMovementMaxMeters()
|
||||
properties.getRuntimeProcessing().getRestCandidateGeoStationaryMaxMeters(),
|
||||
properties.getRuntimeProcessing().getRestCandidateGeoMinorMovementMaxMeters()
|
||||
))
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class SupportEvidenceNormalizationModule implements RuntimeProcessingModu
|
|||
.toList();
|
||||
|
||||
RuntimeSupportEvidenceNormalizationResult normalizationResult =
|
||||
supportEvidenceNormalizer.normalizeForTachographDriver(driverKey, partition.mergedEvents());
|
||||
supportEvidenceNormalizer.normalizeForDriverWorkingTime(driverKey, partition.mergedEvents());
|
||||
List<RuntimeSupportEvidenceEvent> supportEvidenceEvents = normalizationResult.normalizedEvents().stream()
|
||||
.map(event -> supportEvidenceNormalizer.toSupportEvidenceEvent(driverKey, event))
|
||||
.filter(Objects::nonNull)
|
||||
|
|
@ -121,10 +121,10 @@ public class SupportEvidenceNormalizationModule implements RuntimeProcessingModu
|
|||
scopeRequest.occurredFrom(),
|
||||
scopeRequest.occurredTo(),
|
||||
scopeRequest.significantDrivingMinutes() == null
|
||||
? properties.getTachographFileSession().getProcessing().getSignificantDrivingMinutes()
|
||||
? properties.getRuntimeProcessing().getSignificantDrivingMinutes()
|
||||
: scopeRequest.significantDrivingMinutes(),
|
||||
scopeRequest.minimumRestPeriodMinutes() == null
|
||||
? properties.getTachographFileSession().getProcessing().getMinimumRestPeriodMinutes()
|
||||
? properties.getRuntimeProcessing().getMinimumRestPeriodMinutes()
|
||||
: scopeRequest.minimumRestPeriodMinutes(),
|
||||
driverActivityIntervals,
|
||||
normalizedPartition.vehicleUsageIntervals(),
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class RuntimeSupportEvidenceNormalizer {
|
||||
|
||||
private static final LinkedHashSet<EventDomain> DIRECT_TACHOGRAPH_SUPPORT_DOMAINS = new LinkedHashSet<>(List.of(
|
||||
private static final String DRIVER_WORKING_TIME_PROFILE_KEY = "driver-working-time-v1";
|
||||
private static final LinkedHashSet<EventDomain> DIRECT_DRIVER_WORKING_TIME_SUPPORT_DOMAINS = new LinkedHashSet<>(List.of(
|
||||
EventDomain.POSITION,
|
||||
EventDomain.PLACE,
|
||||
EventDomain.BORDER_CROSSING,
|
||||
|
|
@ -36,7 +37,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public RuntimeSupportEvidenceNormalizationResult normalizeForTachographDriver(
|
||||
public RuntimeSupportEvidenceNormalizationResult normalizeForDriverWorkingTime(
|
||||
String driverKey,
|
||||
List<EventHubEventDto> events
|
||||
) {
|
||||
|
|
@ -45,7 +46,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
int normalizedSupportEvidence = 0;
|
||||
int unchanged = 0;
|
||||
for (EventHubEventDto event : safeEvents) {
|
||||
EventHubEventDto normalized = normalizeOneForTachographDriver(driverKey, event);
|
||||
EventHubEventDto normalized = normalizeOneForDriverWorkingTime(driverKey, event);
|
||||
normalizedEvents.add(normalized);
|
||||
if (normalized != event) {
|
||||
normalizedSupportEvidence++;
|
||||
|
|
@ -56,7 +57,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
List<String> notes = new ArrayList<>();
|
||||
notes.add("Runtime support evidence normalization inspected " + safeEvents.size() + " event(s).");
|
||||
notes.add("Runtime support evidence normalization adapted " + normalizedSupportEvidence
|
||||
+ " support/vehicle event(s) for the tachograph Esper profile.");
|
||||
+ " support/vehicle event(s) for the shared driver working-time pipeline.");
|
||||
return new RuntimeSupportEvidenceNormalizationResult(
|
||||
normalizedEvents,
|
||||
safeEvents.size(),
|
||||
|
|
@ -66,6 +67,17 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #normalizeForDriverWorkingTime(String, List)}.
|
||||
*/
|
||||
@Deprecated(forRemoval = false)
|
||||
public RuntimeSupportEvidenceNormalizationResult normalizeForTachographDriver(
|
||||
String driverKey,
|
||||
List<EventHubEventDto> events
|
||||
) {
|
||||
return normalizeForDriverWorkingTime(driverKey, events);
|
||||
}
|
||||
|
||||
public RuntimeSupportEvidenceEvent toSupportEvidenceEvent(String fallbackDriverKey, EventHubEventDto event) {
|
||||
if (event == null || isDriverActivityOrCardUsage(event)) {
|
||||
return null;
|
||||
|
|
@ -101,7 +113,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
);
|
||||
}
|
||||
|
||||
private EventHubEventDto normalizeOneForTachographDriver(String fallbackDriverKey, EventHubEventDto event) {
|
||||
private EventHubEventDto normalizeOneForDriverWorkingTime(String fallbackDriverKey, EventHubEventDto event) {
|
||||
if (event == null || isDriverActivityOrCardUsage(event)) {
|
||||
return event;
|
||||
}
|
||||
|
|
@ -166,7 +178,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
}
|
||||
|
||||
private EventDomain normalizedDomain(EventHubEventDto event) {
|
||||
if (event.eventDomain() != null && DIRECT_TACHOGRAPH_SUPPORT_DOMAINS.contains(event.eventDomain())) {
|
||||
if (event.eventDomain() != null && DIRECT_DRIVER_WORKING_TIME_SUPPORT_DOMAINS.contains(event.eventDomain())) {
|
||||
return event.eventDomain();
|
||||
}
|
||||
return EventDomain.POSITION;
|
||||
|
|
@ -202,7 +214,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
) {
|
||||
Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
put(attributes, "normalizedSupportEvidence", true);
|
||||
put(attributes, "normalizedForProfile", "tachograph-driver-esper-v1");
|
||||
put(attributes, "normalizedForProfile", DRIVER_WORKING_TIME_PROFILE_KEY);
|
||||
put(attributes, "originalEventDomain", support.eventDomain());
|
||||
put(attributes, "originalEventType", support.eventType());
|
||||
put(attributes, "originalLifecycle", support.lifecycle());
|
||||
|
|
@ -233,7 +245,7 @@ public class RuntimeSupportEvidenceNormalizer {
|
|||
originalRaw.fields().forEachRemaining(entry -> raw.set(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
put(raw, "normalizedSupportEvidence", true);
|
||||
put(raw, "normalizedForProfile", "tachograph-driver-esper-v1");
|
||||
put(raw, "normalizedForProfile", DRIVER_WORKING_TIME_PROFILE_KEY);
|
||||
put(raw, "supportEventId", support.eventId());
|
||||
put(raw, "supportEventDomain", support.eventDomain());
|
||||
put(raw, "supportEventType", support.eventType());
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
final class RuntimeIntervalEventWindowSelector {
|
||||
public final class RuntimeIntervalEventWindowSelector {
|
||||
|
||||
private RuntimeIntervalEventWindowSelector() {
|
||||
}
|
||||
|
||||
static RuntimeTimelineEventBundle filterBundle(
|
||||
public static RuntimeTimelineEventBundle filterBundle(
|
||||
RuntimeTimelineEventBundle bundle,
|
||||
OffsetDateTime occurredFrom,
|
||||
OffsetDateTime occurredTo,
|
||||
|
|
@ -31,7 +31,7 @@ final class RuntimeIntervalEventWindowSelector {
|
|||
);
|
||||
}
|
||||
|
||||
static List<EventHubEventDto> filterIntervalEvents(
|
||||
public static List<EventHubEventDto> filterIntervalEvents(
|
||||
List<EventHubEventDto> events,
|
||||
OffsetDateTime occurredFrom,
|
||||
OffsetDateTime occurredTo,
|
||||
|
|
@ -58,7 +58,7 @@ final class RuntimeIntervalEventWindowSelector {
|
|||
return List.copyOf(result);
|
||||
}
|
||||
|
||||
static List<EventHubEventDto> filterPointEvents(
|
||||
public static List<EventHubEventDto> filterPointEvents(
|
||||
List<EventHubEventDto> events,
|
||||
OffsetDateTime occurredFrom,
|
||||
OffsetDateTime occurredTo
|
||||
|
|
|
|||
|
|
@ -1,41 +1,25 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
|
||||
import at.procon.eventhub.config.EventHubProperties;
|
||||
import at.procon.eventhub.dto.DriverRefDto;
|
||||
import at.procon.eventhub.dto.EventHubEventDto;
|
||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
||||
import at.procon.eventhub.processing.dto.RuntimeSupportEvidenceNormalizationDebugDto;
|
||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
||||
import at.procon.eventhub.processing.driverworkingtime.model.DriverWorkingTimeActivityInterval;
|
||||
import at.procon.eventhub.processing.driverworkingtime.model.DriverWorkingTimeProcessingInput;
|
||||
import at.procon.eventhub.processing.driverworkingtime.model.DriverWorkingTimeVehicleUsageInterval;
|
||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
||||
import at.procon.eventhub.processing.driverworkingtime.service.DriverWorkingTimeDerivedProjectionEngine;
|
||||
import at.procon.eventhub.processing.driverworkingtime.service.DriverWorkingTimeProcessingCore;
|
||||
import at.procon.eventhub.processing.driverworkingtime.service.DriverWorkingTimeReusableProjectionBuilder;
|
||||
import at.procon.eventhub.processing.eventprocessing.support.RuntimeSupportEvidenceNormalizationResult;
|
||||
import at.procon.eventhub.processing.eventprocessing.support.RuntimeSupportEvidenceNormalizer;
|
||||
import at.procon.eventhub.processing.model.RuntimeDriverTimeline;
|
||||
import at.procon.eventhub.processing.model.RuntimeSupportEvent;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBundle;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
import at.procon.eventhub.processing.driverworkingtime.dto.DriverWorkingTimeProcessingResultDto;
|
||||
import at.procon.eventhub.processing.support.RuntimeDriverWorkingTimeAdapter;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperActivityIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperDailyWeeklyRestCandidateCoverageIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperDrivingDerivedProjectionBundle;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperDrivingInterruptionIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperPotentialHomeOvernightStayIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperPotentialInVehicleOvernightStayIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperPotentialInVehicleTripIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperSupportGeoEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperVehicleUsageIntervalEvent;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographEsperVuCardAbsentIntervalEvent;
|
||||
import at.procon.eventhub.processing.support.RuntimeEntityReferenceResolver;
|
||||
import java.time.Duration;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
|
@ -101,7 +85,7 @@ public class UnifiedRuntimeDerivedProjectionService {
|
|||
String driverKey = explicitDriverKey == null
|
||||
? resolveDriverKey(request, eventBundle.mergedEvents())
|
||||
: explicitDriverKey;
|
||||
RuntimeSupportEvidenceNormalizationResult normalizationResult = supportEvidenceNormalizer.normalizeForTachographDriver(
|
||||
RuntimeSupportEvidenceNormalizationResult normalizationResult = supportEvidenceNormalizer.normalizeForDriverWorkingTime(
|
||||
driverKey,
|
||||
eventBundle.mergedEvents()
|
||||
);
|
||||
|
|
@ -193,8 +177,8 @@ public class UnifiedRuntimeDerivedProjectionService {
|
|||
);
|
||||
}
|
||||
|
||||
private EventHubProperties.Processing processingProperties() {
|
||||
return properties.getTachographFileSession().getProcessing();
|
||||
private EventHubProperties.RuntimeProcessing processingProperties() {
|
||||
return properties.getRuntimeProcessing();
|
||||
}
|
||||
|
||||
private UUID runtimeSessionId(UnifiedRuntimeProcessingRequest request) {
|
||||
|
|
@ -213,288 +197,7 @@ public class UnifiedRuntimeDerivedProjectionService {
|
|||
return RuntimeEntityReferenceResolver.requestDriverKey(request, events);
|
||||
}
|
||||
|
||||
|
||||
private List<TachographEsperVehicleUsageIntervalEvent> mergeVehicleUsageIntervals(
|
||||
List<TachographEsperVehicleUsageIntervalEvent> intervals
|
||||
) {
|
||||
if (intervals == null || intervals.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
List<TachographEsperVehicleUsageIntervalEvent> sorted = intervals.stream()
|
||||
.sorted(Comparator.comparing(TachographEsperVehicleUsageIntervalEvent::startedAt)
|
||||
.thenComparing(TachographEsperVehicleUsageIntervalEvent::endedAt, Comparator.nullsLast(Comparator.naturalOrder()))
|
||||
.thenComparing(TachographEsperVehicleUsageIntervalEvent::intervalId, Comparator.nullsLast(String::compareTo)))
|
||||
.toList();
|
||||
List<TachographEsperVehicleUsageIntervalEvent> merged = new ArrayList<>();
|
||||
for (TachographEsperVehicleUsageIntervalEvent next : sorted) {
|
||||
if (merged.isEmpty()) {
|
||||
merged.add(next);
|
||||
continue;
|
||||
}
|
||||
TachographEsperVehicleUsageIntervalEvent current = merged.get(merged.size() - 1);
|
||||
if (canMergeVehicleUsage(current, next)) {
|
||||
merged.set(merged.size() - 1, mergeVehicleUsage(current, next));
|
||||
} else {
|
||||
merged.add(next);
|
||||
}
|
||||
}
|
||||
return List.copyOf(merged);
|
||||
}
|
||||
|
||||
private boolean canMergeVehicleUsage(
|
||||
TachographEsperVehicleUsageIntervalEvent left,
|
||||
TachographEsperVehicleUsageIntervalEvent right
|
||||
) {
|
||||
if (left == null || right == null || left.endedAt() == null || right.startedAt() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(left.driverKey(), right.driverKey())
|
||||
&& Objects.equals(left.registrationKey(), right.registrationKey())
|
||||
&& Objects.equals(left.vehicleKey(), right.vehicleKey())
|
||||
&& !right.startedAt().isAfter(left.endedAt().plusSeconds(1));
|
||||
}
|
||||
|
||||
private TachographEsperVehicleUsageIntervalEvent mergeVehicleUsage(
|
||||
TachographEsperVehicleUsageIntervalEvent left,
|
||||
TachographEsperVehicleUsageIntervalEvent right
|
||||
) {
|
||||
List<String> sourceIntervalIds = new ArrayList<>();
|
||||
if (left.sourceIntervalIds() != null) {
|
||||
sourceIntervalIds.addAll(left.sourceIntervalIds());
|
||||
}
|
||||
if (right.sourceIntervalIds() != null) {
|
||||
for (String sourceIntervalId : right.sourceIntervalIds()) {
|
||||
if (!sourceIntervalIds.contains(sourceIntervalId)) {
|
||||
sourceIntervalIds.add(sourceIntervalId);
|
||||
}
|
||||
}
|
||||
}
|
||||
OffsetDateTime end = right.endedAt() == null || right.endedAt().isBefore(left.endedAt())
|
||||
? left.endedAt()
|
||||
: right.endedAt();
|
||||
return new TachographEsperVehicleUsageIntervalEvent(
|
||||
left.sessionId(),
|
||||
left.driverKey(),
|
||||
left.intervalId(),
|
||||
left.startedAt(),
|
||||
end,
|
||||
Duration.between(left.startedAt(), end).getSeconds(),
|
||||
left.odometerBeginKm(),
|
||||
right.odometerEndKm() == null ? left.odometerEndKm() : right.odometerEndKm(),
|
||||
left.registrationKey(),
|
||||
left.vehicleKey(),
|
||||
left.sourceKind(),
|
||||
sourceIntervalIds
|
||||
);
|
||||
}
|
||||
|
||||
private List<TachographEsperActivityIntervalEvent> clipActivityIntervals(
|
||||
List<TachographEsperActivityIntervalEvent> intervals,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo
|
||||
) {
|
||||
if (requestedFrom == null || requestedTo == null) {
|
||||
return intervals == null ? List.of() : List.copyOf(intervals);
|
||||
}
|
||||
return (intervals == null ? List.<TachographEsperActivityIntervalEvent>of() : intervals).stream()
|
||||
.map(interval -> {
|
||||
if (!intersects(interval.startedAt(), interval.endedAt(), requestedFrom, requestedTo)) {
|
||||
return null;
|
||||
}
|
||||
OffsetDateTime start = max(interval.startedAt(), requestedFrom);
|
||||
OffsetDateTime end = min(interval.endedAt(), requestedTo);
|
||||
if (start == null || end == null || !end.isAfter(start)) {
|
||||
return null;
|
||||
}
|
||||
boolean clipped = interval.clippedToRequestedPeriod()
|
||||
|| !Objects.equals(start, interval.startedAt())
|
||||
|| !Objects.equals(end, interval.endedAt());
|
||||
return new TachographEsperActivityIntervalEvent(
|
||||
interval.sessionId(),
|
||||
interval.driverKey(),
|
||||
interval.intervalId(),
|
||||
interval.activityType(),
|
||||
interval.cardSlot(),
|
||||
interval.cardStatus(),
|
||||
interval.drivingStatus(),
|
||||
interval.registrationKey(),
|
||||
interval.vehicleKey(),
|
||||
interval.sourceKind(),
|
||||
start,
|
||||
end,
|
||||
Duration.between(start, end).getSeconds(),
|
||||
interval.sourceIntervalIds(),
|
||||
interval.synthetic(),
|
||||
clipped,
|
||||
interval.level()
|
||||
);
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(Comparator.comparing(TachographEsperActivityIntervalEvent::startedAt)
|
||||
.thenComparing(TachographEsperActivityIntervalEvent::endedAt))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private List<TachographEsperVehicleUsageIntervalEvent> clipVehicleUsageIntervals(
|
||||
List<TachographEsperVehicleUsageIntervalEvent> intervals,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo
|
||||
) {
|
||||
if (requestedFrom == null || requestedTo == null) {
|
||||
return intervals == null ? List.of() : List.copyOf(intervals);
|
||||
}
|
||||
return (intervals == null ? List.<TachographEsperVehicleUsageIntervalEvent>of() : intervals).stream()
|
||||
.map(interval -> {
|
||||
if (!intersects(interval.startedAt(), interval.endedAt(), requestedFrom, requestedTo)) {
|
||||
return null;
|
||||
}
|
||||
OffsetDateTime start = max(interval.startedAt(), requestedFrom);
|
||||
OffsetDateTime end = min(interval.endedAt(), requestedTo);
|
||||
if (start == null || end == null || !end.isAfter(start)) {
|
||||
return null;
|
||||
}
|
||||
boolean startClipped = !Objects.equals(start, interval.startedAt());
|
||||
boolean endClipped = !Objects.equals(end, interval.endedAt());
|
||||
return new TachographEsperVehicleUsageIntervalEvent(
|
||||
interval.sessionId(),
|
||||
interval.driverKey(),
|
||||
interval.intervalId(),
|
||||
start,
|
||||
end,
|
||||
Duration.between(start, end).getSeconds(),
|
||||
startClipped ? null : interval.odometerBeginKm(),
|
||||
endClipped ? null : interval.odometerEndKm(),
|
||||
interval.registrationKey(),
|
||||
interval.vehicleKey(),
|
||||
interval.sourceKind(),
|
||||
interval.sourceIntervalIds()
|
||||
);
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(Comparator.comparing(TachographEsperVehicleUsageIntervalEvent::startedAt)
|
||||
.thenComparing(TachographEsperVehicleUsageIntervalEvent::endedAt))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private List<TachographEsperDrivingInterruptionIntervalEvent> clipDrivingIntervals(
|
||||
List<TachographEsperDrivingInterruptionIntervalEvent> intervals,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo
|
||||
) {
|
||||
return filterIntersecting(
|
||||
intervals,
|
||||
requestedFrom,
|
||||
requestedTo,
|
||||
TachographEsperDrivingInterruptionIntervalEvent::startedAt,
|
||||
TachographEsperDrivingInterruptionIntervalEvent::endedAt
|
||||
);
|
||||
}
|
||||
|
||||
private List<TachographEsperVuCardAbsentIntervalEvent> clipVuCardAbsentIntervals(
|
||||
List<TachographEsperVuCardAbsentIntervalEvent> intervals,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo
|
||||
) {
|
||||
return filterIntersecting(
|
||||
intervals,
|
||||
requestedFrom,
|
||||
requestedTo,
|
||||
TachographEsperVuCardAbsentIntervalEvent::startedAt,
|
||||
TachographEsperVuCardAbsentIntervalEvent::endedAt
|
||||
);
|
||||
}
|
||||
|
||||
private List<TachographEsperSupportGeoEvent> clipSupportGeoEvents(
|
||||
List<RuntimeSupportEvent> supportEvents,
|
||||
String driverKey,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo
|
||||
) {
|
||||
return (supportEvents == null ? List.<RuntimeSupportEvent>of() : supportEvents).stream()
|
||||
.filter(event -> event.occurredAt() != null)
|
||||
.filter(event -> driverKey == null || event.driverKey() == null || Objects.equals(driverKey, event.driverKey()))
|
||||
.filter(event -> requestedFrom == null || !event.occurredAt().isBefore(requestedFrom))
|
||||
.filter(event -> requestedTo == null || !event.occurredAt().isAfter(requestedTo))
|
||||
.map(event -> new TachographEsperSupportGeoEvent(
|
||||
event.eventId(),
|
||||
event.driverKey(),
|
||||
event.occurredAt(),
|
||||
event.eventDomain(),
|
||||
event.eventType(),
|
||||
event.eventLifecycle(),
|
||||
event.registrationKey(),
|
||||
event.vehicleKey(),
|
||||
event.country(),
|
||||
event.region(),
|
||||
event.countryFrom(),
|
||||
event.countryTo(),
|
||||
event.operation(),
|
||||
event.latitude(),
|
||||
event.longitude(),
|
||||
event.odometerKm(),
|
||||
event.rawRecordPath()
|
||||
))
|
||||
.sorted(Comparator.comparing(TachographEsperSupportGeoEvent::occurredAt)
|
||||
.thenComparing(TachographEsperSupportGeoEvent::eventId, Comparator.nullsLast(String::compareTo)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private <T> List<T> filterIntersecting(
|
||||
List<T> intervals,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo,
|
||||
TimeAccessor<T> startAccessor,
|
||||
TimeAccessor<T> endAccessor
|
||||
) {
|
||||
if (intervals == null || intervals.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
if (requestedFrom == null || requestedTo == null) {
|
||||
return List.copyOf(intervals);
|
||||
}
|
||||
return intervals.stream()
|
||||
.filter(interval -> intersects(startAccessor.get(interval), endAccessor.get(interval), requestedFrom, requestedTo))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private boolean intersects(
|
||||
OffsetDateTime intervalStart,
|
||||
OffsetDateTime intervalEnd,
|
||||
OffsetDateTime requestedFrom,
|
||||
OffsetDateTime requestedTo
|
||||
) {
|
||||
if (intervalStart == null || intervalEnd == null || requestedFrom == null || requestedTo == null) {
|
||||
return false;
|
||||
}
|
||||
return intervalEnd.isAfter(requestedFrom) && intervalStart.isBefore(requestedTo);
|
||||
}
|
||||
|
||||
private OffsetDateTime min(OffsetDateTime left, OffsetDateTime right) {
|
||||
if (left == null) {
|
||||
return right;
|
||||
}
|
||||
if (right == null) {
|
||||
return left;
|
||||
}
|
||||
return left.isBefore(right) ? left : right;
|
||||
}
|
||||
|
||||
private OffsetDateTime max(OffsetDateTime left, OffsetDateTime right) {
|
||||
if (left == null) {
|
||||
return right;
|
||||
}
|
||||
if (right == null) {
|
||||
return left;
|
||||
}
|
||||
return left.isAfter(right) ? left : right;
|
||||
}
|
||||
|
||||
private OffsetDateTime utc(OffsetDateTime value) {
|
||||
return value == null ? null : value.withOffsetSameInstant(ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
private interface TimeAccessor<T> {
|
||||
OffsetDateTime get(T value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.plan;
|
||||
package at.procon.eventhub.tachographfilesession.processing.plan;
|
||||
|
||||
import at.procon.eventhub.processing.eventprocessing.plan.DriverWorkingTimeRuntimeProcessingPlan;
|
||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
||||
|
||||
/**
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.profile;
|
||||
package at.procon.eventhub.tachographfilesession.processing.profile;
|
||||
|
||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
|
||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||
|
|
@ -6,6 +6,7 @@ import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventParti
|
|||
import at.procon.eventhub.processing.eventprocessing.plan.RuntimeProcessingExecutionApiRequest;
|
||||
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.Set;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.dto.AcquisitionStrategy;
|
||||
import at.procon.eventhub.dto.EventFamily;
|
||||
|
|
@ -15,6 +15,8 @@ import at.procon.eventhub.processing.model.UnifiedDiscoveredVehicleRef;
|
|||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
import at.procon.eventhub.processing.service.RuntimeDriverEventLoader;
|
||||
import at.procon.eventhub.processing.service.RuntimeVehicleEventLoader;
|
||||
import at.procon.eventhub.reference.TachographNationRegistry;
|
||||
import at.procon.eventhub.tachograph.dto.TachographImportRequest;
|
||||
import at.procon.eventhub.tachograph.service.TachographExtractionDefinitionRegistry;
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.dto.EventHubEventDto;
|
||||
import at.procon.eventhub.persistence.EventHubEventReadRepository;
|
||||
import at.procon.eventhub.processing.model.UnifiedDriverEventsRequest;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.service.UnifiedDriverEventSource;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.dto.EventHubEventDto;
|
||||
import at.procon.eventhub.persistence.EventHubEventReadRepository;
|
||||
import at.procon.eventhub.processing.model.UnifiedVehicleEventsRequest;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.service.UnifiedVehicleEventSource;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.dto.EventHubEventDto;
|
||||
import at.procon.eventhub.processing.model.UnifiedDiscoveredVehicleRef;
|
||||
|
|
@ -7,6 +7,10 @@ import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
|||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
import at.procon.eventhub.processing.model.UnifiedVehicleEventsRequest;
|
||||
import at.procon.eventhub.processing.service.RuntimeDriverEventLoader;
|
||||
import at.procon.eventhub.processing.service.RuntimeVehicleEventLoader;
|
||||
import at.procon.eventhub.processing.service.UnifiedDriverEventSourceService;
|
||||
import at.procon.eventhub.processing.service.UnifiedVehicleEventSourceService;
|
||||
import at.procon.eventhub.service.EventAcquisitionRecordKeyService;
|
||||
import at.procon.eventhub.service.EventHubEventSorter;
|
||||
import at.procon.eventhub.tachographfilesession.service.TachographCompositeSessionNotFoundException;
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.dto.EventHubEventDto;
|
||||
import at.procon.eventhub.processing.model.UnifiedDriverEventsRequest;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.service.RuntimeIntervalEventWindowSelector;
|
||||
import at.procon.eventhub.processing.service.UnifiedDriverEventSource;
|
||||
import at.procon.eventhub.tachographfilesession.model.DriverExtractionSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographTimelineEventBundle;
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.processing.model.RuntimeDriverTimeline;
|
||||
import at.procon.eventhub.processing.model.UnifiedDriverTimelineRequest;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.service.UnifiedDriverTimelineSource;
|
||||
import at.procon.eventhub.tachographfilesession.support.RuntimeTimelineCompatibilityAdapter;
|
||||
import at.procon.eventhub.tachographfilesession.model.DriverExtractionSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
package at.procon.eventhub.tachographfilesession.processing.service;
|
||||
|
||||
import at.procon.eventhub.dto.EventHubEventDto;
|
||||
import at.procon.eventhub.dto.VehicleRefDto;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedVehicleEventsRequest;
|
||||
import at.procon.eventhub.processing.service.RuntimeIntervalEventWindowSelector;
|
||||
import at.procon.eventhub.processing.service.UnifiedVehicleEventSource;
|
||||
import at.procon.eventhub.reference.TachographNationRegistry;
|
||||
import at.procon.eventhub.tachographfilesession.model.DriverExtractionSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package at.procon.eventhub.processing.service;
|
||||
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};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.validation;
|
||||
package at.procon.eventhub.tachographfilesession.processing.validation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.validation;
|
||||
package at.procon.eventhub.tachographfilesession.processing.validation;
|
||||
|
||||
public record RuntimeTachographParityCategoryComparisonDto(
|
||||
String category,
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.validation;
|
||||
package at.procon.eventhub.tachographfilesession.processing.validation;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.LinkedHashSet;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.validation;
|
||||
package at.procon.eventhub.tachographfilesession.processing.validation;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package at.procon.eventhub.processing.eventprocessing.validation;
|
||||
package at.procon.eventhub.tachographfilesession.processing.validation;
|
||||
|
||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeDerivedProjectionResultDto;
|
||||
import at.procon.eventhub.processing.driverworkingtime.dto.DriverWorkingTimeProcessingResultDto;
|
||||
|
|
@ -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.RuntimeEventProcessingResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||
import at.procon.eventhub.processing.eventprocessing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
||||
|
|
@ -2,6 +2,7 @@ package at.procon.eventhub.config;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
@ -31,4 +32,14 @@ class EventHubPropertiesTest {
|
|||
|
||||
assertFalse(legalRequirements.isResetSessionAfterUse());
|
||||
}
|
||||
|
||||
@Test
|
||||
void runtimeProcessingAndLegacyTachographProcessingShareTheSameSettingsInstance() {
|
||||
EventHubProperties properties = new EventHubProperties();
|
||||
|
||||
properties.getRuntimeProcessing().setSignificantDrivingMinutes(9);
|
||||
|
||||
assertSame(properties.getRuntimeProcessing(), properties.getTachographFileSession().getProcessing());
|
||||
assertEquals(9, properties.getTachographFileSession().getProcessing().getSignificantDrivingMinutes());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventParti
|
|||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
import at.procon.eventhub.processing.service.RuntimeDriverWorkingTimeScopeProcessingService;
|
||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class RuntimeSupportEvidenceNormalizerTest {
|
|||
private final RuntimeSupportEvidenceNormalizer normalizer = new RuntimeSupportEvidenceNormalizer(objectMapper);
|
||||
|
||||
@Test
|
||||
void normalizesVehicleOnlyIgnitionWithPositionAsTachographPositionSupportEvidence() {
|
||||
void normalizesVehicleOnlyIgnitionWithPositionAsDriverWorkingTimeSupportEvidence() {
|
||||
EventHubEventDto ignition = vehicleOnlyEvent(
|
||||
"ignition-on-1",
|
||||
EventDomain.IGNITION,
|
||||
|
|
@ -36,7 +36,7 @@ class RuntimeSupportEvidenceNormalizerTest {
|
|||
new GeoPointDto(new BigDecimal("48.2082"), new BigDecimal("16.3738"))
|
||||
);
|
||||
|
||||
RuntimeSupportEvidenceNormalizationResult result = normalizer.normalizeForTachographDriver(
|
||||
RuntimeSupportEvidenceNormalizationResult result = normalizer.normalizeForDriverWorkingTime(
|
||||
"DRIVER-1",
|
||||
List.of(ignition)
|
||||
);
|
||||
|
|
@ -53,7 +53,7 @@ class RuntimeSupportEvidenceNormalizerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void keepsTachographSupportDomainButAddsDriverAndNormalizedRawMetadata() {
|
||||
void keepsDirectSupportDomainButAddsDriverAndNormalizedRawMetadata() {
|
||||
EventHubEventDto border = vehicleOnlyEvent(
|
||||
"border-1",
|
||||
EventDomain.BORDER_CROSSING,
|
||||
|
|
@ -65,7 +65,7 @@ class RuntimeSupportEvidenceNormalizerTest {
|
|||
new GeoPointDto(new BigDecimal("48.5"), new BigDecimal("16.5"))
|
||||
);
|
||||
|
||||
EventHubEventDto normalized = normalizer.normalizeForTachographDriver("DRIVER-1", List.of(border))
|
||||
EventHubEventDto normalized = normalizer.normalizeForDriverWorkingTime("DRIVER-1", List.of(border))
|
||||
.normalizedEvents()
|
||||
.getFirst();
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ class RuntimeSupportEvidenceNormalizerTest {
|
|||
null
|
||||
);
|
||||
|
||||
RuntimeSupportEvidenceNormalizationResult result = normalizer.normalizeForTachographDriver(
|
||||
RuntimeSupportEvidenceNormalizationResult result = normalizer.normalizeForDriverWorkingTime(
|
||||
"DRIVER-1",
|
||||
List.of(cardUsage)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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.RuntimeEventProcessingResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||
import at.procon.eventhub.processing.eventprocessing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
import at.procon.eventhub.processing.model.UnifiedEventSourceFamily;
|
||||
import at.procon.eventhub.processing.model.UnifiedRuntimeEventBackend;
|
||||
import at.procon.eventhub.processing.dto.UnifiedRuntimeProcessingApiRequest;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ import at.procon.eventhub.processing.eventprocessing.RuntimeEventProcessingServi
|
|||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingPartitionResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
|
||||
import at.procon.eventhub.processing.eventprocessing.partition.RuntimeEventPartitioningStrategy;
|
||||
import at.procon.eventhub.processing.eventprocessing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
import at.procon.eventhub.tachographfilesession.processing.profile.TachographDriverEsperRuntimeEventProcessingProfile;
|
||||
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 at.procon.eventhub.processing.model.UnifiedRuntimeProcessingRequest;
|
||||
import at.procon.eventhub.tachographfilesession.dto.TachographEsperDriverProcessingResultDto;
|
||||
import at.procon.eventhub.tachographfilesession.model.DriverExtractionSession;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import at.procon.eventhub.tachographfilesession.model.ExtractedVehicleRegistrati
|
|||
import at.procon.eventhub.tachographfilesession.model.ExtractionStats;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSessionMetadata;
|
||||
import at.procon.eventhub.tachographfilesession.processing.service.TachographFileSessionRuntimeEventLoader;
|
||||
import at.procon.eventhub.tachographfilesession.processing.service.TachographFileSessionUnifiedDriverEventSource;
|
||||
import at.procon.eventhub.tachographfilesession.processing.service.TachographFileSessionUnifiedVehicleEventSource;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverKeyFactory;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverTimelineBuilder;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographCompositeSession;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import at.procon.eventhub.tachographfilesession.model.ExtractedVehicleRegistrati
|
|||
import at.procon.eventhub.tachographfilesession.model.ExtractionStats;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSessionMetadata;
|
||||
import at.procon.eventhub.tachographfilesession.processing.service.TachographFileSessionUnifiedDriverEventSource;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverKeyFactory;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverTimelineBuilder;
|
||||
import at.procon.eventhub.tachographfilesession.service.InMemoryTachographFileSessionRepository;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import at.procon.eventhub.tachographfilesession.model.ExtractedVehicleRegistrati
|
|||
import at.procon.eventhub.tachographfilesession.model.ExtractionStats;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSessionMetadata;
|
||||
import at.procon.eventhub.tachographfilesession.processing.service.TachographFileSessionUnifiedDriverTimelineSource;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverKeyFactory;
|
||||
import at.procon.eventhub.tachographfilesession.service.EventBackedDriverTimelineBuilder;
|
||||
import at.procon.eventhub.tachographfilesession.service.InMemoryTachographFileSessionRepository;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import at.procon.eventhub.tachographfilesession.model.ExtractedVehicleRegistrati
|
|||
import at.procon.eventhub.tachographfilesession.model.ExtractionStats;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSession;
|
||||
import at.procon.eventhub.tachographfilesession.model.TachographFileSessionMetadata;
|
||||
import at.procon.eventhub.tachographfilesession.processing.service.TachographFileSessionUnifiedVehicleEventSource;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverKeyFactory;
|
||||
import at.procon.eventhub.tachographfilesession.service.DriverTimelineBuilder;
|
||||
import at.procon.eventhub.tachographfilesession.service.InMemoryTachographFileSessionRepository;
|
||||
|
|
|
|||
Loading…
Reference in New Issue