Skip to content

Commit 0974079

Browse files
Merge pull request #467 from InseeFr/fix/getScheduleV1
correct get scheduleV1
2 parents 4fcb6a7 + b6369a2 commit 0974079

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.6.1 [TODO]
4+
### Fixed
5+
- Fixed V1 schedules endpoint returning an empty list when V1 schedules have a null `partitionId`.
6+
37
## 2.6.0 [2026-04-29]
48
### Fixed
59
- Prevent missing contextual external or previous files from clearing existing contextual data.

src/main/java/fr/insee/genesis/domain/model/context/DataProcessingContextModel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import java.time.LocalDateTime;
1515
import java.util.List;
16+
import java.util.Objects;
1617

1718
@Data
1819
@Builder
@@ -38,9 +39,9 @@ public List<ScheduleResponseDto> toScheduleV1ResponseDtos() {
3839
}
3940

4041
return kraftwerkExecutionScheduleList.stream()
41-
.filter(schedule -> schedule != null && schedule.getPartitionId() != null)
42+
.filter(Objects::nonNull)
4243
.map(schedule -> ScheduleResponseDto.builder()
43-
.collectionInstrumentId(schedule.getPartitionId())
44+
.collectionInstrumentId(collectionInstrumentId)
4445
.lastExecution(lastExecution)
4546
.frequency(schedule.getFrequency())
4647
.scheduleBeginDate(schedule.getScheduleBeginDate())

src/test/java/fr/insee/genesis/domain/model/context/DataProcessingContextModelTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void toScheduleV1ResponseDtos_null_schedule_ignored_test() {
194194
}
195195

196196
@Test
197-
void toScheduleV1ResponseDtos_no_partitionId_schedule_ignored_test() {
197+
void toScheduleV1ResponseDtos_no_partitionId_schedule_not_ignored_test() {
198198
//GIVEN
199199
String collectionInstrumentId = "test";
200200
String frequency = "0 0 0 0 0 0";
@@ -231,7 +231,7 @@ void toScheduleV1ResponseDtos_no_partitionId_schedule_ignored_test() {
231231
List<ScheduleResponseDto> scheduleResponseDtoList = dataProcessingContextModel.toScheduleV1ResponseDtos();
232232

233233
//THEN
234-
Assertions.assertThat(scheduleResponseDtoList).hasSize(1);
234+
Assertions.assertThat(scheduleResponseDtoList).hasSize(2);
235235
}
236236
}
237237

src/test/java/fr/insee/genesis/domain/service/context/DataProcessingContextServiceTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ void getSchedulesV1_test() {
263263

264264
DataProcessingContextDocument dataProcessingContextDocument = new DataProcessingContextDocument();
265265
dataProcessingContextDocument.setPartitionId(collectionInstrumentId);
266+
dataProcessingContextDocument.setCollectionInstrumentId(collectionInstrumentId);
266267
dataProcessingContextDocument.setKraftwerkExecutionScheduleList(kraftwerkExecutionScheduleList);
267268
when(dataProcessingContextPersistancePort.findAll()).thenReturn(List.of(dataProcessingContextDocument));
268269

0 commit comments

Comments
 (0)